/* Valves lv4 flyings */

//Flying tables' IDs
var lv4ValvesIDOfMainPage = new Array(valvCataId[0]+"lv4", valvCataId[1]+"lv4", valvCataId[2]+"lv4", valvCataId[3]+"lv4", valvCataId[4]+"lv4", valvCataId[5]+"lv4");
var lv4ValvesIDOfValvePage = new Array(valvCataId[0]+"Sub", valvCataId[1]+"Sub", valvCataId[2]+"Sub", valvCataId[3]+"Sub", valvCataId[4]+"Sub", valvCataId[5]+"Sub");
var valveMenuLeftAjust;

if (iSiteLang == 1)
	valveMenuLeftAjust = -35;
else 
	valveMenuLeftAjust = -8;

//Labels on lv4 flying menus
var valvesLv4LabelA = new Array(MSG10311, MSG10312);
var valvesLv4LabelB = new Array(MSG10311);
var pressureLv4Label = new Array(MSG10313, MSG10314, MSG10315);
var pressureLv4PDF = new Array("GPValveFlyer.pdf", "valveflyer(BP).pdf", "ValvesPressureSelect.aspx");

var cpvbArray = new Array("cpbvlv42way", "cpbvlv43way");
var fpbvArray = new Array("fpbvlv42way");
var ibvArray = new Array("ibvlv42way", "ibvlv43way");
var globeArray = new Array("globelv42way", "globelv43way");
var butterflyArray = new Array("butterflylv42way", "butterflylv43way");
var pressureArray = new Array("pressureindlv42way", "pressureindlv43way", "pressureindlv4Sele");

var cpvbSubArray = new Array("cpbvSub2way", "cpbvSub3way");
var fpbvSubArray = new Array("fpbvSub2way");
var ibvSubArray = new Array("ibvSub2way", "ibvSub3way");
var globeSubArray = new Array("globeSub2way", "globeSub3way");
var butterflySubArray = new Array("butterflySub2way", "butterflySub3way");
var pressureSubArray = new Array("pressureindSub2way", "pressureindSub3way", "pressureindSubSele");

//Labels on lv5 flying menus
//var valvesLv5a = new Array("NPT Female", "Double Union, NPT Female", "Double Union, Sweat");
var valvesLv5b = new Array(MSG10316, MSG10317);

//Valve Lv5 idArray
//var subpageLv5IdArray1 = createValveLv5IdArray(lv4ValvesIDOfValvePage[0]+"2way", valvesLv5a.length);
//var subpageLv5IdArray2 = createValveLv5IdArray(lv4ValvesIDOfValvePage[1]+"2way", valvesLv5a.length);
var subpageLv5IdArray3 = createValveLv5IdArray(lv4ValvesIDOfValvePage[3]+"2way", valvesLv5b.length);
var subpageLv5IdArray4 = createValveLv5IdArray(lv4ValvesIDOfValvePage[3]+"3way", valvesLv5b.length);

//var mainpageLv5IdArray1 = createValveLv5IdArray(lv4ValvesIDOfMainPage[0]+"2way", valvesLv5a.length)
//var mainpageLv5IdArray2 = createValveLv5IdArray(lv4ValvesIDOfMainPage[1]+"2way", valvesLv5a.length);
var mainpageLv5IdArray3 = createValveLv5IdArray(lv4ValvesIDOfMainPage[3]+"2way", valvesLv5b.length);
var mainpageLv5IdArray4 = createValveLv5IdArray(lv4ValvesIDOfMainPage[3]+"3way", valvesLv5b.length);

