﻿<!--
//Region Global Variables
var SelectedNavigationStyleInfos=new Object();
var UnselectedNavigationStyleInfos=new Object();
var NavigationFadeDelays=new Object();
var clockValue=0;
var ticker;
var highlightTopNavigations=new Object();
var images=new Array();
var OpenNavigationItems = new Array();
//EndRegion
//Region Methods to hook up a navigation to the global variables
function registerNavigation(navigationID, selectedStyleInfo, unselectedStyleInfo, navigationFadeDelay, highlightTopNavigation){
	SelectedNavigationStyleInfos[navigationID]=selectedStyleInfo;
	UnselectedNavigationStyleInfos[navigationID]=unselectedStyleInfo;
	NavigationFadeDelays[navigationID]=navigationFadeDelay;
	highlightTopNavigations[navigationID]=highlightTopNavigation;
}
//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 mousedOverNavigation(navigationID,elem,parent,displayedVertically,imageSource){
	stopTick();
	closeSubNavigations(elem);
	var childID=elem.id+"-sn";  // Display child navigation if needed
	if (document.getElementById(childID)!=null){  // make the child navigation visible and specify that its position is specified in absolute coordinates
		document.getElementById(childID).style.display='block';
		document.getElementById(childID).style.position='absolute';
		OpenNavigationItems = OpenNavigationItems.concat(childID);
		if (displayedVertically){ // Set the child navigation's left and top attributes according to the navigation'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 navigation's left and top attributes according to the navigation's offsets
			document.getElementById(childID).style.left=getAscendingLefts(elem);
			document.getElementById(childID).style.top=getAscendingTops(parent)+parent.offsetHeight+2;
			if (document.getElementById(childID).offsetWidth<elem.offsetWidth)
				document.getElementById(childID).style.width=elem.offsetWidth;
		}
	}
	if (SelectedNavigationStyleInfos[navigationID] != null)
	{
		SelectedNavigationStyleInfos[navigationID].applyToElement(elem);
	}
	if (highlightTopNavigations[navigationID]){
		var eId=elem.id+'';
		while (eId.indexOf('-sn')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-sn'));
			SelectedNavigationStyleInfos[navigationID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverClickToOpen(navigationID,elem,parent,imageSource){
	stopTick();
	if (SelectedNavigationStyleInfos[navigationID] != null) SelectedNavigationStyleInfos[navigationID].applyToElement(elem);
	if (highlightTopNavigations[navigationID]){
		var eId=elem.id+'';
		while (eId.indexOf('-sn')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-sn'));
			SelectedNavigationStyleInfos[navigationID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOverSpacer(navigationID,elem,parent){
	stopTick();
}
function mousedOutNavigation(navigationID,elem,imageSource){
	doTick(navigationID);
	if (UnselectedNavigationStyleInfos[navigationID] != null) UnselectedNavigationStyleInfos[navigationID].applyToElement(elem);
	if (highlightTopNavigations[navigationID]){
		var eId=elem.id+'';
		while (eId.indexOf('-sn')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-sn'));
			UnselectedNavigationStyleInfos[navigationID].applyToElement(document.getElementById(eId));
		}
	}
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
}
function mousedOutSpacer(navigationID, elem){
	doTick(navigationID);
}
//Region Utility Functions
function closeSubNavigations(parent){
	if (OpenNavigationItems == "undefined") return;
	for (var i=OpenNavigationItems.length-1; i>-1;i--) {
		if (parent.id.indexOf(OpenNavigationItems[i]) != 0) {
			document.getElementById(OpenNavigationItems[i]).style.display = 'none';
			shimSetVisibility(false, OpenNavigationItems[i]);			
			OpenNavigationItems = new Array().concat(OpenNavigationItems.slice(0,i), OpenNavigationItems.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 IsSubNavigation(id){
	if (subNavigationIDs == "undefined") return false;
	for (var i=0;i<subNavigationIDs.length;i++)
	  if (id==subNavigationIDs[i]) return true;
	return false;
}
function getAscendingLefts(elem){
	if (elem==null)
		return 0;
	else
	{
		if ((elem.style.position=='absolute' || elem.style.position=='relative') && !IsSubNavigation(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') && !IsSubNavigation(elem.id)) return 0;
		return elem.offsetTop+getAscendingTops(elem.offsetParent);
	}
}
//Region Fade Functions
function doTick(navigationID){
	if (clockValue>=NavigationFadeDelays[navigationID]){
		stopTick();
		closeSubNavigations(document.getElementById(navigationID));
	} else {
		clockValue++;
		ticker=setTimeout("doTick('"+navigationID+"');", 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;
}
//used to display the login and download modules
function showMod(ele){
	minus = (ele + "minus");
	plus = (ele + "plus");

	searchOpen(ele,1);
	searchOpen(minus,1);
	searchOpen(plus,0);
}

function hideMod(ele){
	minus = (ele + "minus");
	plus = (ele + "plus");

	searchOpen(ele,0);
	searchOpen(minus,0);
	searchOpen(plus,1);
}

function searchOpen(menunum,state)
{
	value = (state==1) ? "block" : "none" ;
	document.getElementById(menunum).style.display= value;	
}
//used to display the calendar modules
function showCalendar(elemId){
	if(elemId.indexOf('showCalendarButton')>=0)
	{
		elemId=elemId.substring(0, elemId.lastIndexOf('showCalendarButton'));
		elemId=elemId+'RequestDateCalendar';
		value=document.getElementById(elemId).style.display;
		value= (value=="") ? "none" : "";
		document.getElementById(elemId).style.display=value;
	}
}

//used to display the parametric search modules
function showSearchPanel(elemId){
	if(elemId.indexOf('showSearchPanelButton')>=0)
	{
		elemId=elemId.substring(0, elemId.lastIndexOf('showSearchPanelButton'));
		elemId=elemId+'SearchPanel';
		value=document.getElementById(elemId).style.display;
		value= (value=="") ? "none" : "";
		document.getElementById(elemId).style.display=value;
	}
}

//functional to diable the enter key
function disableEnterKey()
{
	if (window.event.keyCode == 13) 
		window.event.keyCode = 0;
}

function ClickButtonOnEnter(btnUniqueID)
{
	if((event.which && event.which == 13) || (event.keyCode && event.keyCode ==13))
	{
		document.all(btnUniqueID).click();
		return false;
	}
	else
	{
		return true;
	}
}
//-->