var productTopPointHiddenPosition = topPoint * 2;
var productLeftMenuTopPosition = 152;
var currentLeftMenuObj;
//var fullScreenAjust = 0;
var fullScreenAjust = 29;
var iFrameWidthHalfScreen = 560 + fullScreenAjust;
var iFrameWidthFullScreen = 747 + fullScreenAjust;
var defaultInsideFrameHeight = 1400;

function setProductLineVisibility(idName, vision)
{
	document.getElementById(idName+"productline").style.visibility = vision;
}

/* When Click on Software Selection */
function openSelection(idName)
{
	hideAllLeftFlyings();
	hideAllLeftMenus();
	currentLeftMenuObj = document.getElementById("mainleftmenu");
	currentLeftMenuTopPosition = mainLeftMenuInitialTopPosition;
	leftMenuMoveUp();
	setProductLink();
	setProductLineVisibility(idName.substring(0, idName.length-6), "visible");
	enlargeInsideFrame();
}

/* When Click on Sub Left Menu's buttons */
function productLeftMenuUp(idName)
{
	hideAllLeftFlyings();
	document.getElementById("mainleftmenu").style.top = topPoint;
	setProductLink();
	currentLeftMenuObj = document.getElementById(idName+"Clip");
	currentLeftMenuTopPosition = productLeftMenuTopPosition;
	currentLeftMenuObj.style.top = currentLeftMenuTopPosition;
	setProductLineVisibility(idName, "visible");
	productMoveUp();
	//setProductLineVisibility(idName, "visible");
}

/* Down left menu when loading a subpage (BACK button) */
function productLeftMenuUpFromSubpage(idName)
{
	document.getElementById("mainleftmenu").style.top = topPoint;
	setProductLink();
	currentLeftMenuObj = document.getElementById(idName+"Clip");
	currentLeftMenuObj.style.top = productTopPointHiddenPosition;
	//currentLeftMenuTopPosition = productLeftMenuTopPosition;
	hideAllLeftFlyings();
	enlargeInsideFrame();
	//productMoveUp();
	setProductLineVisibility(idName, "visible");
}
function productLeftMenuUpFromSubpageResized(idName, insideFrameHeight)
{
	document.getElementById("mainleftmenu").style.top = topPoint;
	setProductLink();
	currentLeftMenuObj = document.getElementById(idName+"Clip");
	currentLeftMenuObj.style.top = productTopPointHiddenPosition;
	//currentLeftMenuTopPosition = productLeftMenuTopPosition;
	hideAllLeftFlyings();
	enlargeInsideFrame();
	//productMoveUp();
	setProductLineVisibility(idName, "visible");
	setInsideFrameHeight(insideFrameHeight);
}

/*
Move up product left menu animation
*/
function productMoveUp()
{
	leftmenusLock = ON;
	if(currentLeftMenuTopPosition > productTopPointHiddenPosition)
	{
		currentLeftMenuTopPosition -= mainLeftMenuOffset*2;
		currentLeftMenuObj.style.top = currentLeftMenuTopPosition;
		setTimeout("productMoveUp()", mainLeftMenuTimer);
	}
	else
	{
		currentLeftMenuObj.style.top = productTopPointHiddenPosition;
		enlargeInsideFrame();
	}
}

/*
Down product left menu animation
*/
function productMoveDownLoop()
{
	if(currentLeftMenuTopPosition < productLeftMenuTopPosition)
	{
		currentLeftMenuTopPosition += mainLeftMenuOffset;
		currentLeftMenuObj.style.top = currentLeftMenuTopPosition;
		setTimeout("productMoveDownLoop()", mainLeftMenuTimer);
	}
	else
	{
		currentLeftMenuObj.style.top = productLeftMenuTopPosition;
		leftmenusLock = OFF;
	}
}

/*
Well...
*/
function productMenuMoveDown(idName)
{
	currentLeftMenuObj = document.getElementById(idName+"Clip");
	currentLeftMenuObj.style.visibility = "visible";
	currentLeftMenuObj.style.zIndex = 3;
	currentLeftMenuObj.style.top = productTopPointHiddenPosition;
	currentLeftMenuTopPosition = productTopPointHiddenPosition;
	setInsideFrameToHalfScreen();
	insideFrame.location.href = "centerpage/" + idName + "/HTML/" + sSiteLang + "/" + idName + lv2Postfix[0] + ".htm";
	document.getElementById(idName + "productline").style.visibility = "hidden";
    productMoveDownLoop();
    setInsideFrameHeight(defaultInsideFrameHeight);
    hideAllLeftFlyings();
}

/*
Remove virtual space and reduce iFrame's width
*/
function setInsideFrameToHalfScreen()
{
	document.getElementById('insideF').style.width = iFrameWidthHalfScreen;
	var vision = document.getElementById("virtualspace");
	vision.style.position = "relative";
	vision.style.visibility = "visible";
	hideAllLeftFlyings();
}

/*
Add virtual space and enlarge iFrame's width
*/
function enlargeInsideFrame()
{
	document.getElementById('insideF').style.width = iFrameWidthFullScreen;
	var vision = document.getElementById("virtualspace");
	vision.style.position = "absolute";
	vision.style.visibility = "hidden";
	hideAllLeftFlyings();
}

function setInsideFrameHeight(iHeight)
{
	document.getElementById('insideF').style.height=iHeight;
}