// Functions for Valves Flyings menus in Main Page
function createValveFlyings()
{	
	//Main Menu
	createLv2ValveFlying(lv4ValvesIDOfMainPage[0], cpvbArray, valvesLv4LabelA, "mainPage");
	createLv2ValveFlying(lv4ValvesIDOfMainPage[1], fpbvArray, valvesLv4LabelB, "mainPage");
	createLv2ValveFlying(lv4ValvesIDOfMainPage[2], ibvArray, valvesLv4LabelA, "mainPage");
	createLv2ValveFlying(lv4ValvesIDOfMainPage[3], globeArray, valvesLv4LabelA, "mainPage");
	createLv2ValveFlying(lv4ValvesIDOfMainPage[4], butterflyArray, valvesLv4LabelA, "mainPage");
	//Pressure Independent
	createLv2ValvePressureFlying(lv4ValvesIDOfMainPage[5], pressureArray, pressureLv4Label, pressureLv4PDF, "mainPage");
	
	//Valve sub menu
	createLv2ValveFlying(lv4ValvesIDOfValvePage[0], cpvbSubArray, valvesLv4LabelA, "valvePage");
	createLv2ValveFlying(lv4ValvesIDOfValvePage[1], fpbvSubArray, valvesLv4LabelB, "valvePage");
	createLv2ValveFlying(lv4ValvesIDOfValvePage[2], ibvSubArray, valvesLv4LabelA, "valvePage");
	createLv2ValveFlying(lv4ValvesIDOfValvePage[3], globeSubArray, valvesLv4LabelA, "valvePage");
	createLv2ValveFlying(lv4ValvesIDOfValvePage[4], butterflySubArray, valvesLv4LabelA, "valvePage");
	//Pressure Independent
	createLv2ValvePressureFlying(lv4ValvesIDOfValvePage[5], pressureSubArray, pressureLv4Label, pressureLv4PDF, "valvePage");
	
	setLv4ValveFlyingMainPagePosition();
	setLv4ValveFlyingValvesMenuPosition();
	
	//Create lv5 Valves Flying Menus
	//createLv5Flying(lv4ValvesIDOfValvePage[0] + "2way5", subpageLv5IdArray1, valvesLv5a, "valvePage");
	//createLv5Flying(lv4ValvesIDOfValvePage[1] + "2way5", subpageLv5IdArray2, valvesLv5a, "valvePage");
	createLv5Flying(lv4ValvesIDOfValvePage[3] + "2way5", subpageLv5IdArray3, valvesLv5b, "valvePage");
	createLv5Flying(lv4ValvesIDOfValvePage[3] + "3way5", subpageLv5IdArray4, valvesLv5b, "valvePage");
	setLv5ValveFlyingValvesMenuPosition();
	
	//createLv5Flying(lv4ValvesIDOfMainPage[0] + "2way5", mainpageLv5IdArray1, valvesLv5a, "mainPage");
	//createLv5Flying(lv4ValvesIDOfMainPage[1] + "2way5", mainpageLv5IdArray2, valvesLv5a, "mainPage");
	createLv5Flying(lv4ValvesIDOfMainPage[3] + "2way5", mainpageLv5IdArray3, valvesLv5b, "mainPage");
	createLv5Flying(lv4ValvesIDOfMainPage[3] + "3way5", mainpageLv5IdArray4, valvesLv5b, "mainPage");
	setLv5ValveFlyingMainMenuPosition();
	
	createStandardPIValveSS();
}

// Reposition lv4 menu for Main Page
function setLv4ValveFlyingMainPagePosition()
{
	for (i = 0; i < lv4ValvesIDOfMainPage.length; i++)
	{
		var vision = document.getElementById(lv4ValvesIDOfMainPage[i]);
		if (i < 1)
			vision.style.top = lv3FlyingTop[2];
		else
		{
			if (iSiteLang == 1)
				vision.style.top = lv3FlyingTop[2] + (26*i) + 14;
			else
			{
				if (i < 3)
					vision.style.top = lv3FlyingTop[2] + (26*i) + (14*i);
				else
					vision.style.top = lv3FlyingTop[2] + (26*i) + (14*3);
			}
		}
			
		if (iSiteLang == 1)
			vision.style.left = lv3FlyingLeft + 149 + valveMenuLeftAjust;
		else
			vision.style.left = lv3FlyingLeft + 155 + valveMenuLeftAjust;
			
		vision.style.borderColor = "f2d900";
		
		if (i == lv4ValvesIDOfMainPage.length - 1) //last element
			vision.style.width = 130;
	}
}

