/* Page Functions */
	
function init() {
   	// the following script adjusts the height of the cdlapage div so that 
	// the library footer include always appears below the page content,
	// which because of the header, is absolutely positioned.
	
	// get offsetHeights of the rightcontent, rightcolumn, and leftcolumn divs
	var contenth = document.getElementById('rightcontent').offsetHeight;
	
	if(document.getElementById('rightheader')){
	var headerh = document.getElementById('rightheader').offsetHeight;
	}
	else{
	var headerh = document.getElementById('rightheader_subpage').offsetHeight;	
	}
	var lefth = document.getElementById('leftcolumn').offsetHeight;
	// get the cdlapage div
	var cdlapage = document.getElementById('cdlapage');
	// set the new height
	var newheight = contenth + headerh + 70 + "px";
	// change the height of the cdlapage div accordingly
	cdlapage.style.height = newheight;
	
	
	// the following makes every link with the attribute-value pair "rel='external'" open in a new window.
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
	anchor.target = "_blank";
	}
	// the following sizes the slideshow div according to the width of the rightcontent div
	// this solves a problem with the slideshow sizing without regard to the right scroll bar.
	function adjustshowsize() {
	var rightw = document.getElementById('rightcontent').offsetWidth;
	document.getElementById('rightheader').style.width = rightw;
	}

	// check to see if the div containing the slideshow is present
	// if it is, call the function above
	if(document.getElementById('rightheader')){
			adjustshowsize();
	}
	
	// reload the window with the newly-sized slideshow div onresize
	// check to see if window really has resized, based on its width
	// (this is an IE bug fix; IE continues to fire onresize event in an infinite loop otherwise)
	var currentwidth = document.documentElement.clientWidth;
	window.onresize = function(){
		if(currentwidth != document.documentElement.clientWidth)
		{
		window.location.href=window.location.href;
		}
		currentwidth = document.documentElement.clientWidth;
	}
		
}

window.onload = init;	


function slidetarget(url) {
	var newViewport = window.open(url,'_blank');
	return false;	
}

$(document).ready(function() {
// color every other row of contact tables
$("tr:nth-child(odd)").addClass("odd");	

// hide email addresses from bot harvesting
$(".mail").each(function(i, elt) {
	var content = $(elt).html();
	content = content.replace(/\sdot\s/g, ".");
	content = content.replace(/(\S+)\sat\s(.+)/, "<a href=\'mailto:$1@$2\'>$1@$2</a>");
	$(elt).html(content);
});

// add print link to content header
$('div#printlink').append("<a href='#print'>print this page</a>");
$('div#printlink a').click(function() {
	window.print();
	return false;
});
});
	
	

