//func reference for Mozilla:
window.onload = setActiveMenu;

var menuIndeces = new Object();

menuIndeces["index"] 	= 0;
menuIndeces["news"] 	= 1;
menuIndeces["rm"] 		= 2;
menuIndeces["rs"] 		= 3;
menuIndeces["forsale"] 	= 4;
menuIndeces["gallery"] 	= 5;
menuIndeces["support"] 	= 6;
//menuIndeces["about"] 	= 7;
menuIndeces["contact"] 	= 7;

var thisPageMenu = "";
function setActiveMenu()
{
	try
	{
		//1.) find out what folder we're in under the main host name:
		var url 		= new String(window.location);
		var urlparts 	= url.split('/');
		var host 		= urlparts[2];
		var directory	= urlparts[3].toLowerCase();
		
		if(directory == "")
			directory = "index";//on home page, so no directory to show...
			
		//2.) now that we know the directory, decide what that translates to in our index above:
		var targetKey = "";
		for(key in menuIndeces)
		{
			if(directory.indexOf(key) >= 0)
			{
				targetKey = key;
				//break;
			}			
		}
		
		//3.) if we found it, mark it:		
		if(targetKey != "")
		{
			var column = menuIndeces[targetKey];
			
			window.status += " col:" + column;
			
			menuRow.cells[column].className = "menuhover";
			
			thisPageMenu = menuRow.cells[column];//set thisPageMenu() for the menu rollover script in menu.shtml.			
		}
	}
	catch(e)
	{
		alert(e.description);
	}
}


