/*
 * created: 08132002 - Johnny Withers
 */
/* Browser Width/Height */
var winWidth;
var winHeight;
var IsIe = false;

function GetWindowSize() {
 	var myWidth = 0, myHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		// alert("GetWindowSize case 1 (non-IE)")
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight){
		//IE 6+ in 'standards compliant mode'
		// alert("GetWindowSize case 2 (IE 6+)")
		myWidth = parseInt(document.documentElement.offsetWidth,10);
		myHeight = iHeight = parseInt(document.documentElement.offsetHeight,10);
		IsIe = true;
	} else if(document.body){
		//IE 4 compatible
		// alert("GetWindowSize case 3 (IE4 compatible)")
		myWidth = parseInt(document.body.offsetWidth,10);
		myHeight = parseInt(document.body.offsetHeight,10);
		IsIe = true;
	}
	// window.alert( 'Width = ' + myWidth );
	// window.alert( 'Height = ' + myHeight );
	winWidth = myWidth;
	winHeight = myHeight;
}

function SetFooterPos() {
	var oFooter = document.getElementById('Footer');
	var oHeader = document.getElementById('WebNav_Header');
	var oLeftCol = document.getElementById('LeftCol');
	var oLeftColNav = document.getElementById('LeftColNav');
	var oMainCol = document.getElementById('MainCol');
	var oLeftNavList = document.getElementById('LeftNavList');
	var DefHeight = 590;
	var HeaderHeight = oHeader.clientHeight;
	var FooterHeight = oFooter.clientHeight;
	var MainColHeight = oMainCol.clientHeight;
	var LeftColHeight = oLeftCol.clientHeight;
	var OffSet = HeaderHeight + FooterHeight;
	var ContentAreaHeight = winHeight - OffSet;
	var LeftNavListHeight = oLeftNavList.clientHeight;
	if (LeftNavListHeight == 0) { //For some reason, some versions of IE won't return the height of the <ol> element here
		LeftNavListHeight = oLeftCol.clientHeight;
	} else {
		LeftNavListHeight += 65; //Allow for the extra space in the left column title area.
	}
	
	//alert(MainColHeight + " - " + ContentAreaHeight + " - " + DefHeight + " - " + LeftNavListHeight);
	var finalHeight = Math.max(DefHeight,Math.max(LeftNavListHeight,MainColHeight))
	//alert("Final Height = " + finalHeight)
	oLeftCol.style.height = finalHeight + 'px';
	oLeftColNav.style.height = finalHeight + 'px';
	oMainCol.style.height = finalHeight + 'px';
	//if(LeftNavListHeight>ContentAreaHeight) {
	//	alert("SetFooterPos case 1 - LeftNavListHeight > ContentAreaHeight")
	//	oLeftCol.style.height = LeftNavListHeight + 65 + 'px';
	//	oLeftColNav.style.height = LeftNavListHeight + 65 + 'px';
	//} else if(DefHeight<ContentAreaHeight) {
	//	alert("SetFooterPos case 2 - content < default height")
	//	oLeftCol.style.height = ContentAreaHeight + 'px';
	//	if(!IsIe && LeftNavListHeight>ContentAreaHeight) {
	//		oLeftCol.style.height = LeftNavListHeight + 65 + 'px';
	//		oLeftColNav.style.height = LeftNavListHeight + 65 + 'px';
	//	} else if(MainColHeight>DefHeight) {
	//		if(MainColHeight>ContentAreaHeight) {
	//			oLeftCol.style.height = MainColHeight + 'px';
	//			oLeftColNav.style.height = MainColHeight + 'px';
	//		} else {
	//			oLeftCol.style.height = ContentAreaHeight + 'px';
	//			oLeftColNav.style.height = ContentAreaHeight + 'px';
	//		}
	//	}
	//}
	//if(MainColHeight>ContentAreaHeight) {
	//	alert("SetFooterPos case 3 - MainColHeight > ContentAreaHeight")
	//	oLeftCol.style.height = MainColHeight + 'px';
	//	oLeftColNav.style.height = MainColHeight + 'px';
	//	oMainCol.style.height = MainColHeight + 'px';
	//}
	oLeftCol.style.display = 'block';
	oMainCol.style.display = 'block';
}

/*
function SetSideBoxPos() {
	var BoxWidth;
	var SideBox = document.getElementById("SideBox")
	
	if(SideBox) {	
		BoxWidth = SideBox.offsetWidth;
		SideBox.style.left = winWidth - BoxWidth + 'px';
		alert(SideBox.style.left);
	}
}
*/

/* Preload Mouseovers */
function Init() {
	PreloadImages();
	GetWindowSize();
	SetFooterPos();
	//SetSideBoxPos();
	
	//Set handlers for window/mouse events
	window.onblur = register;
	window.oncontextmenu = register;
	window.onerror = register;
	window.onfocus = register;
	window.onscroll = register;
	window.onresize = register;
	window.onclick = register;
	window.onmousedown = register;
	window.onmouseup = register;
	//register(window.event);
	// alert("Init Run - IsIE = " + IsIe)
}
function Resized() {
	// alert("Resized")
	GetWindowSize();
	SetFooterPos();
}

function register(e) {
	if(!e) e = window.event;
	if(e.type=='resize') {
		Resized();
	}
}

function PreloadImages() {
	MM_preloadImages('../../images/navigation/home_on.gif','../../images/navigation/home_sm_on.gif','../../images/navigation/about_on.gif','../../images/navigation/programs_on.gif','../../images/navigation/divisions_on.gif','../../images/navigation/press_room_on.gif','../../images/navigation/events_on.gif','../../images/navigation/careers_on.gif','../../images/navigation/resources_on.gif','../../images/navigation/contact_on.gif','../../images/navigation/links_on.gif','../../images/navigation/faq_on.gif','../../images/navigation/faq_off.gif');
}

/* Dreamweaver Functions */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}