var lastSideId = 0;
var menuElements = new Array();

$(document).ready(function(){
	var tmp = document.getElementById("left_menu").getElementsByTagName("span");
	for(x=0;x<tmp.length;x++)
	{
		if(tmp[x].className == "side_popout")
		{
			menuElements.push(tmp[x]);
		}
	}
//	menuElements = document.getElementById("left_menu").getElementsByTagName("span");
});

function showSideMenu(id)
{
	$("#sub_"+id).slideToggle("slow");
	if(document.getElementById("arrow_"+id))
	{
		if(document.getElementById("arrow_"+id).src.split("/")[document.getElementById("arrow_"+id).src.split("/").length -1] == "pcrn_left_nav_arrow_down.png") {
			document.getElementById("arrow_"+id).src = "/template/images/pcrn_left_nav_arrow_left.png";
			//document.getElementById("arrow_"+id).className = "hack-png";
		} else {
			document.getElementById("arrow_"+id).src = "/template/images/pcrn_left_nav_arrow_down.png";
			//document.getElementById("arrow_"+id).className = "hack-png";
		}
	}
}

function showTopMenu(id){
	document.getElementById("top_" + id).style.visibility = "visible";
}

function hideTopMenu(id)
{
	document.getElementById("top_"+id).style.visibility = "hidden";
}

function showContentMenu(id)
{
	$("#content_menu_container").slideToggle("slow");
}

function showDescription(id)
{
	hideDescription("x");
	$("#desc_"+id).fadeIn("fast");
	document.getElementById("desc_"+id).style.marginTop = "-"+(document.getElementById("desc_"+id).clientHeight /2 - 14)+"px";
}

function hideDescription(id)
{
// tmp = document.getElementById("left_menu").getElementsByTagName("span");

	for(x=0;x<menuElements.length;x++)
	{
		if(menuElements[x].className == "side_popout")
		{
			document.getElementById(menuElements[x].id).style.display = "none";
		}
	}
//	document.getElementById("desc_"+id).style.marginTop = "0px";
//	document.getElementById("desc_"+id).style.display = "none";
//	$("#desc_"+id).fadeOut("fast");
}
