var currentOpen=0;	// used to keep track of submenus that are open
var subFlag=false;	// used to indicate if you are over any of the submenus
var mainFlag=false;			// used to indicate if you are over the main menu
var menuCoords; // Coordinates defining defining each menu item
function init() {
showDiv('mainMenuMap');
showDiv('utilMenuMap');
}
function overMenu(whichMain,c1,c2,c3,c4,hasSub){
if (whichMain < 8){
theMenu = "mainMenuHover";
} else {
theMenu = "utilMenuHover";
}
var menNum = whichMain-1;
hideDiv(theMenu); // for Mac compatibility
clipDiv(theMenu,c2,c3,c4,c1);
showDiv(theMenu);
if (currentOpen > 0){
hideSub(currentOpen);
} 
if (hasSub){
showSub(whichMain)
currentOpen = whichMain;
}
mainFlag = true;
}
function overSubMenu(whichSub,c1,c2,c3,c4){
subFlag = true;
hideDiv("subMenu"+whichSub+"Hover");
eval('clipDiv("subMenu'+whichSub+'Hover",c2,c3,c4,c1)');
showDiv("subMenu"+whichSub+"Hover");
}
function offMenu(){
if (mainFlag){
if (subFlag) {
mainFlag = true;
} else {
mainFlag = false;
eval("setTimeout('delayIt()',100)");
}
} 
}
function offSubMenu(){
subFlag = false;
eval("setTimeout('delayIt()',100)");
}
function delayIt(which) {
if (!mainFlag && !subFlag){
clipDiv('mainMenuHover',0,0,0,0);
clipDiv('utilMenuHover',0,0,0,0);
if (currentOpen > 0){
hideSub(currentOpen);
}
} 
}
// shows a submenu *************** 
function showSub(index) {
eval('showDiv("subMenu'+ index +'Base")');
eval('showDiv("subMenu'+ index +'Map")');
}
// hides a submenu and resets the flag *************
function hideSub(index) {
eval('hideDiv("subMenu'+ index +'Base")');
eval('hideDiv("subMenu'+ index +'Hover")');
eval('hideDiv("subMenu'+ index +'Map")');
currentOpen=0;
}