// IDs create for 2Way and 3Way lv5 flying menus
function createValveLv5IdArray(prefix, total)
{
	if(total == 2)
		return new Array(prefix+"N", prefix+"F");
	else if(total == 3)
		return new Array(prefix+"N", prefix+"D", prefix+"S");
}

// When mouse over valves' 2 Way or 3 Way buttons
//In Main Page
function lv4MainFlyingOver(idName)
{
	hideAllLv5ValveMainFlyings();
	var lv5Menu = document.getElementById(idName + "5");
	if(lv5Menu)
	{
		document.getElementById(idName.substring(0, idName.length-4)).style.borderRightWidth = "0px";
		document.getElementById(idName+"5").style.visibility = "visible";
	}
	document.getElementById(idName).style.backgroundColor = lv4FlyingOverColor;
}
function lv4MainFlyingOut(idName)
{	
	var lv5Menu = document.getElementById(idName + "5");
	if(lv5Menu)
	{
		document.getElementById(idName.substring(0, idName.length-4)).style.borderRightWidth = "1px";
		document.getElementById(idName+"5").style.visibility = "hidden";
	}
	document.getElementById(idName).style.backgroundColor = lv4FlyingOutColor;
}

//In Valves Subpage
function lv4SubFlyingOver(idName)
{
	var lv5Menu = document.getElementById(idName+"5");
	if(lv5Menu)
	{
		document.getElementById(idName.substring(0, idName.length-4)).style.borderRightWidth = "0px";
		document.getElementById(idName+"5").style.visibility = "visible";
	}
	document.getElementById(idName).style.background = lv2FlyingOverColor;
}
function lv4SubFlyingOut(idName)
{
	var lv5Menu = document.getElementById(idName+"5");
	if(lv5Menu)
	{
		document.getElementById(idName.substring(0, idName.length-4)).style.borderRightWidth = "1px";
		document.getElementById(idName+"5").style.visibility = "hidden";
	}
	document.getElementById(idName).style.background = lv2FlyingOutColor;
}

// Event execute on valves selection: change <DIV> color and show lv4 flying menus
function lv3ValveFlyingOver(idName)
{
	//hideLv4ValveMainFlyings();
	document.getElementById(idName).style.background = lv3FlyingOverColor;
	if (document.getElementById(idName + "lv4"))
		document.getElementById(idName + "lv4").style.visibility = "visible";
}
function lv3ValveFlyingOut(idName)
{
	document.getElementById(idName).style.background = lv3FlyingOutColor;
	if (document.getElementById(idName + "lv4"))
		document.getElementById(idName + "lv4").style.visibility = "hidden";
}

// Lv4 menu action for valves
function lv4ValveTableOver(idName)
{
	var theMenu = leftMenu[2] + idName.substring(0, idName.length-3);
	linkValveOver(leftMenu[2], theMenu)
}
function lv4ValveTableOut(idName)
{	
	var theMenu = leftMenu[2] + idName.substring(0, idName.length-3);
	linkValveOut(leftMenu[2], theMenu)
}

function lv4MainTableOver(idName)
{
	document.getElementById(idName).style.visibility = "visible";
	lv3TableOver(leftMenu[2]);
	lv3ValveFlyingOver(idName.substring(0, idName.length - 3));
}
function lv4MainTableOut(idName)
{	
	document.getElementById(idName).style.visibility = "hidden";
	lv3TableOut(leftMenu[2]);
	lv3ValveFlyingOut(idName.substring(0, idName.length - 3));
}

// Functions for Valves Flyings menus in Valves Page

//Reposition Valves for left menu
function setLv4ValveFlyingValvesMenuPosition()
{
	for(i=0; i<lv4ValvesIDOfValvePage.length; i++)
	{
		var vision = document.getElementById(lv4ValvesIDOfValvePage[i]);
		if(i == 0)
			vision.style.top = 223 - 36;
		else
			vision.style.top = (76*i) + 222 - 36;
		vision.style.left = 184; //Right next to left picture menu: 188
		vision.style.borderColor = "#ff2222";
		vision.style.width = "170";
		vision.style.zIndex = 10;
	}
}

