var selectNum = document.getElementsByTagName("SELECT");

function hideElement(index) {
overDiv = eval ('menu' + index);
	for (i = 0; i < selectNum.length; i++ ) {
		obj = selectNum[i];
		if (!obj || !obj.offsetParent ) {continue;}
      
          // Find the element's offsetTop and offsetLeft relative to the BODY tag.
          objLeft   = obj.offsetLeft;
          objTop    = obj.offsetTop;
          objParent = obj.offsetParent;
          
          
          while (objParent.tagName.toUpperCase() != "BODY" ) {
            objLeft  += objParent.offsetLeft;
            objTop   += objParent.offsetTop;
            objParent = objParent.offsetParent;
          }
             
          objHeight = obj.offsetHeight;
          objWidth = obj.offsetWidth;
      
		  
		  if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
          else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
          else if( overDiv.offsetTop >= ( objTop + objHeight ));
          else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
          else
          {

          obj.style.visibility = "hidden";

        }
}
}



function showElement()   {
	for (i = 0; i < selectNum.length; i++ ) {
          obj = selectNum[i];
		  if( !obj || !obj.offsetParent ) {continue;}
          obj.style.visibility = "visible";
        }
      }


var holder = "menu1"; 
var tab = "tab1";
var overMenu = false; 

function getMenu(index) { 

overMenu = true;
if (isExp){window.clearTimeout(closeMenu);}
showLayer(holder,'hidden');
swapClass(tab,'');
showElement();

holder= 'menu' + index; 
tab= 'tab' + index;


swapClass(tab,'menuon');


var curPos = getoffsetX(tab) + 5;
if (isMac || isW3C) {curPos = curPos - 5}


moveLayerX(holder,curPos)
showLayer(holder,'visible'); 
hideElement(index);
} 

function hideMenu() { 
showLayer(holder,'hidden'); 
swapClass(tab,'');

} 

function cleanUp() { 
overMenu = false; 
setTimeout("closeMenu()", 500); 
} 

function retainMenu() { 
overMenu = true; 
if (isExp){window.clearTimeout(closeMenu);}
} 

function closeMenu() { 
if(!overMenu) { 
showLayer(holder,'hidden'); 
swapClass(tab,'');
showElement();
} 
if (isExp){window.clearTimeout(closeMenu);}

} 


function setPage(root) {
var isCol2 = returnLayer('col2');
var pageh = getlayerHeight('lyrPageCont');
var windowh = getwindowHeight();
newheight = windowh - 280; //appx height of header
colsize = false;


///SET COLUMN 2 HEIGHT
if (isCol2) {
col2h = getlayerHeight('col2');
if (col2h >= pageh && col2h >= newheight) {
resizeH('lyrPageCont',col2h + 50);
colsize = true;
}


//RESIZE FOOTER
if (newheight >= pageh && !colsize) {resizeH('lyrPageCont',newheight)}
}


//WRITE TOP BUTTON FOR LONGER PAGES
if (pageh >= newheight) {document.write('<a href="javascript:window.scrollTo(0,0)"><img src="' + root + 'images/but_top.gif"></a>')}

}