// Rollovers
var imgPath = "../img/";
var btnActive = "";

		
function rollOver(btnName){
  document[btnName].src = imgPath + btnName +'_a.gif'; // Set the rollover image
}

function rollOut(btnName){
	if ( btnName != btnActive )
	{
		document[btnName].src = imgPath + btnName +'.gif'; // Set the rollout/default image
	}
}

function rollOverJPG(btnName){
  document[btnName].src = 'img/' + btnName +'_a.jpg'; // Set the rollover image
}

function rollOutJPG(btnName){
	if ( btnName != btnActive )
	{
		document[btnName].src = 'img/' + btnName +'.jpg'; // Set the rollout/default image
	}
}

function setupScripts(sentPath)
{
	//The path where the roll over images can be found:
	//imgPath = sentPath;
  
	//Makes the last menu pressed light up:
	if(lastNav != "" && document[lastNav])
	{
		rollOver(lastNav);
		btnActive = lastNav;
	}

}

// Show link status text
function setStatus(what){
	window.status=what;
	return true;
}

function FooterPopup(URL){
	var left, top, sWidth, sHeight, pWidth, pHeight, winName;
	
	pWidth = 610;
	pHeight = 400;
	left = (screen.width / 2) - (610 / 2);
	top = (screen.height / 2) - (400 / 2);
	winName = 'FooterPopup'+ Math.random();
	
	window.open(URL, winName, 'width=610,height=400,left='+ left +',top='+ top +',scrollbars=yes');
}

function placeFooter(arrOtherDivs, offsetDivs){

	// First we need to find the screen height
	var clientHeight = 0; var copyHeight = 0; var contentHeight = 0; var leftNavHeight = 0;
	
	// IE 6 in standards compliant mode will normally return the height of the document (NOT window)
	if( typeof( window.innerWidth ) == 'number' ) {
		// FireFox, Mozilla, etc.
		clientHeight = window.innerHeight;
	}else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		clientHeight = document.documentElement.clientHeight;
	}else if( document.body && (document.body.clientWidth || document.body.clientHeight)){
		//IE 4 compatible
		clientHeight = document.body.clientHeight;
	}
	
	// Get the height of content and copyright DIVs
	var copy = getObjRef('Footer'); var content = getObjRef('Content'); var leftNav = getObjRef('LeftNav'); var newTop = 0;
	contentHeight = content.offsetHeight;
	copyHeight = copy.offsetHeight;
	leftNavHeight = leftNav.offsetHeight;
	 
	// MULTIPLE DIVs ON PAGE
	if(typeof(arrOtherDivs)=='object'){
		// Repeat through the other DIVs
		var maxH = 0;
		for(var i=0; i<arrOtherDivs.length; i++){
			var obj = getObjRef(arrOtherDivs[i]);
			if(obj.style.visibility=='visible'){		// ONLY LOOK AT VISIBLE DIVs
				var h = obj.offsetHeight + obj.offsetTop;
				if(h>maxH){ maxH = h; }
			}
		}
		if(maxH>contentHeight){ contentHeight = maxH; }
	}
	
	if(typeof(offsetDivs)=='object'){
		// Repeat through the other DIVs
		var vOffset = 0;
		for(var i=0; i<offsetDivs.length; i++){
			var obj = getObjRef(offsetDivs[i]);
			vOffset += obj.offsetHeight;
		}
	}
	
	// Now we can place the Footer DIV
	if(contentHeight>(clientHeight-copyHeight)){
		newTop = contentHeight;
	}else{
		newTop = clientHeight-copyHeight;
	}
	
	newTop += vOffset;
	
	// Make sure it goes below the LEFT NAV
	if(newTop < (leftNavHeight + vOffset)){ 
		newTop = leftNavHeight + vOffset + 15;
	}
	copy.style.top = newTop +'px';
}

function placeFooter_MainPages(){
	
	// Get the height of content and copyright DIVs
	var copy = getObjRef('Footer'); var content = getObjRef('MainNavBtns_Content');
	contentHeight = content.offsetHeight;
	copyHeight = copy.offsetHeight;
	
	var myTop = contentHeight + 305;
	copy.style.top = myTop + 'px';
}

function  placeWaterMark(){
	
	var myHeight = 321;
	var water = getObjRef('WaterMark'); var foot = getObjRef('Footer');
	
	var footStr = foot.style.top;
	var footTop = parseInt(footStr.substring(0, footStr.indexOf('px')));
	var myTop = footTop - myHeight;
	water.style.top = myTop +'px';
}

function getObjRef(id){
	if(document.getElementById)
		return(document.getElementById(id));			// FireFox/Mozilla/Netscape 6+ (also IE 6+ running in W3 compliant mode)
	else if(document.all)
		return(document.all[id]);							// IE 6+ (in non W3 compliant mode (that's normal mode for IE)) + PRE IE 6
}

/* Popup */
function popUp(URL, name, w, h) {
	eval("page" + name + " = window.open(URL, '" + name + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + w + ', height=' + h + ',left = 200,top = 60');");
}

/*	*****************************
	DISABLE THE RIGHT MOUSE CLICK
	*****************************	*/

/*
var message="Right click has been disabled";

function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
}else if (document.all&&!document.getElementById){
	document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false;")

*/