
	var timershow=Array();
	var timerhide=Array();
	var rightside=810;
	var current="";

	function menushow(name)
	{
	  clearTimeout(timerhide[name]);
	  timershow[name]=setTimeout(function() { bg_menushow(name);},1);
	}

	function menuhide(name)
	{
	  timerhide[name]=setTimeout(function() { bg_menuhide(name);},500);
	}

	function bg_menushow(name)
	{
	  //menuobj=document.getElementById("menu");
	  if(current!=name && current!="")
		  bg_menuhide(current);
	  current=name;		
	  m=document.getElementById(name);
	  m.style.width='';
	  //m.parentNode.offsetLeft;

	  m.style.display="block";
	  m.style.zIndex="1000";
	  
	  pm=document.getElementById(name.substr(3));
	  fromleft=findPosX(pm)+19; //pm.offsetLeft;
	  
	  //alert(fromleft);
	  if(fromleft+m.clientWidth>rightside)
	    fromleft=rightside-m.clientWidth;
	  
	  m.style.left=fromleft+"px";
	  
	}

	function bg_menuhide(name)
	{
	  m=document.getElementById(name);
	  m.style.display="none";
	  m.style.zIndex="0";
	  m.style.left="-1000px";
	  current="";
	}

	function findPosX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function addLoadEvent(func) {
		  var oldonload = window.onload;
		  if (typeof window.onload != 'function') {
		    window.onload = func;
		  } else {
		    window.onload = function() {
		      if (oldonload) {
		        oldonload();
		      }
		      func();
		    }
		  }
	}


	
