oldonload_prodmenu=window.onload;
window.onload=function()
{
	if(typeof oldonload_prodmenu == 'function')
		oldonload_prodmenu();
	
	var submenu = String(window.location);
	submenu = submenu.split("#")[1];
	if(typeof submenu == 'string')
		gomenu(submenu);
	else
		gomenu("products_a-f");
}

function gomenu(submenu)
{
	var menu=submenu.split('_')[0];
	var sub=submenu.split('_')[1];
		
	// resetting the lists
	var div=document.getElementById("productlist");
	if(div==null || typeof div == 'undefined')
		return null;
	var uls=div.getElementsByTagName("ul");
	for(var i=0;i<uls.length;i++)
		uls[i].style.display="none";
	
	// making the list visible
	if(document.getElementById("_"+submenu))
		document.getElementById("_"+submenu).style.display="block";
		
	// setting up the buttons
	var controls=document.getElementById("productlist_controls");
	var as=controls.getElementsByTagName("a");
	for(var i=0;i<as.length;i++)
	{
		var op=as[i];
		// if this link is a submenu tab
		if(op.className.indexOf("setab")!=-1)
		{
			// setting the href
			op.href="#"+menu+"_"+op.title;
			// set the class
			if(op.title==sub)
				op.className="setab selected";
			else
				op.className="setab";
		}
		// if this link is a menu tab
		else if(op.className.indexOf("tab")!=-1)
		{
			// setting the href
			op.href="#"+op.title+"_"+sub;
			// set the class
			if(op.title==menu)
				op.className="tab selected";
			else
				op.className="tab";
		}
		// setting the onclick event
		op.onclick=function()
		{
			gomenuitem(this.href.split("#")[1]);
		}
		op.blur();
	}
}
function gomenuitem(submenu)
{
	gomenu(submenu);
}