function setLv5ValveFlyingValvesMenuPosition()
{
	var leftPosition = 184 + 170 - 1;
	var topPosition = 222 - 36;
/*
	var cpbv = document.getElementById("cpbvSub2way5");
	cpbv.style.left = leftPosition;
	cpbv.style.top = topPosition + 1;
	cpbv.style.borderColor = "#ff2222";
	
	var fpbv = document.getElementById("fpbvSub2way5");
	fpbv.style.left = leftPosition;
	fpbv.style.top = topPosition + 76;
	fpbv.style.borderColor = "#ff2222";
*/	
	var globe2 = document.getElementById("globeSub2way5");
	globe2.style.left = leftPosition;
	globe2.style.top = topPosition + 76 * 3;
	globe2.style.borderColor = "#ff2222";
	
	var globe3 = document.getElementById("globeSub3way5");
	globe3.style.left = leftPosition;
	globe3.style.top = topPosition + 76 * 3 + 26;
	globe3.style.borderColor = "#ff2222";
}

function setLv5ValveFlyingMainMenuPosition()
{
	var leftPosition = 188 + 170;
	if (iSiteLang == 1)
		leftPosition += 188;
	else
		leftPosition += 221;
	
	
	var topPosition = lv3FlyingTop[2];
/*
	var cpbv = document.getElementById("cpbvlv42way5");
	cpbv.style.left = leftPosition;
	cpbv.style.top = topPosition;
	
	var fpbv = document.getElementById("fpbvlv42way5");
	fpbv.style.left = leftPosition;
	fpbv.style.top = topPosition + 40;
*/
	var globe2 = document.getElementById("globelv42way5");
	globe2.style.left = leftPosition;
	if (iSiteLang == 1)
		globe2.style.top = topPosition + 40 * 3 - 28;
	else
		globe2.style.top = topPosition + 40 * 3;
	
	var globe3 = document.getElementById("globelv43way5");
	globe3.style.left = leftPosition;
	if (iSiteLang == 1)
		globe3.style.top = topPosition + 40 * 3 - 2;
	else
		globe3.style.top = topPosition + 40 * 3 + 26;
}

// Mouse Actions on Valves' left menu, show extend menu: 2way 3way
function linkValveOver(leftId, theMenu)
{
	linkOver(leftId, theMenu);
	var idName = theMenu.substring(leftMenu[2].length, theMenu.length) + "Sub";
	document.getElementById(idName).style.visibility = "visible";
}
function linkValveOut(leftId, theMenu)
{
	linkOut(leftId, theMenu);
	var idName = theMenu.substring(leftMenu[2].length, theMenu.length) + "Sub";
	document.getElementById(idName).style.visibility = "hidden";
}

function createLv5Flying(keyId, optionId, optionName, subOrMain)
{
	if (subOrMain == "mainPage")
		document.write('<TABLE ID="' + keyId + '" CLASS="lv3flying" CELLPADDING="1" onMouseOver=lv5MainTableOverWithTimer("' + keyId + '")  onMouseLeave=lv5MainTableOutWithTimer("' + keyId + '")>');
	else
		document.write('<TABLE ID="' + keyId + '" CLASS="lv3flying" CELLPADDING="1" onMouseOver=lv5SubTableOverWithTimer("' + keyId + '")  onMouseLeave=lv5SubTableOutWithTimer("' + keyId + '")>');		
	var menuSize = optionId.length;
	for (i=0; i<menuSize; i++)
	{
		document.write('<TR>');
		if (subOrMain == "mainPage")
			document.write('<TD onMouseOver=lv5ValveFlyingOverWithTimer("'+optionId[i]+'") onMouseOut=lv5ValveFlyingOutWithTimer("'+optionId[i]+'")>');
		else if (subOrMain == "valvePage")
			document.write('<TD onMouseOver=lv3SubValveFlyingOverWithTimer("'+optionId[i]+'") onMouseOut=lv3SubValveFlyingOutWithTimer("'+optionId[i]+'")>');
		var vType = optionId[i].substring(0, optionId[i].length - 8);
		var vWay = optionId[i].substring(vType.length + 3, optionId[i].length - 4);
		var vUnion = optionId[i].substring(optionId[i].length - 1, optionId[i].length);
		document.write('<A HREF="centerpage/' + leftMenu[2] + '/ASPX/' + leftMenu[2] + 'DetailsTable.aspx?type=' + vType + '&way=' + vWay + '&valveunion=' + vUnion +'" TARGET="insideFrame" onClick=lv5SubFlyingClick("' + keyId + '");>');
		if (subOrMain == "mainPage")
			document.write('<DIV ID="' + optionId[i] + '" CLASS="lv5Valveflying">' + optionName[i] + '</DIV>');
		else
			document.write('<DIV ID="' + optionId[i] + '" CLASS="lv3flying">' + optionName[i] + '</DIV>');
		document.write('</A>');
		document.write('</TD>');
		document.write('</TR>');
	}
	document.write('</TABLE>');
}

