initNavIE = function() {
	if (document.all && document.getElementById) {
		nav_root = document.getElementById("nav").firstChild;
		for (i = 0; i < nav_root.childNodes.length; i++) {
			node = nav_root.childNodes[i];
			if (node.id && node.id.indexOf("nav_") != -1) {
				node.onmouseover = function() {
					this.className += " over";
					// hack for IE6 and the page_top select
					if (this.id == "nav_about") if (pt = document.getElementById("page_top")) pt.style.visibility = "hidden";
				}
				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
					// hack for IE6 and the page_top select
					if (this.id == "nav_about") if (pt = document.getElementById("page_top")) pt.style.visibility = "visible";
				}
			}
		}
	}
}
window.onload = initNavIE;

function address(which) {
	document.getElementById("addresses").className = "sel_" + which;
}

//font size functions

function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function CE_LoadPageFont() {
	if(Get_Cookie("font_size")) {
		fs = Get_Cookie("font_size");
		document.body.className = "body_" + fs;
		document.getElementById("font_select_container").className = fs;
		
		// IE6 hack
		if (document.all && !window.XMLHttpRequest) {
			CE_FixIE6(fs);
		}
	}
}

function CE_FixIE6(which) {
	document.getElementById("font_select").style.cssText = "background-position:0px 0px";
	document.getElementById("font_select_med").style.cssText = "background-position:0px 0px";
	document.getElementById("font_select_large").style.cssText = "background-position:0px 0px";
	if (which == "") {
		document.getElementById("font_select").style.cssText = "background-position:0px -14px";
	} else {
		document.getElementById("font_select_" + which).style.cssText = "background-position:0px -14px";
	}
}

function CE_SetPageFont(which) {
	var c = "";
	var bc = document.body.className;
	if (bc != "") {
		var classes = bc.split(" ");
		for (var x = 0; x < classes.length; x++) {
			if (classes[x].indexOf("body_") == -1) {
				c += classes[x] + " ";
			}	
		}
	}
	
	if (which != "") {
		c += "body_" + which;
	}

	document.body.className = c;
	document.getElementById("font_select_container").className = which;
	document.getElementById("font_select_container").setAttribute("className", which);

	// IE6 hack
	if (document.all && !window.XMLHttpRequest) {
		CE_FixIE6(which);
	}
	
	var domain = site_webroot.substring(site_webroot.indexOf("http://") + 7, site_webroot.length - 1);
	Set_Cookie("font_size", which, 1, "/", domain, false);
}

//leaving the senate servers so we have to display this message:
//function openWin(urlToOpen) {
//	window.open("http://www.senate.gov/cgi-bin/exitmsg?url=" + urlToOpen);	
//}

function openWin(urlToOpen) {
	window.open(urlToOpen);	
}

//leaving the current site, but staying on senate servers.
function openSenateWin(urlToOpen) {
	window.open(urlToOpen);	
}
