// This javascript controls the display and hiding of the left navigation

//Handle hiding or showing the current id
function ShowOrHideTable(sTheID,iStep) {
	
	if ( sTheID == "subcata" )
	{
		return;
	}

	if ( document.getElementById(sTheID).style.display == "" )  {
		document.getElementById(sTheID).style.display = "none";
	}
	else {
		HideAll("subcat");
		document.getElementById(sTheID).style.display = "";
	}
}

function HideAll(sPrefix) {

	var oTags = document.getElementsByTagName("*");
	var iPrefixLength = sPrefix.length;

	//Loop through the entire document looking at each tag
	for (var i = 0; i < oTags.length; i++) {
		//If the current tag supports having an ID, continue
		if ( oTags[i].id ) {
			//If the current tag has an ID, continue
			if ( oTags[i].id.length > iPrefixLength ) {
				//Check to see if the current ID is prefixed with what we are trying to hide
				if ( oTags[i].id.substring(0,iPrefixLength) == sPrefix ) {
					document.getElementById(oTags[i].id).style.display = "none";
				}
			}
		}
	}
}

function popUp( id )
{
	theWindow = window.open("", "_blank", "width=1000,height=700,scrollbars=yes,resizable=yes");
	theWindow.document.write("<img src=\"admin/pages/image.php?field=full_res&id=" + id + "\" alt=\"\" />");
	theWindow.document.write("<p><a href=\"javascript:window.close()\">Close Window</a></p>");
	theWindow.document.close( );
}