// JavaScript Document - navigation.js

sfHover = function()
{
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++)
	{
		sfEls[i].onmouseover=function()
		{
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function()
		{
			setTimeout(this.className=this.className.replace(new RegExp(" sfhover\\b"), ""),500);
		}
	}
}
//setTimeout("__menu_sub.style.visibility = 'hidden'", 500
if (window.attachEvent)
	window.attachEvent("onload", sfHover);

function SetCookie(cookieName,cookieValue,nDays)
{
    var expire = new Date();
    if (nDays==null || nDays==0)
		nDays=1;
    expire.setTime(expire.getTime() + 3600000*24*nDays);
    document.cookie = cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString()+";path=/";
}

function SetLang(lang)
{
 	SetCookie('<?=$cookie?>',lang,365);
 	document.location=document.location;
}

<!--
function MM_openBrWindow(theURL,winName,features)
{
  window.open(theURL,winName,features);
}
//-->

function hide_show(id)
{
	if($(id).style.display == 'none')
	{
		$(id).style.display = "block"
	}
	else
	{
		$(id).style.display = "none"
	}
}

function change_class(object,new_class_name,old_class_name)
{
	Element.removeClassName(object,old_class_name);
	Element.addClassName(object,new_class_name);
}

//hide submenus/in this point if java script is disabled aall the menus will be displayed
hide_menus = function()
{
	allNodes = document.getElementsByClassName("submenu");
	for(i = 0; i < allNodes.length; i++)
	{
		if(allNodes[i].id != '<?=$_REQUEST["sub_menu_id"]?>')
		{
    		allNodes[i].style.display = "none";
		}
		else
		{
			allNodes[i].style.display = "block";
		}
	}
}

window.onload = hide_menus;
