/*************************************************************************
  Gloabl Variables for all the Sliders
**************************************************************************/
var speed_down      = 10;
var int_time_down   = 5;

var speed_up        = 5;
var int_time_up     = 10;

/**************************************************************************
  These function control the 'Pet Care' Sub Menu
**************************************************************************/
var currClip1 = 0;
var slider1;
var submenu1;
var max_h1;

function showMenu1(menu_id,max_height) {   
    clearInterval(slider1);
    submenu1    = menu_id;
    max_h1      = max_height;
    slider1     = setInterval("show1()",int_time_down);
}

function show1()    {
    //make the submenu visible
    var curMenu1                = document.getElementById(submenu1);
    curMenu1.style.display      = "block";
    curMenu1.style.visibility   = "visible";

    //increment the clip style value
    currClip1 = currClip1 + speed_down;

    //check if the submenu has reached the bottom yet
    if(currClip1 > max_h1)    {
        currClip1 = max_h1
        curMenu1.style.clip = "rect(auto, auto, "+currClip1+"px, auto)";
        clearInterval(slider1);
    }
    else {  //the submenu is still sliding down
        curMenu1.style.clip = "rect(auto, auto, "+currClip1+"px, auto)";
    }
}

function hideMenu1(menu_id,max_height) {
    clearInterval(slider1);
    submenu1    = menu_id;
    max_h1      = max_height;
    slider1     = setInterval("hide1()",int_time_up);
}

function hide1()    {

    //increment the clip style value
    currClip1 = currClip1 - speed_up;

    var curMenu1 = document.getElementById(submenu1);

    //check if the submenu has reached the bottom yet
    if(currClip1 < 0)    {
        currClip1 = 0
        curMenu1.style.clip = "rect(auto, auto, "+currClip1+"px, auto)";
        clearInterval(slider1);

        //make the submenu invisible
        curMenu1.style.display      = "none";
        curMenu1.style.visibility   = "hidden";

    }
    else {  //the submenu is still sliding down
        curMenu1.style.clip = "rect(auto, auto, "+currClip1+"px, auto)";
    }
}


/**************************************************************************
  These function control the 'Staff' Sub Menu
**************************************************************************/
var currClip2 = 0;
var slider2;
var submenu2;
var max_h2;

function showMenu2(menu_id,max_height) {
    clearInterval(slider2);
    submenu2    = menu_id;
    max_h2      = max_height;
    slider2     = setInterval("show2()",int_time_down);
}

function show2()    {
    //make the submenu visible
    var curMenu2                = document.getElementById(submenu2);
    curMenu2.style.display      = "block";
    curMenu2.style.visibility   = "visible";

    //increment the clip style value
    currClip2 = currClip2 + speed_down;

    //check if the submenu has reached the bottom yet
    if(currClip2 > max_h2)    {
        currClip2 = max_h2
        curMenu2.style.clip = "rect(auto, auto, "+currClip2+"px, auto)";
        clearInterval(slider2);
    }
    else {  //the submenu is still sliding down
        curMenu2.style.clip = "rect(auto, auto, "+currClip2+"px, auto)";
    }
}

function hideMenu2(menu_id,max_height) {
    clearInterval(slider2);
    submenu2    = menu_id;
    max_h2      = max_height;
    slider2     = setInterval("hide2()",int_time_up);
}

function hide2()    {

    //increment the clip style value
    currClip2 = currClip2 - speed_up;

    var curMenu2 = document.getElementById(submenu2);

    //check if the submenu has reached the bottom yet
    if(currClip2 < 0)    {
        currClip2 = 0
        curMenu2.style.clip = "rect(auto, auto, "+currClip2+"px, auto)";
        clearInterval(slider2);

        //make the submenu invisible
        curMenu2.style.display      = "none";
        curMenu2.style.visibility   = "hidden";

    }
    else {  //the submenu is still sliding down
        curMenu2.style.clip = "rect(auto, auto, "+currClip2+"px, auto)";
    }
}