function $(id) {
	return document.getElementById(id);
}

function printPage() {
	//reset left margin
	window.open(
		location.href + ((location.href.indexOf("?") > 0)?"&":"?") + "print=y", 
		"ccmc_print", 
		"width=650,height=450,toolbar=yes,status=yes,toolbar=yes,location=yes,menubar=yes,resizable=yes"
	);
}

function onMouseOverHandler() {
	if ($(this.id + "_image"))
		$(this.id + "_image").src = $(this.id + "_image").src.replace("_off", "_on");
	return true;
}

function onMouseOutHandler() {
	if ($(this.id + "_image"))
		$(this.id + "_image").src = $(this.id + "_image").src.replace("_on", "_off");
	return true;
}

function onResizeHandler() {
	var viewport = [
		YAHOO.util.Dom.getClientWidth(),
		YAHOO.util.Dom.getClientHeight()
	];
	
	//set the size of the leftnav, and left margin of the body, in order to 
	//	have it scale better to full screen.
	var headerH = $('header').offsetHeight;
	var footerH = $('footer').offsetHeight;
	
	var leftWidth = parseInt((viewport[0] - 619)/2)
	if (leftWidth < 145)
		leftWidth = 145;
	
	$("leftnav_wrap").style.width =
	$("inner_wrap").style.marginLeft =
	$("footer").style.marginLeft =
	(leftWidth + "px");

	//Set content height so footer is always at the bottom, even in "short" pages.
	$("inner").style.height = "auto"; //reset content height
	var innerContentH = $('inner').offsetHeight; //get content height
	
	var x = (viewport[1] - 150/*header*/ - footerH - 14/*additional offset*/);
	if (x < innerContentH) x = innerContentH;
	if (x < 380) x = 380; //minmum height needed for proper left side display.
	$("inner").style.height = x + "px";
	$("leftnav").style.height = (x - 100) + "px";
}

function AnimateSubheaderText(brightness) {
	if (brightness < 0) {
		//going white
		var color = "rgb(c,c,c)".replace(/c/g, (255 + brightness));
		$("subheader_title").style.color = color;
		window.setTimeout("AnimateSubheaderText(" + (brightness + 10) + ")", 10);
	} else if (brightness < 255) {
		//scaling in
		$("subheader_title").style.color = "rgb(c,c,c)".replace(/c/g, (255 - brightness))
		window.setTimeout("AnimateSubheaderText(" + (brightness + 2) + ")", 10);
	} else {
		$("subheader_title").style.color = "rgb(0,0,0)";
		return; //done
	}
}

/* Load Events */
function pageBrowserLoad() { /*stub*/ }

function pageLoad() { /*stub*/ }

function siteBrowserLoad() { /*stub*/ }

function siteLoad() {
	//window's onresize handler
	window.onresize = onResizeHandler;
	onResizeHandler();

	//leftnav search and terms mouseover events.
	$("leftnav_search").onmouseover = onMouseOverHandler
	$("leftnav_search").onmouseout = onMouseOutHandler
	$("leftnav_terms").onmouseover = onMouseOverHandler
	$("leftnav_terms").onmouseout = onMouseOutHandler

	siteBrowserLoad();
	pageLoad();
	pageBrowserLoad();
	
	//animate subheader
	if ($("subheader_title"))
		window.setTimeout("AnimateSubheaderText(-255);", 10);
}