<!--
//Region Global Variables
var SelectedMenuStyleInfos=new Object();
var UnselectedMenuStyleInfos=new Object();
var MenuFadeDelays=new Object();
var clockValue=0;
var ticker;
var highlightTopMenus=new Object();
var images=new Array();
var OpenMenuItems = new Array();
//EndRegion
//Region Methods to hook up a menu to the global variables
function registerMenu(menuID, selectedStyleInfo, unselectedStyleInfo, menuFadeDelay, highlightTopMenu){
	SelectedMenuStyleInfos[menuID]=selectedStyleInfo;
	UnselectedMenuStyleInfos[menuID]=unselectedStyleInfo;
	MenuFadeDelays[menuID]=menuFadeDelay;
	highlightTopMenus[menuID]=highlightTopMenu;
}
//Region The methods and contructor of the styleInfo object.
function applyStyleInfoToElement(element){
	element.style.backgroundColor=this.backgroundColor;
	element.style.borderColor=this.borderColor;
	element.style.borderStyle=this.borderStyle;
	element.style.borderWidth=this.borderWidth;
	element.style.color=this.color;
	if (this.fontFamily!='')
		element.style.fontFamily=this.fontFamily;
	element.style.fontSize=this.fontSize;
	element.style.fontStyle=this.fontStyle;
	element.style.fontWeight=this.fontWeight;
	if (this.className!='')
		element.style.className=this.className;
}
function styleInfo(backgroundColor,borderColor,borderStyle,borderWidth,color,fontFamily,fontSize,fontStyle,fontWeight,className){
	this.backgroundColor=backgroundColor;
	this.borderColor=borderColor;
	this.borderStyle=borderStyle;
	this.borderWidth=borderWidth;
	this.color=color;
	this.fontFamily=fontFamily;
	this.fontSize=fontSize;
	this.fontStyle=fontStyle;
	this.fontWeight=fontWeight;
	this.className=className;
	this.applyToElement=applyStyleInfoToElement;
}
//Region MouseEventHandlers
function mousedOverMenu(menuID,elem,parent,displayedVertically,imageSource){
	stopTick();
	closeSubMenus(elem);
	var childID=elem.id+"-subMenu";  // Display child menu if needed
	if (document.getElementById(childID)!=null){  // make the child menu visible and specify that its position is specified in absolute coordinates
		document.getElementById(childID).style.display='block';
		document.getElementById(childID).style.position='absolute';
		OpenMenuItems = OpenMenuItems.concat(childID);
		if (displayedVertically){ // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=getAscendingLefts(parent)+parent.offsetWidth;
			document.getElementById(childID).style.top=getAscendingTops(elem);
			var visibleWidth=parseInt(window.outerWidth?window.outerWidth-9:document.body.clientWidth,10);
			if ((parseInt(document.getElementById(childID).offsetLeft,10)+parseInt(document.getElementById(childID).offsetWidth,10))>visibleWidth) {
				document.getElementById(childID).style.left=visibleWidth-parseInt(document.getElementById(childID).offsetWidth,10);
			}
		}else{  // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=getAscendingLefts(elem);
			document.getElementById(childID).style.top=getAscendingTops(parent)+parent.offsetHeight;
			if (document.getElementById(childID).offsetWidth<elem.offsetWidth)
				document.getElementById(childID).style.width=elem.offsetWidth;
		}
	}
	if (SelectedMenuStyleInfos[menuID] != null) SelectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverClickToOpen(menuID,elem,parent,imageSource){
	stopTick();
	if (SelectedMenuStyleInfos[menuID] != null) SelectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverSpacer(menuID,elem,parent){
	stopTick();
}
function mousedOutMenu(menuID,elem,imageSource){
	doTick(menuID);
	if (UnselectedMenuStyleInfos[menuID] != null) UnselectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			UnselectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOutSpacer(menuID, elem){
	doTick(menuID);
}
//Region Utility Functions
function closeSubMenus(parent){
	if (OpenMenuItems == "undefined") return;
	for (var i=OpenMenuItems.length-1; i>-1;i--) {
		if (parent.id.indexOf(OpenMenuItems[i]) != 0) {
			document.getElementById(OpenMenuItems[i]).style.display = 'none';
			shimSetVisibility(false, OpenMenuItems[i]);			
			OpenMenuItems = new Array().concat(OpenMenuItems.slice(0,i), OpenMenuItems.slice(i+1));
  		} 
	}
}
function shimSetVisibility(makevisible, tableid){
	var tblRef=document.getElementById(tableid);
	var IfrRef=document.getElementById('shim'+tableid);
	if (tblRef!=null && IfrRef!=null){
		if(makevisible){
			IfrRef.style.width=tblRef.offsetWidth;
			IfrRef.style.height=tblRef.offsetHeight;
			IfrRef.style.top=tblRef.style.top;
			IfrRef.style.left=tblRef.style.left;
			IfrRef.style.zIndex=tblRef.style.zIndex-1;
			IfrRef.style.display="block";
		}else{
			IfrRef.style.display="none";
		}
	}
}
function IsSubMenu(id){
	if (subMenuIDs == "undefined") return false;
	for (var i=0;i<subMenuIDs.length;i++)
	  if (id==subMenuIDs[i]) return true;
	return false;
}
function getAscendingLefts(elem){
	if (elem==null)
		return 0;
	else
	{
		if ((elem.style.position=='absolute' || elem.style.position=='relative') && !IsSubMenu(elem.id)) return 0;
		return elem.offsetLeft+getAscendingLefts(elem.offsetParent);
	}
}
function getAscendingTops(elem){
	if (elem==null)
		return 0;
	else {
		if ((elem.style.position=='absolute' || elem.style.position=='relative') && !IsSubMenu(elem.id)) return 0;
		return elem.offsetTop+getAscendingTops(elem.offsetParent);
	}
}
//Region Fade Functions
function doTick(menuID){
	if (clockValue>=MenuFadeDelays[menuID]){
		stopTick();
		closeSubMenus(document.getElementById(menuID));
	} else {
		clockValue++;
		ticker=setTimeout("doTick('"+menuID+"');", 500);
	}
}
function stopTick(){
	clockValue=0;
	clearTimeout(ticker);
}
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		images[i]=new Image();
		images[i].src=preloadimages.arguments[i];
	}
}
function setimage(elem,imageSource){
	var i=elem.getElementsByTagName("img")[0];
	i.src=imageSource;
}
//--><!--
//Region Global Variables
var SelectedMenuStyleInfos=new Object();
var UnselectedMenuStyleInfos=new Object();
var MenuFadeDelays=new Object();
var clockValue=0;
var ticker;
var highlightTopMenus=new Object();
var images=new Array();
var OpenMenuItems = new Array();
//EndRegion
//Region Methods to hook up a menu to the global variables
function registerMenu(menuID, selectedStyleInfo, unselectedStyleInfo, menuFadeDelay, highlightTopMenu){
	SelectedMenuStyleInfos[menuID]=selectedStyleInfo;
	UnselectedMenuStyleInfos[menuID]=unselectedStyleInfo;
	MenuFadeDelays[menuID]=menuFadeDelay;
	highlightTopMenus[menuID]=highlightTopMenu;
}
//Region The methods and contructor of the styleInfo object.
function applyStyleInfoToElement(element){
	element.style.backgroundColor=this.backgroundColor;
	element.style.borderColor=this.borderColor;
	element.style.borderStyle=this.borderStyle;
	element.style.borderWidth=this.borderWidth;
	element.style.color=this.color;
	if (this.fontFamily!='')
		element.style.fontFamily=this.fontFamily;
	element.style.fontSize=this.fontSize;
	element.style.fontStyle=this.fontStyle;
	element.style.fontWeight=this.fontWeight;
	if (this.className!='')
		element.style.className=this.className;
}
function styleInfo(backgroundColor,borderColor,borderStyle,borderWidth,color,fontFamily,fontSize,fontStyle,fontWeight,className){
	this.backgroundColor=backgroundColor;
	this.borderColor=borderColor;
	this.borderStyle=borderStyle;
	this.borderWidth=borderWidth;
	this.color=color;
	this.fontFamily=fontFamily;
	this.fontSize=fontSize;
	this.fontStyle=fontStyle;
	this.fontWeight=fontWeight;
	this.className=className;
	this.applyToElement=applyStyleInfoToElement;
}
//Region MouseEventHandlers
function mousedOverMenu(menuID,elem,parent,displayedVertically,imageSource){
	stopTick();
	closeSubMenus(elem);
	var childID=elem.id+"-subMenu";  // Display child menu if needed
	if (document.getElementById(childID)!=null){  // make the child menu visible and specify that its position is specified in absolute coordinates
		document.getElementById(childID).style.display='block';
		document.getElementById(childID).style.position='absolute';
		OpenMenuItems = OpenMenuItems.concat(childID);
		if (displayedVertically){ // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=getAscendingLefts(parent)+parent.offsetWidth;
			document.getElementById(childID).style.top=getAscendingTops(elem);
			var visibleWidth=parseInt(window.outerWidth?window.outerWidth-9:document.body.clientWidth,10);
			if ((parseInt(document.getElementById(childID).offsetLeft,10)+parseInt(document.getElementById(childID).offsetWidth,10))>visibleWidth) {
				document.getElementById(childID).style.left=visibleWidth-parseInt(document.getElementById(childID).offsetWidth,10);
			}
		}else{  // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=getAscendingLefts(elem);
			document.getElementById(childID).style.top=getAscendingTops(parent)+parent.offsetHeight;
			if (document.getElementById(childID).offsetWidth<elem.offsetWidth)
				document.getElementById(childID).style.width=elem.offsetWidth;
		}
	}
	if (SelectedMenuStyleInfos[menuID] != null) SelectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverClickToOpen(menuID,elem,parent,imageSource){
	stopTick();
	if (SelectedMenuStyleInfos[menuID] != null) SelectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverSpacer(menuID,elem,parent){
	stopTick();
}
function mousedOutMenu(menuID,elem,imageSource){
	doTick(menuID);
	if (UnselectedMenuStyleInfos[menuID] != null) UnselectedMenuStyleInfos[menuID].applyToElement(elem);
	if (highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			UnselectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOutSpacer(menuID, elem){
	doTick(menuID);
}
//Region Utility Functions
function closeSubMenus(parent){
	if (OpenMenuItems == "undefined") return;
	for (var i=OpenMenuItems.length-1; i>-1;i--) {
		if (parent.id.indexOf(OpenMenuItems[i]) != 0) {
			document.getElementById(OpenMenuItems[i]).style.display = 'none';
			shimSetVisibility(false, OpenMenuItems[i]);			
			OpenMenuItems = new Array().concat(OpenMenuItems.slice(0,i), OpenMenuItems.slice(i+1));
  		} 
	}
}
function shimSetVisibility(makevisible, tableid){
	var tblRef=document.getElementById(tableid);
	var IfrRef=document.getElementById('shim'+tableid);
	if (tblRef!=null && IfrRef!=null){
		if(makevisible){
			IfrRef.style.width=tblRef.offsetWidth;
			IfrRef.style.height=tblRef.offsetHeight;
			IfrRef.style.top=tblRef.style.top;
			IfrRef.style.left=tblRef.style.left;
			IfrRef.style.zIndex=tblRef.style.zIndex-1;
			IfrRef.style.display="block";
		}else{
			IfrRef.style.display="none";
		}
	}
}
function IsSubMenu(id){
	if (subMenuIDs == "undefined") return false;
	for (var i=0;i<subMenuIDs.length;i++)
	  if (id==subMenuIDs[i]) return true;
	return false;
}
function getAscendingLefts(elem){
	if (elem==null)
		return 0;
	else
	{
		if ((elem.style.position=='absolute' || elem.style.position=='relative') && !IsSubMenu(elem.id)) return 0;
		return elem.offsetLeft+getAscendingLefts(elem.offsetParent);
	}
}
function getAscendingTops(elem){
	if (elem==null)
		return 0;
	else {
		if ((elem.style.position=='absolute' || elem.style.position=='relative') && !IsSubMenu(elem.id)) return 0;
		return elem.offsetTop+getAscendingTops(elem.offsetParent);
	}
}
//Region Fade Functions
function doTick(menuID){
	if (clockValue>=MenuFadeDelays[menuID]){
		stopTick();
		closeSubMenus(document.getElementById(menuID));
	} else {
		clockValue++;
		ticker=setTimeout("doTick('"+menuID+"');", 500);
	}
}
function stopTick(){
	clockValue=0;
	clearTimeout(ticker);
}
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		images[i]=new Image();
		images[i].src=preloadimages.arguments[i];
	}
}
function setimage(elem,imageSource){
	var i=elem.getElementsByTagName("img")[0];
	i.src=imageSource;
}
//-->