var menuLevel2Height = 22;
var menuLeve31Height = 22;
var lastChildDivHeight;
var lastParentDivID;
var lastChildDivID;
//alert(document.getElementById("td.wpm_menu_level3").style.height);//wpm_menu_level3.style.height)

function ChangeHieght(ID, Sign, SubNum)
{
	try
	{
		var tempHeight = document.getElementById("div" + ID).style.height.substring(0, document.getElementById("div" + ID).style.height.length - 2);
		if(Sign == '+')
		{
			tempHeight = tempHeight * 1 + 1 * 1;
			document.getElementById("div" + ID).style.height = tempHeight + "px";
			if(tempHeight * 1 < menuLevel2Height * SubNum)
			{
				expandMove = window.setTimeout("ChangeHieght('" + ID + "', '+', " + SubNum + ");", 0.000000000000000000000000000000000001);
			}
			else
			{
				document.getElementById("div" + ID).style.display = "block";
				document.getElementById("img" + ID).src = "images/wpm_menu_negative.gif";
			}
		}
		else
		{
			tempHeight = tempHeight * 1 - 1 * 1;
			document.getElementById("div" + ID).style.height = tempHeight + "px";
			if(tempHeight * 1 > 0)
			{
				expandMove = window.setTimeout("ChangeHieght('" + ID + "', '-', " + SubNum + ");", 0.000000000000000000000000000000000001);
			}
			else
			{
				document.getElementById("div" + ID).style.display = "none";
				document.getElementById("img" + ID).src = "images/wpm_menu_positive.gif";
			}
		}
	}
	catch(ex)
	{
	}
}

function ExpandMenu(ID, SubNum)
{
	try
	{
		if(lastChildDivHeight != null && lastChildDivHeight != 0)
		{
			ExpandMenu2(lastChildDivID.substring(3), lastChildDivHeight / menuLevel2Height,  ID, SubNum)
			lastChildDivHeight = 0;
			ExpandMenu(ID, SubNum);
		}
		else
		{
			if(lastParentDivID != null && lastParentDivID != "div" + ID)
			{
				if (document.getElementById(lastParentDivID).style.display == "block")
				{
					ChangeHieght(lastParentDivID.substring(3), '-', SubNum);
				}
			}
			lastParentDivID = "div" + ID;

			if (document.getElementById("div" + ID).style.display == "block")
			{
				ChangeHieght(ID, '-', SubNum);
			}
			else
			{
				ChangeHieght(ID, '+', SubNum);
				document.getElementById("div" + ID).style.display = "block";
			}
		}
	}
	catch(ex)
	{
	}
}

function ChangeHieght2(ID, Sign, SubNum, parentID, SubParent)
{
	try
	{
		var tempHeight = document.getElementById("div" + ID).style.height.substring(0, document.getElementById("div" + ID).style.height.length - 2);
		var tempParentHeight = document.getElementById("div" + parentID).style.height.substring(0, document.getElementById("div" + parentID).style.height.length - 2);
		if(Sign == '+')
		{
			tempHeight = tempHeight * 1 + 1 * 1;
			tempParentHeight = tempParentHeight * 1 + 1 * 1
			document.getElementById("div" + ID).style.height = tempHeight + "px";
			document.getElementById("div" + parentID).style.height = tempParentHeight + "px";
			if(tempHeight * 1 < menuLeve31Height * SubNum)
			{
				expandMove2 = window.setTimeout("ChangeHieght2('" + ID + "', '+', " + SubNum + ", '" + parentID + "', '" + SubParent + "');", 0.000000000000000000000000000000000001);
			}
			else
			{
				document.getElementById("div" + ID).style.display = "block";
				document.getElementById("img" + ID).src = "images/wpm_menu_negative.gif";
			}
			lastChildDivHeight = tempHeight;
		}
		else
		{
			tempHeight = tempHeight * 1 - 1 * 1;
			document.getElementById("div" + ID).style.height = tempHeight + "px";
			if(tempParentHeight * 1 - 1 * 1 > 2)
			{
				document.getElementById("div" + parentID).style.height = tempParentHeight * 1 - 1 * 1 + "px";
			}
			
			if(tempHeight * 1 > 0)
			{
				expandMove2 = window.setTimeout("ChangeHieght2('" + ID + "', '-', '" + SubNum + "', '" + parentID + "', '" + SubParent + "');", 0.000000000000000000000000000000000001);
			}
			else
			{
				document.getElementById("div" + ID).style.display = "none";
				document.getElementById("img" + ID).src = "images/wpm_menu_positive.gif";
			}
			lastChildDivHeight = 0;
		}
	}
	catch(ex)
	{
	}
}

function ExpandMenu2(ID, SubNum, parentID, SubParent)
{
	try
	{
		if(lastChildDivID != null && lastChildDivID != "div" + ID)
		{
			if (document.getElementById(lastChildDivID).style.display == "block")
			{
				ChangeHieght2(lastChildDivID.substring(3), '-', SubNum, parentID, SubParent);
			}
		}
		lastChildDivID = "div" + ID;

		if (document.getElementById("div" + ID).style.display == "block")
		{
			ChangeHieght2(ID, '-', SubNum, parentID, SubParent);
		}
		else
		{
			ChangeHieght2(ID, '+', SubNum, parentID, SubParent);
			document.getElementById("div" + ID).style.display = "block";
		}
		lastChildDivHeight = document.getElementById(lastChildDivID).style.height.substring(0, document.getElementById(lastChildDivID).style.height.length - 2);
	}
	catch(ex)
	{
	}
}



function ChangeBGColor(objTD, objIMG)
{
	try
	{
		objTD.className += "_over";
	}
	catch(ex)
	{
	}
}

function RestoreColor(objTD, objIMG)
{
	try
	{
		objTD.className = objTD.className.substring(0, objTD.className.length - 5);

	}
	catch(ex)
	{
	}
}

function hideMenu(tdID)
{
	document.getElementById(tdID).style.display='none';
}

function showMenu(tdID)
{
	document.getElementById(tdID).style.display='block';
}

function OpenWindow(strFileName, intWidth, intHeight)
{
	window.open(strFileName, '','width=' + intWidth + ', height=' + intHeight + ', scrollbars=no')
}