function Menu()
{
   this.LoadMenu=function()
   {
      try
      {
		if(window.location.href.indexOf("&cid=")!=-1)
		{
		var CategoryID=window.location.href;
		CategoryID=CategoryID.substring(CategoryID.indexOf("&cid="),CategoryID.length);
		CategoryID=CategoryID.replace("&cid=","");
	      
	      
		var obj=document.all("sub"+CategoryID);
		if (obj.parentNode)
		{ 
			while (obj.parentNode.id!="tblMenu")
			{
			    
			obj.parentNode.style.display="block";
			obj=obj.parentNode;
				
			}
		}
		}
	 }
	 catch(e)
	 {
	 }
	 
   }

   this.BuildSubCategories=function(Category,ID)
   {
    
     
     var ParentTop=this.findPosY(Category);
     var ParentLeft=this.findPosX(Category);
     var tblSub=document.all("sub"+ID);
     
     tblSub.style.position="absolute";
     tblSub.style.left=ParentLeft-180;
     tblSub.style.top=ParentTop;
     tblSub.style.display="block";
   
   }
   
   this.Toggle=function(ID)
   {
      var tblSub=document.all("sub"+ID);
      
      if(tblSub.style.display=="none")
      {
         tblSub.style.display="block";
      }
      else
      {
         tblSub.style.display="none";
      } 
   }
   
   this.OnMouseOut=function(Category,ID)
   {
     
    
     var PointerX=window.event.clientX;
     var PointerY=window.event.clientY;
     var tblSub=document.all("sub"+ID);
     var tblSubLeft=tblSub.style.left;
     var tblSubTop=tblSub.style.top;
     tblSubLeft=tblSubLeft.replace("px","");
     tblSubTop=tblSubTop.replace("px","");
     
     //alert(tblSub.style.left);
     //alert(tblSub.offsetWidth);   
     //alert(parseInt(tblSubLeft)+parseInt(tblSub.offsetWidth));
    
    
     if(PointerX>tblSubLeft && PointerX<(parseInt(tblSubLeft)+parseInt(tblSub.offsetWidth))+40)
     {  
        //alert(parseInt(tblSubLeft)+parseInt(tblSub.offsetWidth));
        //alert(PointerX);
     }
     else
     { 
       //alert(PointerX);
       tblSub.style.display="none";
     }
     //if(Pointer
     
     //alert(tblSub.style.
     //tblSub.style.display="none";
   }
   
   this.findPosX=function(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;
  }

  this.findPosY=function(obj)
  {
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
  }

}
