



//-----Begin Browser-----------------
function Browser() {
	var b=navigator.appName;
	if (b=="Netscape") this.b="ns";
	else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
	else if (b=="Microsoft Internet Explorer") this.b="ie";
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns" && this.v>=4);
	this.ns4=(this.b=="ns" && this.v==4);
	//this.ns6=(this.b=="ns" && this.v==5);
	this.ie=(this.b=="ie" && this.v>=4);
	this.ie4=(this.version.indexOf('MSIE 4')>0);
	this.ie5=(this.version.indexOf('MSIE 5')>0);
	this.ie55=(this.version.indexOf('MSIE 5.5')>0);
	this.ie6up = ((navigator.appVersion.indexOf("MSIE 6")!=-1)||(navigator.appVersion.indexOf("MSIE 7")!=-1));
	this.opera=(this.b=="opera");
	var ua=navigator.userAgent.toLowerCase();
	this.mac = (ua.indexOf("mac")!=-1);
}
//-----End Browser-----------------
var is = new Browser();  // this object is essentially global,static. 

function placeFooter() {
	var footer =document.getElementById("footer");
	var leftNav = document.getElementById("leftNav");
	var content = document.getElementById("content");
	
	footer.style.top = Math.max(leftNav.offsetTop + leftNav.offsetHeight,content.offsetTop + content.offsetHeight-200);

}
function init() {	
	cacheImages();
	placeFooter();
}
window.onresize = placeFooter;
window.onload=init;




function popup(url,w,h,target,windowOptions) {
	if ((!target)||(target=="")) target="_blank";
	if ((!windowOptions)||(windowOptions==""))  windowOptions= 'scrollbars,titlebar,resizable';
	popupWin = window.open(url,target,'width='+w+',height='+h+','+windowOptions);
	setTimeout("popupWin.focus();",250);
}


//  IMAGE CACHEING AND CREATION OF ROLLOVERS 
var imCache = new Array();
function cacheImages() {
	// one useful assumption:  the index of an image within the page will not change during the page's lifetime.  ie no new images will be created in the Dom.  so if you actually start doing this type of stuff, expect to see bugs with this script. 
	if (!is.ns4) {
		var index = 0;
		for (i=0; i<document.images.length; i++) {
			var im = document.images[i];
			if (im.getAttribute("overimage")) {
				imCache[++index] = new Array(2);
				imCache[index]["over"] = new Image(); 
				imCache[index]["over"].src = im.getAttribute('overimage')
				imCache[index]["off"] = new Image(); 
				// since this is only run onload, we can assume that the src at runtime will be the src as specified in the html
				imCache[index]["off"].src = im.getAttribute("src");

				eval("im.onmouseover = function() {this.src =imCache["+index+"]['over'].src;}");
				eval("im.onmouseout = function() {this.src =imCache["+index+"]['off'].src;}");
			}
		}
	}
}


// function that can be explicitly called from <input type="image"> objects.  (Since these do not appear in the images array, they cant be taken care of with cacheImages.   If the input element has onload="setupButtonRollover(this)", and also has both overimage and offimage attributes, a rollover will be setup on it. 
function setupButtonRollover(elt) {
	if (elt.getAttribute("overimage") && elt.getAttribute("offimage")) {			
		eval("elt.onmouseover = function() {elt.src ='"+elt.getAttribute('overimage')+"'}");
		eval("elt.onmouseout = function() {elt.src ='"+elt.getAttribute('offimage')+"'}");
	}
}


/* legacy popup window code */
var agt = navigator.userAgent.toLowerCase(); 

if ((agt.indexOf("msie") != -1) && (agt.indexOf("mac") == -1)) {
	var newwindow;
}

function preferred() {
	if ((agt.indexOf("msie") != -1) && (agt.indexOf("mac") == -1)) {
		if (newwindow != null) { newwindow.close(); }
	}
	newwindow=window.open('/email_updates/step_1.cfm','popup',config='height=500,width=475,directories=no,status=no,status=yes,scrollbars=yes,resizable=no,menubar=no');
    newwindow.moveTo( (screen.availWidth-600)/2, (screen.availHeight-600)/2 );
	newwindow.focus();
}
function showDirections(){
	window.open("/directions.cfm","","toolbar=no,scrollbars=no,width=400,height=600,resizable=no");
}

