submenu_x = 145
submenu_y = 0
submenu_width = 180

submenu_border = 1
submenu_border_color = "#0C0C79"
submenu_item_indent = 5
submenu_item_height = 18
submenu_item_spacing = 1
submenu_item_spacing_color = "#0C0C79"
submenu_background_color = "#FFFFFF"
submenu_highlight_color = "#A7A7A7"

submenu_font_class = "submenulink"
submenu_font_size = 2
submenu_font_color = "#000000"
submenu_font_highlight_color = "#990000"
submenu_url_target = "_self"
hide_delay = 700


var over_submenu = new Array();  
var id1 = 1; 
while(id1 <= mainMenuCount) {
	document.write("<div id=\"submenu"+id1+"\" onMouseOver=\"over_submenu["+id1+"]=true;\" onMouseOut=\"over_submenu["+id1+"]=false; deactivateAllDelay();\" style=\"position:absolute;cursor:hand; width:"+submenu_width+"px; z-index:10; visibility: hidden; background-color: "+submenu_border_color+"; layer-background-color: "+submenu_border_color+"; border: 1px none #000000\">");
	if(eval("window.submenu" + id1 + "_1_text")) {
		document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\""+submenu_border+"\" bgcolor=\""+submenu_border_color+"\"><tr><td>");   
		document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\""+submenu_item_spacing_color+"\">");   
		var id2 = 1;   
		while(eval("window.submenu"+id1+"_"+id2+"_text")) {
		     if(id2 > 1 && submenu_item_spacing > 0) document.write("<tr><td><img src=\"spacer.gif\" width=\"1\" height=\""+submenu_item_spacing+"\"></td></tr>");     
		     document.write("<tr><td><div id=\"submenu"+id1+"_"+id2+"\" onClick=\"link('"+eval("window.submenu"+id1+"_"+id2+"_link")+"','"+submenu_url_target+"');\" onMouseOver=\"over_submenu["+id1+"]=true; setItemColor('submenu"+id1+"_"+id2+"','"+submenu_highlight_color+"','"+submenu_font_highlight_color+"');\" onMouseOut=\"over_submenu["+id1+"]=false; deactivateAllDelay(); setItemColor('submenu"+id1+"_"+id2+"','"+submenu_background_color+"','"+submenu_font_color+"');\" style=\"position:relative; width:"+submenu_width+"px; height: "+submenu_item_height+"; z-index:10;  visibility: inherit;  background-color: "+submenu_background_color+"; layer-background-color: "+submenu_background_color+"; color: "+submenu_font_color+"\"><img src=\"0000spac.gif\" width=\""+submenu_item_indent+"\" height=\"1\"><font class=\""+submenu_font_class+"\">"+eval("window.submenu"+id1+"_"+id2+"_text")+"</font></div></td></tr>");     
		     id2++;   
		}   
		document.write("</table>");   
		document.write("</td></tr></table>");   
	} 
	document.write("</div>");  
	id1++; 
}  

function activateMenu(id) {
   over_submenu[id] = true;   
   deactivateAll();   
	//alert(id);
   changeCellBgr("cellNum" + id, "0100menu.gif", "sub");   
   showSubMenu(id); 
}  

function deactivateMenu(id) {
   over_submenu[id] = false;   
   deactivateAllDelay(); 
}  

function deactivateAllDelay() {
   setTimeout("deactivateAll()",hide_delay); 
}  

function deactivateAll() {
   var id = 1;   
   while(id <= mainMenuCount) {
        if(!over_submenu[id]) {
               hideSubMenu(id);       
               //changeCellBgr("cellNum" + id, "0000spac.gif", "sub");     
        }     
        id++;   
   } 
}  

function link(url, target) {
 if(target == "_self") {
      window.location.href=url;   
 }   
 else {
      window.open(url, target);   
 } 
}  

function showSubMenu(id) {
	if(eval("window.submenu"+id+"_1_text")) {
		var theImageName = "cellNum" + id;   
		var theImage;  
		 
		theImage = changeCellXY(theImageName);   

		var theSubMenu = eval("window.submenu"+id);   
		theSubMenu.style.top = getCoordinates(theImage).y + submenu_y;   
		theSubMenu.style.left = getCoordinates(theImage).x + submenu_x;   
		theSubMenu.style.visibility = 'visible'; 
	}
}  

function getCoordinates(obj) {
   var newObj = new Object();   
   newObj.x = obj.offsetLeft;   
   newObj.y = obj.offsetTop;   
   theParent = obj.offsetParent;   
   while(theParent != null){
        newObj.y += theParent.offsetTop;     
        newObj.x += theParent.offsetLeft;     
        theParent = theParent.offsetParent;   
   }   
   return newObj;  
}  

function setItemColor(theItemName,theItemBgColor,theItemColor) {
   if(document.all) {
        document.all[theItemName].style.backgroundColor=theItemBgColor;     
        document.all[theItemName].style.color=theItemColor;   
   } 
}  

function hideSubMenu(id) {
   var theSubMenu = eval("window.submenu"+id);   
   theSubMenu.style.visibility='hidden'; 
} 

function changeCellBgr(cellRef, imgName, pageType) {
	cellObject = document.getElementById(cellRef);
	if(pageType == "sub") {
		cellObject.background = "../images/" + imgName;
	}
	else {
		cellObject.background = "images/" + imgName;
	}
}

function changeCellXY(cellRef) {
	cellObject = document.getElementById(cellRef);
	return cellObject;
}

