/*--------------------------------------------------------------------------*
 *  
 *  heightLine JavaScript Library beta4
 *  
 *  MIT-style license. 
 *  
 *  2007 Kazuma Nishihata 
 *  http://www.webcreativepark.net
 *  
 *--------------------------------------------------------------------------*/
new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if (objCN.hasOwnProperty(key)) {
					//parent type
					if(key == "parent CN"){
						for(var i=0 ; i<objCN[key].length ; i++){
							var max_height=0;
							var CCN = objCN[key][i].childNodes;
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j] && CCN[j].nodeType == 1){
									CCN[j].style.height="auto";
									max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
								}
							}
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j].style){
									var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									CCN[j].style.height =newheight+"px";
								}
							}
						}
					}else{
						var max_height=0;
						for(var i=0 ; i<objCN[key].length ; i++){
							objCN[key][i].style.height="auto";
							max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
						}
						for(var i=0 ; i<objCN[key].length ; i++){
							if(objCN[key][i].style){
								var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									objCN[key][i].style.height =newheight+"px";
							}
						}
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
		window.onresize=changeBoxSize;
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}
/*--------------------------------------------------------------------------*
 *  scroll.js
 *--------------------------------------------------------------------------*/
fd = new Object();
fd.onLoad = function(e) {
	for(var module in this) {
		if(this[module].onLoad) this[module].onLoad();
	}
}
fd.getDocumentHeight = function(){
	return (document.height) ? document.height : (document.body.offsetHeight) ? document.body.offsetHeight : 0;
}
fd.getWindowHeight = function(){
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}
fd.getScrollTop = function(){
	if(document.all) return (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
	else return window.pageYOffset;
}
fd.getElementYpos = function(el){
	var y = 0;
	while(el.offsetParent){
		y += el.offsetTop
		el = el.offsetParent;
	}
	return y;
}
/*
Based on an original script by Travis Beckham (http://www.squidfingers.com)
Wrapped into an Object by yours truly
Further enhancements and bug fixs by Marco Rosella (http://www.centralscrutinizer.it)
*/
fd.pageScroller = {
	speed : 1,
	maxStep: 100,
	brakeK: 3,
	hash:null,
	currentBlock:null,
	requestedY:0,
        
	onLoad: function() {
		var lnks = document.getElementsByTagName('a');
		for(var i = 0, lnk; lnk = lnks[i]; i++) {
			if ((lnk.href && lnk.href.indexOf('#') != -1) &&  ( (lnk.pathname == location.pathname) || ('/'+lnk.pathname == location.pathname) ) && (lnk.search == location.search) && lnk.className.search('no-scroll') == -1) {
				lnk.onclick = fd.pageScroller.initScroll;
			}
		}
	},
	initScroll: function(e){
		var targ;
		if (!e) var e = window.event;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		// Added by f.d: make sure we actually have the A node and a child tag like span or img
		while(targ.tagName.toUpperCase() != "A" && targ.parentNode) targ = targ.parentNode;
                
		fd.pageScroller.hash = targ.href.substr(targ.href.indexOf('#')+1,targ.href.length);
		fd.pageScroller.currentBlock = document.getElementById(fd.pageScroller.hash);

		if(!fd.pageScroller.currentBlock) return;
		fd.pageScroller.requestedY = fd.getElementYpos(fd.pageScroller.currentBlock) - 30;
		/*@cc_on@*/
		/*@if(@_jscript_version < 6)
			fd.pageScroller.requestedY += 30;
		/*@end@*/
		if(fd.pageScroller.requestedY < 0) fd.pageScroller.requestedY = 0;

		fd.pageScroller.scroll();
		return false;
	},
	scroll: function(){
		var top  = fd.getScrollTop();

		if(fd.pageScroller.requestedY > top) {
			var endDistance = Math.round((fd.getDocumentHeight() - (top + fd.getWindowHeight())) / fd.pageScroller.brakeK);
			endDistance = Math.min(Math.round((fd.pageScroller.requestedY-top)/ fd.pageScroller.brakeK), endDistance);
			var offset = Math.max(2, Math.min(endDistance, fd.pageScroller.maxStep));
		} else {
			var offset = - Math.min(Math.abs(Math.round((fd.pageScroller.requestedY-top)/ fd.pageScroller.brakeK)), fd.pageScroller.maxStep);
		}
		window.scrollTo(0, top + offset);
		if(Math.abs(top-fd.pageScroller.requestedY) <= 1 || fd.getScrollTop() == top) {
			window.scrollTo(0, fd.pageScroller.requestedY);
			location.hash = fd.pageScroller.hash;
			fd.pageScroller.hash = null;
		} else {
			setTimeout(fd.pageScroller.scroll,fd.pageScroller.speed);
		}
	}
}

var hoge_scripts = window.onload;
window.onload = function() {
	if(hoge_scripts != null) hoge_scripts();
	fd.onLoad();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/*--------------------------------------------------------------------------*
 *  index rollover
 *--------------------------------------------------------------------------*/
function RollOver (obj,val1,val2) {
  obj.src = "/images/index_subnavi_" + val1 + "_" + val2 + ".jpg";
}
function RollOverOut (obj,val1,val2) {
  obj.src = "/images/index_subnavi_" + val1 + "_" + val2 + "_f2.jpg";
}

/*--------------------------------------------------------------------------*
 *  LordSwf
 *--------------------------------------------------------------------------*/
/* top.swf */
function LordSwf1 () {
	var so = new SWFObject("/images/top.swf", "top", "890", "390", "8", "#FFFFFF");
	so.addParam("allowScriptAccess", "sameDomain");
	so.addParam("loop", "false");
	so.addParam("quality", "best");
	so.write("flash1");
}
/* products.swf */
function LordSwf2 () {
	var so = new SWFObject("/images/products.swf", "top", "450", "265", "8", "#FFFFFF");
	so.addParam("allowScriptAccess", "sameDomain");
	so.addParam("loop", "true");
	so.addParam("quality", "best");
	so.write("flash2");
}