/*
	Panasonic Global
	JS FILE [menu_function.js]
	This file contains the definition of "menu highlight".
 */

function setBtnHighLight(){
	this.w3c = document.getElementById; if (!this.w3c) return false;
	var agent = navigator.userAgent.toLowerCase(); 
	this.ie = agent.indexOf('msie') != -1;
	return this;
}

setBtnHighLight.prototype = {
	indexFileName: new Array(
		"index.html"
	),
	init : function(){
		if(!BH.btn) return false;
		BH.gndiv = document.getElementById("globalnav"); if(!BH.gndiv) return false;BH.setGN();
		BH.lcdiv = document.getElementById("localnav"); if(!BH.lcdiv) return false;
		BH.setLN();
	},

	setGN : function(){
		if(!BH.btn.gn) return false;
		gi = document.getElementById(BH.btn.gn);if(!gi || !BH.btn.gn) return false;
		ga = gi.getElementsByTagName("a");
		
		gahref = BH.fixedURL(ga[0].href);
		currentpth = BH.getCurrentpth();
		if(gahref == currentpth){
			if(!ie5mac) ga[0].removeAttribute("href");
		}
		
		ga[0].className = "on";
	},

	setLN : function(){
		ti = document.getElementById(BH.btn.ln);if(!ti || !BH.btn.ln) return false;
		cti = ti.childNodes;pti = ti.parentNode;
		
		if(!ie5mac) {
			ta = ti.getElementsByTagName("a");
			tahref = BH.fixedURL(ta[0].href);
			currentpth = BH.getCurrentpth();
			if(tahref == currentpth){
				ta[0].removeAttribute("href");
				ta[0].onmouseover = function(){
					this.style.textDecoration = "none";
				}
			}
		}
		
		function setsubli(){
			for(var i=0,f=cti.length ; i<f ; i++){
				if(cti[i].nodeName.toLowerCase() == "ul"){
					cti[i].style.display = "block";
				}
			}
		}
		if(BH.btn.ln.substring(2,3) == 1){//2nd
			setsubli();
		}else if(BH.btn.ln.substring(2,3) == 2){//3rd
			pti.style.display = "block";
			setsubli();
		}else if(BH.btn.ln.substring(2,3) == 3){
			ti.parentNode.parentNode.parentNode.style.display = "block";
			ti.parentNode.style.display = "block";
		}
		ti.className="on";
		BH.lcdiv.style.visibility = "visible";
	},
	
	getCurrentpth: function(){
		var currentpth = location.protocol + "//" + location.hostname + ((location.port) ? ":" + location.port : "") + BH.fixedURL(pth);
		return currentpth;
	},

	fixedURL : function(url){
		for (var i = 0, f = BH.indexFileName.length; i < f; i++) {
			var fixurl = url.indexOf("/" + BH.indexFileName[i]);
			if (fixurl != -1){
				url = url.replace(BH.indexFileName[i], "");
			}
		}
		return url;
	}
}

var BH = new setBtnHighLight();//BH : Set Btn Highlight .
window.addOnload(BH.init);

try {
	document.execCommand("BackgroundImageCache", false, true);
}catch(e) {}