// Mouse event when cursor on lv5 flying on main page
function lv5MainTableOver(idName)
{
	document.getElementById(idName.substring(0, idName.length-5)).style.borderRightWidth = "0px";
	lv4MainTableOver(idName.substring(0, idName.length - 5));
	lv4MainFlyingOver(idName.substring(0, idName.length - 1));	
}
function lv5MainTableOut(idName)
{
	document.getElementById(idName.substring(0, idName.length-5)).style.borderRightWidth = "1px";
	lv4MainTableOut(idName.substring(0, idName.length - 5));
	lv4MainFlyingOut(idName.substring(0, idName.length - 1));		
}

function lv5SubTableOver(idName)
{
	var parentId = idName.substring(0, idName.length-1);
	lv4SubFlyingOver(parentId);
	document.getElementById(idName.substring(0, idName.length-5)).style.visibility = "visible";
	document.getElementById(idName.substring(0, idName.length-5)).style.borderRightWidth = "0px";
}
function lv5SubTableOut(idName)
{
	var parentId = idName.substring(0, idName.length-1);
	lv4SubFlyingOut(parentId);
	document.getElementById(idName.substring(0, idName.length-5)).style.visibility = "hidden";
	document.getElementById(idName.substring(0, idName.length-5)).style.borderRightWidth = "1px";
}
function lv5SubFlyingClick(keyId)
{
	productLeftMenuUp(leftMenu[2]);
	lv5SubTableOut(keyId);
}

function createLv2ValveFlying(keyId, optionId, optionName, topOrLeft)
{
	if (topOrLeft == "mainPage")
		document.write('<TABLE ID="' + keyId + '" CLASS="lv4flying" CELLPADDING="1" onMouseOver=lv4MainTableOverWithTimer("' + keyId + '") onMouseOut=lv4MainTableOutWithTimer("' + keyId + '")>');
	else
		document.write('<TABLE ID="' + keyId + '" CLASS="leftflying" CELLPADDING="1" onMouseOver=lv4ValveTableOverWithTimer("' + keyId + '") onMouseLeave=lv4ValveTableOutWithTimer("' + keyId + '")>');
	
	var menuSize = optionId.length;
	for (i = 0; i < menuSize; i++)
	{
		document.write('<TR>');
		if (topOrLeft == "mainPage")
		{
			document.write('<TD onMouseOver=lv4MainFlyingOverWithTimer("' + optionId[i] + '") onMouseOut=lv4MainFlyingOutWithTimer("'+optionId[i]+'");>');
			document.write('<DIV ID="'+optionId[i]+'" CLASS="lv4flying" onMouseOver=valveLv2Over("' + optionId[i] + '"); onMouseOut=valveLv2Out("' + optionId[i] + '"); onClick=valveLv2Click("' + optionId[i] + '");>');
		}
		else
		{
			document.write('<TD onMouseOver=lv4SubFlyingOverWithTimer("' + optionId[i] + '") onMouseOut=lv4SubFlyingOutWithTimer("'+optionId[i]+'");>');
			document.write('<DIV ID="'+optionId[i]+'" CLASS="flying" onMouseOver=valveLv2Over("' + optionId[i] + '"); onMouseOut=valveLv2Out("' + optionId[i] + '"); onClick=valveLv2Click("' + optionId[i] + '");>');
		}
		document.write(optionName[i]);
		document.write('</DIV>');
		document.write('</TD>');
		document.write('</TR>');
	}
	document.write('</TABLE>');
}

