﻿// JScript File
function ShowHideMenu(obj1,obj2,state,location)
{  
    var btn = document.getElementById(obj1);  
    var obj = document.getElementById(obj2);  
    var h=btn.offsetHeight;  
    var w=btn.offsetWidth;  
    var x=btn.offsetLeft;  
    var y=btn.offsetTop;  
   
    while(btn=btn.offsetParent)
    {
        y+=btn.offsetTop;
        x+=btn.offsetLeft;
    }  

    var hh=obj.offsetHeight;  
    var ww=obj.offsetWidth;  
    var xx=obj.offsetLeft;//style.left;  
    var yy=obj.offsetTop;//style.top;  
    var obj2state=state.toLowerCase();  
    var obj2location=location.toLowerCase();  

    var showx,showy,showstate;  

    if(obj2state=="show" || obj2state=="hidden")
    {  
        if(obj2state=="show")
        {
            showstate="visible";
        }
        else
        {
            showstate="hidden";
        }  
    }  
    else
    {  
        showstate="hidden";  
    }
  
    if(obj2location=="left" || obj2location=="top" || obj2location=="right" || obj2location=="bottom")
    {  
        if(obj2location=="left")
        {
            showx=x-ww;
            showy=y;
        }  
        if(obj2location=="top")
        {
            showx=x;
            showy=y-hh;
        }  
        if(obj2location=="right")
        {
            showx=x+w
            showy=y;
        }  
        if(obj2location=="bottom")
        {
            showx=x;
            showy=y+h;
        }  
    }  
    else
    {  
        showx=xx;
        showy=yy;  
    }  
    obj.style.left = showx + "px";  
    obj.style.top = showy + "px";  
    obj.style.visibility = showstate;  
}