function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

/* ものづくり精神 */
function openFull(){
 h = screen.availHeight;
 w = screen.availWidth;
 window.open( rootPath + "pickup/spirits/index.html","window1","height="+h+",width="+w+",top=0,left=0");
}

function initGNavi(){
	var objGNavi, objUl, objLi, objA, objImg, objList;
	var i, j;
	
	//set Anchor width
	objGNavi = document.getElementById("gNavi");
	objUl = objGNavi.getElementsByTagName("ul");
	for( i = 0; i < objUl.length; i++ ){
		objLi = objUl[i].getElementsByTagName("li");
		for( j = 0; j < objLi.length; j++ ){
			objA   = objLi[j].getElementsByTagName("a");
			objImg = objLi[j].getElementsByTagName("img");
			if( objImg.length != 0 ){
				objA[0].style.width = objImg[0].getAttribute("width");
			}
		}
	}
	
	//set active
	if( category != "" ){
		var objList = document.getElementById("gNavi_" + category);
		var objImg = objList.getElementsByTagName("img");
		objImg[0].src = rootPath + "images/b2_gnavi_" + category + ".gif";
	}
}

var openedMenu = null;
var TimerID;
var TimerID2;
var delay = 700;

function dispPD(id){
	if (openedMenu && openedMenu != id && id.indexOf("ir") < 0 ){
		hydePD();
	}
	dispMenu(id);
}

function dispMenu(id){
	if ( document.getElementById ){
		//document.getElementById( id ).style.visibility = 'visible';
		document.getElementById( id ).style.display = 'block';
	}else if ( document.all ){
		//document.all( id ).style.visibility = 'visible';
		document.all( id ).style.display = 'block';
	}else if ( document.layers ){
		document.layers[ id ].visibility = 'show';
	}
	clearTimeout(TimerID);
	openedMenu = id;
}

function hydePD(){
	if ( document.getElementById ){
		//document.getElementById( openedMenu ).style.visibility = 'hidden';
		document.getElementById( openedMenu ).style.display = 'none';
	}else if ( document.all ){
		//document.all( openedMenu ).style.visibility = 'hidden';
		document.all( openedMenu ).style.display = 'none';
	}else if ( document.layers ){
		document.layers[ openedMenu ].visibility = 'hide';
	}
	openedMenu = null;
}

function dispIR(){
	if ( document.getElementById ){
		//document.getElementById( "pd_ir" ).style.visibility = 'visible';
		document.getElementById( "pd_ir" ).style.display = 'block';
	}else if ( document.all ){
		//document.all( "pd_ir" ).style.visibility = 'visible';
		document.all( "pd_ir" ).style.display = 'block';
	}else if ( document.layers ){
		document.layers[ "pd_ir" ].visibility = 'show';
	}
	clearTimeout(TimerID2);
	var objP = document.getElementById("pd_ir_parent");
	objP.style.borderRight = "1px solid #eee";
	objP.style.backgroundColor = "#eee";
	objP.style.backgroundImage = "url(" + rootPath + "images/i_bg_eee.gif)";
	objP.style.backgroundPosition = "left top";
	objP.style.backgroundRepeat = "repeat";
}

function hydeIR(){
	if ( document.getElementById ){
		//document.getElementById( "pd_ir" ).style.visibility = 'hidden';
		document.getElementById( "pd_ir" ).style.display = 'none';
	}else if ( document.all ){
		//document.all( "pd_ir" ).style.visibility = 'hidden';
		document.all( "pd_ir" ).style.display = 'none';
	}else if ( document.layers ){
		document.layers[ "pd_ir" ].visibility = 'hide';
	}
	var objP = document.getElementById("pd_ir_parent");
	objP.style.borderRight = "1px solid #ccc";
	
	objP.style.backgroundColor = "#fff";
	objP.style.backgroundImage = "none";
}

