//###########################################################################################################################//
//menu 

if ( navigator.appName != "Microsoft Internet Explorer" )
	strAppName = "IE";
else
	strAppName = "NN";

var strAddress;
if ( parent.length == 0 ) {
	strAddress = "" + this.location;
} else {
	strAddress = "" + parent[1].location;
}
strAddress = strAddress.toLowerCase()

function inString(argString, argTarget) {
	var i;
	if ( argString.length < argTarget.length )
		return false;

	for ( i = 0 ; i < argString.length - argTarget.length + 1 ; i++ ) {
		if ( argString.substring(i, i + argTarget.length) == argTarget )
			return true;
	}

	return false;
}

function getTabNum(argTabName) {
	return parseInt(argTabName,10);
}


function OnTopMenuOver(argString) {	
	var nTabNum = getTabNum(argString);
	var strSource = document.tabImage[nTabNum].src;
	var nLength = strSource.length
	var ImgNumber = strSource.substring(nLength - 8, nLength - 4);
	var highlight = strSource.charAt(nLength - 5); // a:unhighlight b:highlight

	if ( highlight == "a" ) {
		strImageName = document.tabImage[getTabNum(strBefore)].src;
		nImageLength = strImageName.length;
		document.tabImage[getTabNum(strBefore)].src = strImageName.substring(0, nImageLength - 5) + "a" + strImageName.substring(nImageLength - 4, nImageLength);

		document.tabImage[nTabNum].src = strSource.substring(0, nLength - 5) + "b" + strSource.substring(nLength - 4, nLength);
		hideSubMenu( strBefore );
		viewSubMenu( argString );
	}
	strBefore = argString;
	return true;
}

function OnTopMenuOut() {	
	var strImageName, nImageLength;

	if ( getTabNum(cTabName) < 0 ) {
		for ( var i = 0 ; i < nMenuNum ; i ++ ) {
			if ( strBefore != "00" )
			hideSubMenu( strBefore );
			strImageName = document.tabImage[i].src;
			nImageLength = strImageName.length;
			document.tabImage[i].src = strImageName.substring(0, nImageLength - 5) + "b" + strImageName.substring(nImageLength - 4, nImageLength);
		}
	} else {
		strImageName = document.tabImage[getTabNum(strBefore)].src;
		nImageLength = strImageName.length;
		document.tabImage[getTabNum(strBefore)].src = strImageName.substring(0, nImageLength - 5) + "a" + strImageName.substring(nImageLength - 4, nImageLength);

		strImageName = document.tabImage[getTabNum(cTabName)].src;
		nImageLength = strImageName.length;
		document.tabImage[getTabNum(cTabName)].src = strImageName.substring(0, nImageLength - 5) + "b" + strImageName.substring(nImageLength - 4, nImageLength);

		hideSubMenu( strBefore );
		viewSubMenu(cTabName);
		strBefore = cTabName;
	}
	return true;
}

function viewSubMenu(argID) {
	document.all["submenu" + argID].style.visibility = "visible";
	document.all["submenu" + argID].style.display = "block";
	return true;
}

function hideSubMenu(argID) {
	document.all["submenu" + argID].style.visibility = "hidden";
	document.all["submenu" + argID].style.display = "none";
	return true;
}

var nMenuNum, cTabName, nTabNum;
nMenuNum = document.tabImage.length;

if ( inString(strAddress, "/#/") ){
		cTabName = "00";
	}
else if ( inString(strAddress, "/#/") ){
		cTabName = "01";
	}
else if ( inString(strAddress, "/#/") ){
		cTabName = "02";
	}
else if ( inString(strAddress, "/#/") ){
		cTabName = "03";
	}
else if ( inString(strAddress, "/#/") ){
		cTabName = "04";
	}
else if ( inString(strAddress, "/#/")){
		cTabName = "05";
	}
else if ( inString(strAddress, "/#/")){
		cTabName = "06";
	}
else if ( inString(strAddress, "/#/")){
		cTabName = "07";
	}
	
else{
		cTabName = "00";
	}


var strBefore = cTabName;
OnTopMenuOut();// onload tap

var strImageName, nImageLength;
if ( getTabNum(cTabName) < 0 ) {
	for ( var i = 0 ; i < nMenuNum ; i ++ ) {
		if ( strBefore != "00" )
		hideSubMenu( strBefore );
		strImageName = document.tabImage[i].src;
		nImageLength = strImageName.length;
		document.tabImage[i].src = strImageName.substring(0, nImageLength - 5) + "b" + strImageName.substring(nImageLength - 4, nImageLength);
	}
} else {
	strImageName = document.tabImage[getTabNum(strBefore)].src;
	nImageLength = strImageName.length;
	document.tabImage[getTabNum(strBefore)].src = strImageName.substring(0, nImageLength - 5) + "a" + strImageName.substring(nImageLength - 4, nImageLength);

	strImageName = document.tabImage[getTabNum(cTabName)].src;
	nImageLength = strImageName.length;
	document.tabImage[getTabNum(cTabName)].src = strImageName.substring(0, nImageLength - 5) + "b" + strImageName.substring(nImageLength - 4, nImageLength);

	hideSubMenu( strBefore );
	viewSubMenu(cTabName);
	strBefore = cTabName;
}