/* Hide and seek */

//Hide all left catalogue menus
function hideAllLeftMenus()
{
	for(i = 0; i < leftMenu.length; i++)
	{
		var vision = document.getElementById(leftMenu[i]+"Clip");		
		vision.style.top = productLeftMenuTopPosition; //In fullscreenselection						
		//vision.style.visibility = "hidden";
		vision.style.display = "none";
		if(document.getElementById(leftMenu[i]+"productline"))
			document.getElementById(leftMenu[i]+"productline").style.visibility = "hidden";
	}
}

//Hide all left flying menus
function hideAllLeftFlyings()
{
	for(i = 0; i < leftMenu.length; i++)
	{
		document.getElementById(leftMenu[i]).style.visibility = "hidden";
		document.getElementById(leftMenu[i] + lv2Postfix[0] + "Lv3").style.visibility = "hidden";
	}
}


//Initialize top menu
function inilializeTopLabels()
{
	for (l = 0; l < topMenu.length; l++)
		topOut(topMenu[l]);
}
//Hide all top flying menus
function hideAllTopFlyings()
{
	for(i = 0; i < topMenu.length; i++)
		document.getElementById(topMenu[i]).style.visibility = "hidden";
}

//Hide hourglass when finishing loading
function hideHourglass()
{
	document.getElementById("Hourglass").style.visibility = "hidden";
}

//Initialize Background Picture for Left Menu
function initializeAllLeftMenus()
{
	for(i = 0; i < leftMenu.length; i++)
	{
		var source = "Index/Images/" + sSiteLang + "/LeftMenu/MainPage/" + leftMenu[i] + ".gif";
		var idName = leftMenu[i]
		document.images[idName].src = source;
	}
}

function hideAllLv5ValveMainFlyings()
{
	/*document.getElementById("cpbvlv42way").style.backgroundColor = lv4FlyingOutColor;
	document.getElementById("fpbvlv42way").style.backgroundColor = lv4FlyingOutColor;
	document.getElementById("globelv42way").style.backgroundColor = lv4FlyingOutColor;
	document.getElementById("globelv43way").style.backgroundColor = lv4FlyingOutColor;*/

	//Modification: in order to trim out the "Double Union" valves from the results.
	//document.getElementById("cpbvlv42way5").style.visibility = "hidden";
	//document.getElementById("fpbvlv42way5").style.visibility = "hidden";
	
	document.getElementById("globelv42way5").style.visibility = "hidden";
	document.getElementById("globelv43way5").style.visibility = "hidden";
}

function hideAllMainPageWithoutInitializeLastFlying()
{
	inilializeTopLabels();
	hideAllTopFlyings();

	initializeAllLeftMenus();
	hideAllLeftFlyings();
	
	hideLv4ValveMainFlyings();
	hideAllLv5ValveMainFlyings();
	
	hideSSMenu();
}

function hideAllMainPage()
{
	hideAllMainPageWithoutInitializeLastFlying();
	lastFlyingObj = null;
	lastFlyingColor = null;
	
	//leftMenu.length - 1 exception for Controls which does not have Virtual Catalog
	for (k = 0; k < leftMenu.length - 1; k++)
	{
		flyingOut(leftMenu[k] + lv2Postfix[0]);
		flyingOut(leftMenu[k] + lv2Postfix[1]);
	}
}

//Valve: Standard and Pressure Independant
function hideSSMenu()
{
	var SSKey = "SS"
	document.getElementById(leftMenu[2] + SSKey).style.visibility = "hidden";
}

function hideLv4ValveMainFlyings()
{
	/*document.getElementById("cpbv").style.background = lv3FlyingOutColor;
	document.getElementById("fpbv").style.background = lv3FlyingOutColor;
	document.getElementById("ibv").style.background = lv3FlyingOutColor;
	document.getElementById("globe").style.background = lv3FlyingOutColor;
	document.getElementById("butterfly").style.background = lv3FlyingOutColor;
	document.getElementById("pressureind").style.background = lv3FlyingOutColor;*/
	
	document.getElementById("cpbvlv4").style.visibility = "hidden";
	document.getElementById("fpbvlv4").style.visibility = "hidden";
	document.getElementById("ibvlv4").style.visibility = "hidden";
	document.getElementById("globelv4").style.visibility = "hidden";
	document.getElementById("butterflylv4").style.visibility = "hidden";
	document.getElementById("pressureindlv4").style.visibility = "hidden";
}

/* Valve Subpage */
function hideLv4SubValveFlyings()
{
	lv5SubTableOut("cpbvSub2way5");
	lv5SubTableOut("fpbvSub2way5");
	lv5SubTableOut("globeSub2way5");
	lv5SubTableOut("globeSub3way5");
}

function hideLv4ValveSubpage()
{
	lv4ValveTableOut("cpbvSub");
	lv4ValveTableOut("fpbvSub");
	lv4ValveTableOut("ibvSub");
	lv4ValveTableOut("globeSub");
	lv4ValveTableOut("butterflySub");
	lv4ValveTableOut("pressureindSub");
}

function hideAllValvPage()
{
	inilializeTopLabels();
	hideAllTopFlyings();
	
	hideLv4ValveSubpage(); //Lv4
	hideLv4SubValveFlyings(); //Lv5
	lastFlyingObj = null;
	lastFlyingColor = null;
}