function createLv2ValvePressureFlying(keyId, optionId, optionName, optionPDF, topOrLeft)
{
	if (topOrLeft == "mainPage")
		document.write('<TABLE ID="' + keyId + '" CLASS="lv4flying" CELLPADDING="1" onMouseOver=lv4MainTableOverWithTimer("' + keyId + '") onMouseOut=lv4MainTableOutWithTimer("' + keyId + '")>');
	else
		document.write('<TABLE ID="' + keyId + '" CLASS="leftflying" CELLPADDING="1" onMouseOver=lv4ValveTableOverWithTimer("' + keyId + '") onMouseLeave=lv4ValveTableOutWithTimer("' + keyId + '")>');
	
	var menuSize = optionId.length;
	for (i = 0; i < menuSize; i++)
	{
		document.write('<TR>');
		if (topOrLeft == "mainPage")
		{
			document.write('<TD onMouseOver=lv4MainFlyingOverWithTimer("' + optionId[i] + '") onMouseOut=lv4MainFlyingOutWithTimer("'+optionId[i]+'");>');
			document.write('<DIV ID="'+optionId[i]+'" CLASS="lv4flying">');
		}
		else
		{
			document.write('<TD onMouseOver=lv4SubFlyingOverWithTimer("' + optionId[i] + '") onMouseOut=lv4SubFlyingOutWithTimer("' + optionId[i] + '");>');
			document.write('<DIV ID="' + optionId[i] + '" CLASS="flying">');
		}
		if (i < menuSize - 1) //PDF
			document.write('<A HREF="CenterPage/' + leftMenu[2] + '/PDF/' + sSiteLang + '/' + optionPDF[i] + '" TARGET="_blank">');
		else //Selection Software for Independant Pressure
			document.write('<A HREF="CenterPage/' + leftMenu[2] + '/ASPX/' + optionPDF[i] + '" TARGET="insideFrame">');
		document.write(optionName[i]);
		document.write('</A>');
		document.write('</DIV>');
		document.write('</TD>');
		document.write('</TR>');
	}
	document.write('</TABLE>');
}

function valveLv2Over(idName)
{
	if(document.getElementById(idName + "5"))
	{
		document.getElementById(idName).style.cursor = "default";
		window.status = "Done";
	}
	else
	{
		var vType = idName.substring(0, idName.length - 7);
		var vWay = idName.substring(vType.length + 3, idName.length - 3);
		if ((vType == "cpbv" || vType == "fpbv") && vWay == "2")
			var linkPath = '../centerpage/' + leftMenu[2] + '/ASPX/' + leftMenu[2] + 'DetailsTable.aspx?type=' + vType + '&way=' + vWay + '&valveunion=N';
		else
			var linkPath = '../centerpage/' + leftMenu[2] + '/ASPX/' + leftMenu[2] + 'DetailsTable.aspx?type=' + vType + '&way=' + vWay;
		document.getElementById(idName).style.cursor = "pointer";
		window.status = linkPath;
	}
}
function valveLv2Out(idName)
{
	document.getElementById(idName).style.cursor = "default";
	window.status = "Done";
}
function valveLv2Click(idName)
{
	window.status = "Done";
	if(!document.getElementById(idName + "5"))
	{
		lv5SubFlyingClick(idName + "X");
		var vType = idName.substring(0, idName.length - 7);
		var vWay = idName.substring(vType.length + 3, idName.length - 3);
		if ((vType == "cpbv" || vType == "fpbv") && vWay == "2")		
			var linkPath = 'centerpage/' + leftMenu[2] + '/ASPX/' + leftMenu[2] + 'DetailsTable.aspx?type=' + vType + '&way=' + vWay + '&valveunion=N';
		else
			var linkPath = 'centerpage/' + leftMenu[2] + '/ASPX/' + leftMenu[2] + 'DetailsTable.aspx?type=' + vType + '&way=' + vWay;
		this.insideFrame.location.href = linkPath;
	}
}

