
selectedSubMenu  = "";
oldBG = "";
oldBorder = "";
highlighted = false;
loaded = false;

function changeto(e,bgcolor,bordercolor){
    source = event.srcElement;
    if (source.tagName=="TR" || source.tagName=="TABLE") return;

    while(source.tagName != "TD" && source.tagName != "HTML") source = source.parentElement;

    if (source.style.backgroundColor != bgcolor && source.id!="ignore") {


        if(!highlighted){

            oldBG = source.style.backgroundColor;

            oldBorder = source.style.borderColor;

            highlighted = true;
        }
        source.style.backgroundColor = bgcolor;

        //if(bordercolor!=null) source.style.borderColor=bordercolor;

        //else source.style.borderColor='B3B995';

    }

}

function changeback(e,bgcolor,bordercolor){

    if ((event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id=="ignore") ||

    source.tagName=="TR"||source.tagName=="TABLE") return;

    if (event.toElement != source) {

        source.style.backgroundColor=oldBG;

        //source.style.borderColor=oldBorder;

        highlighted = false;

    }

}

var menutimer = 0;

function menuinit(){

    loaded = true;

    clearTimeout(menutimer);

    var center = 393;

    aboutSubMenu.style.display = "none";

    aboutSubMenu.style.pixelLeft = center - 326;

    aboutSubMenu.style.pixelTop = 75 ;

 
   resourcesSubMenu.style.display = "none";

    resourcesSubMenu.style.pixelLeft = center - 248;

    resourcesSubMenu.style.pixelTop = 75 ;


    edu_trainingSubMenu.style.display = "none";

    edu_trainingSubMenu.style.pixelLeft = center - 120;

    edu_trainingSubMenu.style.pixelTop = 75 ;



    programsSubMenu.style.display = "none";

    programsSubMenu.style.pixelLeft = center - 63;

    programsSubMenu.style.pixelTop = 75 ;



    publicationsSubMenu.style.display = "none";

    publicationsSubMenu.style.pixelLeft = center + 122;

    publicationsSubMenu.style.pixelTop = 75 ;


    getinvolvedSubMenu.style.display = "none";

    getinvolvedSubMenu.style.pixelLeft = center + 130;

    getinvolvedSubMenu.style.pixelTop = 75 ;
 

	pressSubMenu.style.display = "none";

    pressSubMenu.style.pixelLeft = center + 256;

    pressSubMenu.style.pixelTop = 75 ;

}

function toggleAllMenus() {

    if(loaded==false) return;

    aboutSubMenu.style.display = "none";

    getinvolvedSubMenu.style.display = "none";

    resourcesSubMenu.style.display = "none";

    edu_trainingSubMenu.style.display = "none";

    publicationsSubMenu.style.display = "none";

    programsSubMenu.style.display = "none";

	pressSubMenu.style.display = "none";

}


function toggleMenu(menuid) {

    if (loaded==false || menuid == selectedSubMenu) return;

    clearTimeout(menutimer);

    layer = eval(menuid);

    if (layer.style.display == "none") {

        toggleAllMenus();
        layer.style.display = "block";

    }

    else {

        layer.style.display = "none";

    }

    //if(menuid=='getinvolvedSubMenu') clipSearch();

}



function menuover() {

    clearTimeout(menutimer);

}



function menuout(menuid) {

    if (menuid == selectedSubMenu) return;

    clearTimeout(menutimer);

    menutimer = setTimeout("toggleMenu('" + menuid + "')", 1000);

}

window.onload = menuinit;

window.onresize = menuinit;
 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
