var submenu = "";
var bIE = (String(typeof(document.all)) != "undefined");
var SCREEN_X = 0, SCREEN_Y = 1;
var context='';


function menuOver(index, control){
    //alert("menuOver");
    //document.body.style.backgroundPosition="100 100";
    /*menuImg.src = "../images/menu/" + image + "_hover.gif";*/
    var sm_name ="part"+index.toString();
    var sm_object = document.getElementById(sm_name + "_sm");
     if( sm_object != null) {
     
        sm_object.style.left = getMenuXOffset(control).toString()+"px";
        sm_object.style.top =  getMenuYOffset(control).toString()+"px";
        /*alert( "index="+index.toString()+", x="+sm_object.style.left.toString()+", y="+sm_object.style.top.toString());*/
    }
    showSubmenu(sm_name);
}

function menuOut(index, control){
   // alert("menuOut");
    /*document.body.style.backgroundPosition="top center";*/
   /* menuImg.src = "../images/menu/" + image + ".gif";*/
    hideSubmenu("part"+index.toString());
}

function gotoUrl(url) {
    location.href = context + url;
}

function showSubmenu(sm_name) {
   // var sm_name ="part"+index.toString();
   // alert("showSubmenu");
   /* if(sm_name=='part7'|| sm_name=='part8')
    {
        enableManualBGPosition();
    }*/
    if(document.getElementById(sm_name + "_sm") != null) {
        document.getElementById(sm_name + "_sm").style.display = "";
        submenu = sm_name;
    }
}

function hideSubmenu(sm_name) {
  //  alert("hideSubmenu");
    //var sm_name ="part"+index.toString();
    if(document.getElementById(sm_name + "_sm") != null) {
        submenu = "";
        setTimeout("doHide('" +sm_name + "')", 50);
    }
}

function doHide(sm_name) {
   // alert("doHide");
   // var sm_name ="part"+index.toString();
    if(submenu != sm_name) {
        document.getElementById(sm_name + "_sm").style.display = "none";
    }
   /* if(sm_name=='part7'|| sm_name=='part8')
    {
        disableManualBGPosition();
    }*/
    
}
    
function menuDivOver(sm_name) {
    submenu = sm_name;
}

function menuDivOut(current) {
    submenu = "";
    hideSubmenu(current);
}

function submenuOver(menu) {
    menu.className = "submenu_over submenu_over_bg";
}

function submenuOut(menu) {
    menu.className = "submenu submenu_bg";
} 

function getScreenSize(s)
{
    if (s == SCREEN_X)
    {
        /*if (bIE)*/
           /* alert("document.body.offsetWidth = "+document.body.offsetWidth.toString());*/
            return document.body.offsetWidth;

       /* return window.innerWidth;*/
    }
    else
    {
      /*  if (bIE)*/
            return document.body.offsetHeight;

      /*  return window.innerHeight;*/
    }
}


function getMenuYOffset(control)
{
    /*if(index==1 || index == 5 || index ==6)
    {
        return 256;
    }
    else
    {
        return 258+10;
    }*/
    return control.offsetHeight+136+104+1;
}

function getMenuXOffset(control)
{
    var offset=getScreenSize(SCREEN_X);
    if(offset>800)
    {
        offset=(offset-800)/2;
    }
    else
    {
        offset =1;
    }
   /* alert("In getMenuXOffset("+index.toString()+"), offset="+offset.toString()+", return="+((index-1)*100+offset+3).toString());*/
    return control.offsetLeft+offset;
    //(index-1)*100+offset+3;
}

function enableManualBGPosition()
{
    document.body.style.backgroundPosition="0px 50px";
}

function disableManualBGPosition()
{
    //document.body.style.backgroundPosition="top center";
}






