/*
This file contains varriables and functions to control product-pictures' left menus events.
*/

var leftMainMenuObj = document.getElementById("mainleftmenu");
var mainLeftMenuInitialTopPosition = 160;
var currentLeftMenuTopPosition;
var mainLeftMenuLeftPosition = 23;
var mainLeftMenuTimer = 10;
var mainLeftMenuOffset = 20;
var imageHeight = 120;
var heightOfAdditional = 68;
var topPoint = -500;//mainLeftMenuInitialTopPosition - (leftMenu.length * imageHeight) - heightOfAdditional - 100;

//Hide main left menu
function mainLeftMenuUp(idName)
{
	leftMenuOut(idName);
	leftMainMenuObj = document.getElementById("mainleftmenu");
	currentLeftMenuTopPosition = mainLeftMenuInitialTopPosition;
	hideAllLeftMenus();
	document.getElementById(idName+"Clip").style.display = "inline";
	setProductLink();
	leftMenuMoveUp();
	setInsideFrameToHalfScreen();
	hideAllLeftFlyings();
}
function mainLeftMenuUpFromSubpage(idName)
{
	mainLeftMenuUpFromSubpageResized(idName, defaultInsideFrameHeight);
}

function mainLeftMenuUpFromSubpageResized(idName, insideFrameHeight)
{
	leftMainMenuObj = document.getElementById("mainleftmenu");
	currentLeftMenuTopPosition = mainLeftMenuInitialTopPosition;
	hideAllLeftMenus();
	hideAllLeftFlyings();
	if (document.getElementById(idName + "Clip") != null)
	{
		document.getElementById(idName + "Clip").style.display = "inline";
		setInsideFrameToHalfScreen();
	}
	else
		enlargeInsideFrame();
	leftMainMenuObj.style.top = topPoint;
	setProductLink();
	setInsideFrameHeight(insideFrameHeight);
}

//Move initial leftmenu up when click on each "Virtual Catalogue"
function leftMenuMoveUp()
{
	leftmenusLock = ON;
	leftMainMenuObj = document.getElementById("mainleftmenu");
	if (currentLeftMenuTopPosition > topPoint)
	{
		currentLeftMenuTopPosition -= mainLeftMenuOffset;
		leftMainMenuObj.style.top = currentLeftMenuTopPosition;
		setTimeout("leftMenuMoveUp()", mainLeftMenuTimer);
	}
	else
	{
		leftMainMenuObj.style.top = topPoint;
		//leftMainMenuObj.style.zIndex = 5;
		//leftMainMenuObj.style.visibility = "visible";
	}
}
/* Move initial left menu down when click on "Neptronic Product Line" */
//With LeftMainMenu top position initialtion
function prepairMainLeftnuBeforeMoveDown()
{
	hideAllLeftFlyings();
	leftMainMenuObj = document.getElementById("mainleftmenu");
	leftMainMenuObj.style.top = topPoint;
	leftMainMenuObj.style.visibility = "visible";
	leftMainMenuObj.style.zIndex = 5;
}

function leftMenuMoveDownReposition()
{
	prepairMainLeftnuBeforeMoveDown()
	leftMenuMoveDown();
	insideFrame.location.href = "centerpage/" + sSiteLang + "/home1.htm";
	setLv4ValveFlyingMainPagePosition();
}
function leftMenuMoveDownFromSubpage()
{
	leftMenuMoveDownFromSubpageResized(defaultInsideFrameHeight);
}
function leftMenuMoveDownFromSubpageResized(insideFrameHeight)
{
	leftMainMenuObj = document.getElementById("mainleftmenu");
	leftMainMenuObj.style.top = mainLeftMenuInitialTopPosition;
	hideAllLeftMenus(leftMenu);
	setInsideFrameToHalfScreen();
	removeProductLink();
	setInsideFrameHeight(insideFrameHeight);
	setLv4ValveFlyingMainPagePosition();
	leftmenusLock = OFF;
}
//Without LeftMainMenu top position initialization
function leftMenuMoveDown()
{
	if(currentLeftMenuTopPosition < mainLeftMenuInitialTopPosition)
	{
		currentLeftMenuTopPosition += mainLeftMenuOffset;
		leftMainMenuObj.style.top = currentLeftMenuTopPosition;
		setTimeout("leftMenuMoveDown()", mainLeftMenuTimer);
	}
	else
	{
		leftMainMenuObj.style.top = mainLeftMenuInitialTopPosition;
		hideAllLeftMenus(leftMenu);
		setInsideFrameToHalfScreen();
		removeProductLink();
		setInsideFrameHeight(defaultInsideFrameHeight);
		leftmenusLock = OFF;
	}
}

//Set image "Neptronic Product Line" as a link or remove the link
function setProductLink()
{
	document.getElementById("productLineLabel").style.visibility = "hidden";
	document.getElementById("productLineButton").style.visibility = "visible";
}
function removeProductLink()
{
	document.getElementById("productLineButton").style.visibility = "hidden";
	document.getElementById("productLineLabel").style.visibility = "visible";
}
function setProductLinkOver()
{
	document.getElementById("productLineButton").style.visibility = "visible";
}
function setProductLinkOut()
{
	document.getElementById("productLineButton").style.visibility = "hidden";
}

//Change image when mouse over or mouse out catalogue's picture
function linkOver(folder, idName)
{
	document.getElementById(idName).setAttribute("background", "Index/Images/" + sSiteLang + "/LeftMenu/" + folder + "/" + idName + "Over.gif");
}
function linkOut(folder, idName)
{
	document.getElementById(idName).setAttribute("background", "Index/Images/" + sSiteLang + "/Leftmenu/" + folder + "/" + idName + ".gif");
}

//Chage image when mouse over puduct link
function productOver(idName)
{
	var source = "Index/Images/" + sSiteLang + "/ProductLineOver.gif"
	document.images[idName].src = source;
}
function productOut(idName)
{
	var source = "Index/Images/" + sSiteLang + "/ProductLine.gif"
	document.images[idName].src = source;
}
function productLineOver(idName)
{
	var source = "Index/Images/" + sSiteLang + "/Leftmenu/" + idName + "/"+idName+"ProductLineOver.gif";
	document.images[idName + "productline"].src = source;
}
function productLineOut(idName)
{
	var source = "Index/Images/" + sSiteLang + "/LeftMenu/" + idName + "/"+idName+"ProductLine.gif";
	document.images[idName + "productline"].src = source;
}
