var up_id="";
var down_id;
var obj_up;
var menu_up_counter=1;
var menu_down_counter=1;
var prev_down;
var ratio;
var width;
var height;
var mwidth;
var mheight;
var minwidth;
var minheight;
var pvdw;
var pvdh;
function animate_up_menu(v)
{
    //alert(v);
    width=document.getElementById(v).width;
    height=document.getElementById(v).height ;
    mwidth=parseInt(document.getElementById(v).style.maxWidth);
    mheight=parseInt(document.getElementById(v).style.maxHeight) ;
    minwidth=parseInt(document.getElementById(v).style.minWidth);
    ratio=width/height;
    if (down_id)
    {
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
           // closeTimeout(down_id);
          down_id = "";
        }
        else
        {
            clearInterval(down_id);
        }
        //prev_down=v;
        
        document.getElementById(prev_down).width=pvdw;
        document.getElementById(prev_down).height=pvdh;
        menu_up_counter = 1;
    }
    pvdw=width;
    pvdh=height;
    obj_up = document.getElementById(v);
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
        up_id = window.setTimeout("menu_up()",1);
    }
    else
    {
        up_id = setInterval("menu_up()",0);
    }
}
function menu_up()
{
    if (obj_up.width != mwidth && obj_up.width<=mwidth)
    {
        // alert("bent");
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
            obj_up.width += 5*ratio;
            obj_up.height += 5;
        }
        else
        {
            obj_up.width += menu_up_counter*ratio;
            obj_up.height += menu_up_counter;
            menu_up_counter++;
        }
    }
    else
    {
        // alert("leall");
        obj_up.width = mwidth;
        obj_up.height = mheight;
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
            //clearTimeout(up_id);
            up_id = "";
        }
        else
        {
            clearInterval(up_id);
        }
        menu_up_counter = 1;
    }
}
function animate_down_menu(v)
{
    // alert(v);
    prev_down = v;
    if (up_id)
    {
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
           // window.clearTimout(up_id);
           up_id = "";
        }
        else
        {
            clearInterval(up_id);
        }
        menu_up_counter = 1;
    }
    obj_down = document.getElementById(v);
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
       down_id = window.setTimeout("menu_down()",1);
    }
    else
    {
        down_id = setInterval("menu_down()",0);
    }
    
}
function menu_down()
{
    if (obj_down.width != width && obj_down.width>width&&minwidth>width)
    {
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
            obj_down.width = width;
            obj_down.height = height;            
        }
        else
        {
            obj_down.width -= menu_down_counter*ratio;
            obj_down.height -= menu_down_counter;
        }
        menu_down_counter++;
    }
    else
    {
        obj_down.width = width;
        obj_down.height = height;
        if (navigator.appVersion.indexOf("MSIE") != -1)
        {
           /* clearTimeout(down_id);*/
           down_id = "";
        }
        else
        {
            clearInterval(down_id);
        }
        menu_down_counter = 1;
    }
}

