
if(!window.CDA) {
	CDA=new Object();
} // end if

if(!window.CDA.Page) {
	CDA.Page=new Object();
} // end if

	CDA.loadPage = function(id, globalnav, secondnav) {		
		CDA.Page = new Page(id,globalnav,secondnav);
	} // end static method
	
Page = function(id, globalnav, secondnav) {
	this.id = id;
	this.images = new Array();
	
	this.images["logo"] = new Image(); this.images["logo"].src = "images/logo.jpg";	
	this.images["loading"] = new Image(); this.images["loading"].src = "images/loading.gif";	
	this.images["arrowRed"] = new Image(); this.images["arrowRed"].src = "images/arrowRed.gif";
	this.images["tileMedBlue"] = new Image(); this.images["tileMedBlue"].src = "images/tileMedBlue.gif";
	this.images["tileLightBlue"] = new Image(); this.images["tileLightBlue"].src = "images/tileLightBlue.gif";
	this.images["tileRollover"] = new Image(); this.images["tileRollover"].src = "images/tileRollover.gif"
	this.images["popupTile"] = new Image(); this.images["popupTile"].src = "images/popupTile.gif"	
	
	// Handle default selected navs
	this.globalnav = CDA.find(globalnav);
	this.secondnav = CDA.find(secondnav);

	if (globalnav!=null) { this.toggleNav("global", "On", this.globalnav);	} // end if	
	if (secondnav!=null) { this.toggleNav("secondary", "On", this.secondnav);	} // end if

} // end object

	Page.prototype.resizeBody = function() {
		var tblMain = CDA.find("tblMain");
		var contentArea = CDA.find("divContentArea");
		var tdContentBody = CDA.find("tdContentBody");
		var minHeight = (isFireFox() ? 170 : 170);  // deductable space to fit footer in.
		var corner = CDA.findBottom(contentArea);
		var contentHeight = corner -(CDA.findTop(contentArea) - CDA.findTop(tblMain));	
		contentArea.style.height="auto";
		if (contentHeight<=minHeight) {
			contentHeight=minHeight;
			contentArea.style.height=contentHeight+"px";			
		} // end if
			
		tblMain.style.height = contentHeight+"px";	
		CDA.find("tblCentered").style.height = contentHeight+"px";
		tdContentBody.style.height = tblMain.style.height;

	} // end method

	Page.prototype.toggleNav = function(whichnav, state, currentLnk) {
		if (whichnav=="global") {		
			// Get selected global nav underline Td
			var navUnderline = document.getElementById("tdGNavLine" + getLastChar(currentLnk.id));
			var tdContainer = document.getElementById("tdGNav"+getLastChar(currentLnk.id));
		
			if (state=="On") {		
				//currentTd.style.cursor="pointer";	
				tdContainer.className = "gNavOn";	
				navUnderline.style.backgroundColor="#990000";	

			} else if (state=="Off") {
				if (this.globalnav!=null) {
					if (currentLnk.id!=this.globalnav.id) {
						tdContainer.className = "gNavOff";	
						navUnderline.style.backgroundColor="";
					} // end if	
				} else {
					tdContainer.className = "gNavOff";	
					navUnderline.style.backgroundColor="";
				} // end if
			} // end if			
			
		} else if(whichnav=="secondary"){			
			// Get selected global nav underline Td		
			 var anchorArrow,arrow;
			// get all LIs in imagelist, loop over them 	
		
			arrow=CDA.find(currentLnk.getAttribute("linkedElementId"));

			if (state=="On") {		
				// show arrow on left
				arrow.src = this.images["arrowRed"].src;
				// change link color to red
				currentLnk.style.color = "#990000";
					
			} else if (state=="Off") {
				
				if (this.secondnav!=null) {					
					if (currentLnk.id!=this.secondnav.id) {
						// hide arrow
						arrow.src = "images/spacer.gif";
						// change link color to red
						currentLnk.style.color = "#333366";
					} // end if	
				} else {
					// hide arrow
					arrow.src = "images/spacer.gif";
					// change link color to red
					currentLnk.style.color = "#333366";
				} // end if
			} // end if
		} // end if
	} // end function


Screen = function(id, bgcolor, cssClass) {
	this.id = id;
	this.bgcolor = bgcolor;
	this.cssClass = cssClass; // 0 value equals transparent
	
	var topDiv = CDA.Html.makeDiv("&nbsp;", this.id);
	topDiv.className = (this.cssClass) ? this.cssClass : null;
	topDiv.style.backgroundColor = this.bgcolor;
	topDiv.style.position = "absolute";
	topDiv.style.top = "0px";
	topDiv.style.left = "0px";
	topDiv.style.width = "100%";
	topDiv.style.height = "100%";
	topDiv.style.visibility = "visible";
	topDiv.style.zIndex = "999";
				
	this.elem = topDiv; // so that it can be removed later

} // end object

	Screen.prototype.show = function() {		
		document.getElementsByTagName("body")[0].appendChild(this.elem);
	} // end method 

	Screen.prototype.hide = function() {
		document.getElementsByTagName("body")[0].removeChild(this.elem);
	} // end method


LoadScreen.prototype = new Screen();
LoadScreen.prototype.constructor = LoadScreen;
function LoadScreen() {
} // end object

	LoadScreen.prototype.show = function() {
		var html;
		html = "<div id='divInitialLoad' "
				+ "style='z-index:999;background-color:silver;position:absolute;top:0px;left:0px;width:100%;height:100%;visibility:visible;' "
				+ ">&nbsp;</div>";
		document.write(html);		
	} // end method 

	LoadScreen.prototype.hide = function() {
		document.getElementById("divInitialLoad").style.visibility="hidden";	
	} // end method