function initLNavi(){
	var i, j;
	var objLNavi = document.getElementById("lNavi");
	var objListP = objLNavi.getElementsByTagName("ul");
	var objListC;
	var parentId = "";
	var parentId2 = "";
	var objParent;
	var objParent2;
	var objTmp;
	
	if( current != "" ){
		//parent item id
		if( current.lastIndexOf("_") != -1 ){
			parentId = current.substring(0, current.lastIndexOf("_"));
		} else {
			parentId = current;
		}
		if( parentId.lastIndexOf("_") != -1 ){
			parentId2 = parentId.substring(0, parentId.lastIndexOf("_"));
		} else {
			parentId2 = parentId;
		}
	}
	
	//hyde child item
	for( i = 0; i < objListP.length; i++ ){
		objListC = objListP[i].getElementsByTagName("div");
		for( j = 0; j < objListC.length; j++ ){
			if( objListC[j].getAttribute("name").indexOf("item") != -1 ){
				if( objListC[j].getAttribute("name") != current && objListC[j].getAttribute("name") != parentId && objListC[j].getAttribute("name") != parentId2 ){
					objListC[j].style.display = "none";
				}
			}
		}
	}
	
	if( current != "" ){
		//child or grandchild item
		if( current.indexOf("_") != -1 ) {
		
			//child item
			if( current.split("_").length == 2 ) {

				//setting - parent
				objParent = document.getElementById( parentId );
				objParent.style.marginBottom = "0";
				if( objParent.getAttribute( "name" ) != "extra" ) {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_down.gif)";
				} else {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_g_down.gif)";
				}
				objParent.style.backgroundPosition = "5px center";
				objParent.style.backgroundRepeat   = "no-repeat";

				objParent.onmouseover = function() {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_active.gif)";
				}

				objParent.onmouseout = function() {
					if( objParent.getAttribute( "name" ) != "extra" ) {
						objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_down.gif)";
					} else {
						objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_g_down.gif)";
					}
				}

				//highlight - child
				document.getElementById( current ).style.backgroundColor    = "#fff2bf";
				document.getElementById( current ).style.backgroundImage    = "url(" + rootPath + "images/i_lnavi_arrow_o_active.gif)";
				document.getElementById( current ).style.backgroundPosition = "13px center";
				document.getElementById( current ).style.backgroundRepeat   = "no-repeat";
				
			//grandchild item
			} else if( current.split("_").length == 3 ) {
				
				//setting - parent
				objParent = document.getElementById( parentId2 );
				objParent.style.marginBottom = "0";
				if( objParent.getAttribute( "name" ) != "extra" ) {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_down.gif)";
				} else {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_g_down.gif)";
				}
				objParent.style.backgroundPosition = "5px center";
				objParent.style.backgroundRepeat   = "no-repeat";

				objParent.onmouseover = function() {
					objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_active.gif)";
				}

				objParent.onmouseout = function() {
					if(objParent.getAttribute( "name" ) != "extra" ) {
						objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_down.gif)";
					} else {
						objParent.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_g_down.gif)";
					}
				}
				
				//setting - child
				objParent2 = document.getElementsByName( parentId );
				for( i = 0; i < objParent2.length; i++ ) {
					//highlight - child
					objListP = document.getElementById( parentId );
					objListP.style.marginBottom       = "0";
					objListP.style.borderBottom       = "none";
					objListP.style.backgroundImage    = "url(" + rootPath + "images/i_lnavi_arrow_o_down.gif)";
					objListP.style.backgroundPosition = "13px center";
					objListP.style.backgroundRepeat   = "no-repeat";
					
					objListP.onmouseover = function() {
						objListP.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_o_active.gif)";
					}
					
					objListP.onmouseout = function() {
						objListP.style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_o_down.gif)";
					}
				}

				//highlight - grandchild
				document.getElementById( current ).style.backgroundColor = "#fff2bf";
			}

		//parent item
		} else {
			//highlight - parent
			if( document.getElementById( current + "_1" ) != null || document.getElementById( current + "_1" ) != undefined ) {
				//child
				document.getElementById( current ).style.marginBottom     = "0";
				document.getElementById( current + "_1" ).style.borderTop = "1px solid #fff2bf";
				
				document.getElementById( current + "_1" ).onmouseover = function() {
					document.getElementById( current + "_1" ).style.borderTop = "1px solid #d9e8ff";
				}
				
				document.getElementById( current + "_1" ).onmouseout = function() {
					document.getElementById( current + "_1" ).style.borderTop = "1px solid #fff2bf";
				}
			} else {
				//no child
				document.getElementById( current ).style.marginBottom = "1px";
			}
			document.getElementById( current ).style.backgroundColor = "#fff2bf";
			document.getElementById( current ).style.backgroundImage = "url(" + rootPath + "images/i_lnavi_arrow_b_active.gif)";
			document.getElementById( current ).style.backgroundPosition = "5px center";
			document.getElementById( current ).style.backgroundRepeat = "no-repeat";
			if( document.getElementById( current ).getAttribute( "name" ) == "extra" ) {
				document.getElementById( current ).style.color = "#333";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news1" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_01b.gif";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news2" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_02b.gif";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news3" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_03b.gif";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news4" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_04b.gif";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news5" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_05b.gif";
			}
			if( document.getElementById( current ).getAttribute( "name" ) == "news6" ) {
				objTmp = document.getElementById( current );
				objTmp = objTmp.getElementsByTagName("img");
				objTmp[0].src = rootPath + "news/images/lnavi_icon_06b.gif";
			}
		}
	}
}

function swapNewsIcon( strName ) {
	var objTmp = document.getElementsByName( strName );
	objTmp = objTmp[0].getElementsByTagName("img");
	objTmp[0].src = rootPath + "news/images/lnavi_icon_0" + strName.substr(4, 1) + "b.gif";
}

function restoreNewsIcon( strId, strName ) {
	var objTmp = document.getElementsByName( strName );
	objTmp = objTmp[0].getElementsByTagName("img");
	if( current == strId ){
		objTmp[0].src = rootPath + "news/images/lnavi_icon_0" + strName.substr(4, 1) + "b.gif";
	} else {
		objTmp[0].src = rootPath + "news/images/lnavi_icon_0" + strName.substr(4, 1) + ".gif";
	}
}