/* Humi Subpage */
function hideAllLv4HumiTable()
{
	lv4HumiTableOut("SK300Sub");
	lv4HumiTableOut("SKRSub");
	lv4HumiTableOut("SKG3000Sub");
	lv4HumiTableOut("SKSSub");
	lv4HumiTableOut("JetSpraySub");
	lv4HumiTableOut("HumEvapSub");
	lv4HumiTableOut("SteamdSub");
	lv4HumiTableOut("ControlsHSub");
}

function hideAllLv5HumiTable()
{	
	humiSubTableOut("SK300SubAcc5");
	humiSubTableOut("SKRSubIns5");
	humiSubTableOut("SKRSubCon5");
	humiSubTableOut("SteamdSubMul5");
}

function hideAllHumiPage()
{
	inilializeTopLabels();
	hideAllTopFlyings();

	hideAllLv5HumiTable();
	hideAllLv4HumiTable();
	lastFlyingObj = null;
	lastFlyingColor = null;
}

//Initislize the background color of all columns of the level 3 flying menus in the main page
function setLv3BgColorMainPage()
{
	var allLeftMenu = new Array(humiCataId, actuCataId, valvCataId, heatCataId);
	for (i = 0; i < allLeftMenu.length; i++)
		for (j = 0; j < allLeftMenu[i].length; j++)
			document.getElementById(allLeftMenu[i][j]).style.backgroundColor = lv3FlyingOutColor;		

	document.getElementById("standardValveSS").style.backgroundColor = lv3FlyingOutColor;
	document.getElementById("PIValveSS").style.backgroundColor = lv3FlyingOutColor;
}
//For lv4 Valve flying menu's columns in Main Page
function setLv4BgColorMainPage()
{
	var allValveLv4Flying = new Array(cpvbArray, fpbvArray, ibvArray, globeArray, butterflyArray, pressureArray);
	for (i = 0; i < allValveLv4Flying.length; i++)
		for (j = 0; j < allValveLv4Flying[i].length; j++)
			document.getElementById(allValveLv4Flying[i][j]).style.backgroundColor = lv4FlyingOutColor;			
	setLv5BgColorMainPage();
}
//For lv5 Valve flying menu's columns in Main Page
function setLv5BgColorMainPage()
{
	//Modification: in order to trim out the "Double Union" valves from the results.
	//var allValveLv5Flying = new Array(mainpageLv5IdArray1, mainpageLv5IdArray2, mainpageLv5IdArray3, mainpageLv5IdArray4);
	var allValveLv5Flying = new Array(mainpageLv5IdArray3, mainpageLv5IdArray4);
	for (i = 0; i < allValveLv5Flying.length; i++)
		for (j = 0; j < allValveLv5Flying[i].length; j++)
			document.getElementById(allValveLv5Flying[i][j]).style.backgroundColor = lv5FlyingOutColor;			
}

//For lv2 Humni flying menu's columns in Sub Page
function setLv2BgColorHumiPage()
{
	var allHumiLv2Flying = new Array(SK300SubIDArray, SKRSubIDArray, SKG3000SubIDArray, SKSSubIDArray, JetSpraySubIDArray, HumEvapSubIDArray, SteamdSubIDArray, ControlsHSubIDArray);
	for (i = 0; i < allHumiLv2Flying.length; i++)
		for (j = 0; j < allHumiLv2Flying[i].length; j++)
			document.getElementById(allHumiLv2Flying[i][j]).style.backgroundColor = lv2FlyingOutColor;
	//setLv3BgColorhumiPage();
}
//For lv3 Humni flying menu's columns in Sub Page
function setLv3BgColorHumiPage()
{
	var allHumiLv3Flying = new Array(SK300AccSubIDArray, SKRInstallSubIDArray, SKRConSubIDArray, SteamdMultiSubIDArray);
	for (i = 0; i < allHumiLv3Flying.length; i++)
		for (j = 0; j < allHumiLv3Flying[i].length; j++)
			document.getElementById(allHumiLv3Flying[i][j]).style.backgroundColor = lv3FlyingOutColor;
}

//For lv2 Humni flying menu's columns in Sub Page
function setLv2BgColorValvPage()
{
	var allValvLv2Flying = new Array(cpvbSubArray, fpbvSubArray, ibvSubArray, globeSubArray, butterflySubArray, pressureSubArray);
	for (i = 0; i < allValvLv2Flying.length; i++)
		for (j = 0; j < allValvLv2Flying[i].length; j++)
			document.getElementById(allValvLv2Flying[i][j]).style.backgroundColor = lv2FlyingOutColor;
	//setLv3BgColorhumiPage();
}
//For lv3 Humni flying menu's columns in Sub Page
function setLv3BgColorValvPage()
{
	//Modification: in order to trim out the "Double Union" valves from the results.
	//var allValvLv3Flying = new Array(subpageLv5IdArray1, subpageLv5IdArray2, subpageLv5IdArray3, subpageLv5IdArray4);
	var allValvLv3Flying = new Array(subpageLv5IdArray3, subpageLv5IdArray4);
	for (i = 0; i < allValvLv3Flying.length; i++)
		for (j = 0; j < allValvLv3Flying[i].length; j++)
			document.getElementById(allValvLv3Flying[i][j]).style.backgroundColor = lv3FlyingOutColor;
}