/*
	menu.js (wacom version.)
	Created by M.SARUTA
*/

var dir;
var tTimer;
var LoadFinish = false;

var isPc = (navigator.userAgent.indexOf("Windows") != -1);
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var isNS = (navigator.appName == "Netscape");
var isNS4 = (isNS && (navigator.userAgent.indexOf("Gecko") == -1));
var isNS6 = (isNS && (navigator.userAgent.indexOf("Gecko") != -1));
var isIE = ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc = ((navigator.userAgent.indexOf("MSIE") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc5 = ((navigator.userAgent.indexOf("MSIE 5.0") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc55 = ((navigator.userAgent.indexOf("MSIE 5.5") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc6 = ((navigator.userAgent.indexOf("MSIE 6.") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEMac = ((navigator.userAgent.indexOf("MSIE") != -1) && isMac && (navigator.userAgent.indexOf("Opera") == -1));
var version = parseInt(navigator.appVersion);
var lP = location.pathname;


function cHColor(layName){
	if(document.getElementById) document.getElementById(layName).style.backgroundColor =focusColor;
	else if(document.all) document.all(layName).style.backgroundColor=focusColor;
}

function deFColer(layName){
	if(document.getElementById) document.getElementById(layName).style.backgroundColor =defoultColor;
	else if(document.all) document.all(layName).style.backgroundColor=defoultColor;
}


function swichLayer(layerName,condition){
	if((isNS6)&&(document.getElementById(layerName))) document.getElementById(layerName).style.visibility = condition;
	if((isIE)&&(document.all[layerName])) document.all[layerName].style.visibility = condition;
}


function chCourser(layerName){
	if (isNS6) layerName.style.cursor = "pointer";
	else layerName.style.cursor = "hand";
}

function getURL(url,target){
	mClose();
	//sbmClose();
	if(target == '_blank'){
		win_set = 'directories=yes,status=yes,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes';
		swin = window.open(url,'New',win_set);
		swin.focus();
	}else if(target == '_popup') openWin(url,'New',740,460,0,0,0);
	else if(target == '_basel') openWin(url,'BASEL',742,540,0,0,0);
	else  location.href = url;
}

function roll(imageName, imageState) {
	if (loaded == 1 && imageState != '') {
		tabOn = eval(imageName+"_"+imageState+".src");
		document [imageName].src = tabOn;
	}else{
		return false;
	}
}

function underBar(text){
	if(!text) self.status ='';
	else self.status = text;
}


function init(){
	LoadFinish = true;
}


function btnOn(btnName,layName){
	if(btnName !='') roll(btnName,'on');
	if(!isNS4&&LoadFinish){mClose();
		if(layName) swichLayer(layName,'visible');
		tClearTimer();
		//sbmClose();
	}
}

function btnOff(btnName,layName){
	if(btnName !='') roll(btnName,'off');
	if(!isNS4&&LoadFinish) swichLayer(layName,'hidden');
}

function mBMemu() {
	tSetTimer();
}
function mFMenu(layName){
	tClearTimer();
	swichLayer(layName,'visible');
}

function mBlabel(id){
	deFColer(id);
}

function mFlabel(id){
	cHColor(id);
	tClearTimer();
	//tTimer = setTimeout("mClose();sbmClose()",80000);
	tTimer = setTimeout("mClose()",80000);
}

function showSbm(target){
	for(i = 0;i < sbmObjArray.length;i++){
		if( i == target) swichLayer('sub' + i,'visible');
		else swichLayer('sub' + i,'hidden');
	}
}

function tSetTimer(){
	//tTimer = setTimeout("mClose();sbmClose()",300);
	tTimer = setTimeout("mClose()",300);
}

function tClearTimer() {
		if (tTimer) clearTimeout(tTimer);
}

function mClose(){
	for(i = 0;i < mObjArray.length;i++){
		swichLayer('menu' + i,'hidden');
	}
}
function sbmClose(){
	for(i = 0;i < sbmObjArray.length;i++){
		swichLayer('sub'+i,'hidden');
	}
}