// Mouse event when cursor on lv 5 valve menus on main page
function lv5ValveFlyingOver(idName)
{
	document.getElementById(idName).style.backgroundColor = lv5FlyingOverColor;
}
function lv5ValveFlyingOut(idName)
{
	document.getElementById(idName).style.backgroundColor = lv5FlyingOutColor;
}

// Valve Selection Software - Standard/Pressure Independant
function standardPIValveSS()
{
	var keyId = leftMenu[2];
	var optionId = new Array("standardValveSS", "PIValveSS");
	var optionName = new Array(MSG10319, MSG10318);
	var optionLink = new Array("ValvesSelect.aspx", "ValvesPressureSelect.aspx");

	document.write('<TABLE ID="' + keyId + 'SS" CLASS="lv3flying" CELLPADDING="1" onMouseOver=lv3SSTableOverWithTimer("' + keyId + '") onMouseLeave=lv3SSTableOutWithTimer2("' + keyId + '")>');
		
	var menuSize = optionId.length;
	for (i = 0; i < menuSize; i++)
	{
		document.write('<TR>');
		document.write('<TD onMouseOver=lv3FlyingOverWithTimer("' + optionId[i] + '") onMouseOut=lv3FlyingOutWithTimer("' + optionId[i] + '")>');
		document.write('<A HREF="CenterPage/' + keyId + '/ASPX/' + optionLink[i] + '" TARGET="insideFrame" onClick="hideSSMenu()">');
		document.write('<DIV ID="' + optionId[i] + '" CLASS="lv3flying">' + optionName[i] + '</DIV>');
		document.write('</A>');
		document.write('</TD>');
		document.write('</TR>');
	}
	document.write('</TABLE>');
}

/* lv3TableOver and lv3TableOut are the combination of cataFlyingOver and leftFlyingMenuOver, or cataFlyingOut and lfetFlyingMenuOut. */
function lv3SSTableOver(idName)
{
	//Hide Virtual Catalog
	lv3TableOut(leftMenu[2]);
	ssFlyingOver(idName);
	leftFlyingMenuOver(idName);
	
	//Keep highlighting parent's flying colomun
	flyingOver(idName + lv2Postfix[1]);
}
function lv3SSTableOut(idName)
{
	ssFlyingOut(idName);
	leftFlyingMenuOut(idName);
	
	//Keep highlighting parent's flying colomun
	flyingOut(idName + lv2Postfix[1]);
}

function cataValveFlyingOver(theMenu)
{
	lv3SSTableOut(leftMenu[2]);
	cataFlyingOver(theMenu);
}

function ssFlyingOver(idName)
{
	var vision2 = document.getElementById(idName);
	vision2.style.borderRightWidth = "0px";
	var vision = document.getElementById(idName + "SS");
	vision.style.visibility = "visible";
}
function ssFlyingOut(idName)
{
	var vision2 = document.getElementById(idName);
	vision2.style.borderRightWidth = "1px";
	var vision = document.getElementById(idName + "SS");
	vision.style.visibility = "hidden";
}

function createStandardPIValveSS()
{
	var SSKey = "SS"
	standardPIValveSS();
	document.getElementById(leftMenu[2] + SSKey).style.top = 448;
	if (iSiteLang == 1)
		document.getElementById(leftMenu[2] + SSKey).style.left = 318;
	else
		document.getElementById(leftMenu[2] + SSKey).style.left = 345;
}

//When mouse over Selection Software of lv2 flying, remove lv3 Virtual Catalog
function lv2SSFlyingOver(theMenu)
{
	flyingOver(theMenu);
	//Lv 3 flying for Catalog's ID
	var virtualCatalogID = theMenu.substring(0,theMenu.length - lv2Postfix[1].length);
	//Remove Virtual Catalog Table
	lv3TableOut(virtualCatalogID);
	hideLv4ValveMainFlyings();
}