/*
 * Template Javascript
 */

$(document).ready(function(){ 
	
// CSS site enhancements

        // Set the print stylesheet as needed

        setPrintStyleSheet();

}); /* //$(document).ready */

// Other things required by uva bar, templates


// Functions to switch the stylesheet and make a print version popup
// Updated on 8/2/07

// Switch the active screen stylesheet, standard
 function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
   if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
    a.disabled = true;
    if(a.getAttribute("title") == title) a.disabled = false;
   }
  }
 }


// Check the querystring for ?print=1 and set the stylesheet
function setPrintStyleSheet() {
	href = window.location.href.split("?")[0];
	args = window.location.href.split("?")[1];
	if(args && args.search(/print=1/) != -1) {setActiveStyleSheet('Print');
		setTimeout('window.print()',1000);}		
	else {setActiveStyleSheet('Web');}
	return false;
}
// Popup a new window with the current href + ?print=1 ap
function printVersion() {
	href = window.location.href + '?print=1';
	//window.open(href, 'print');
	window.open(href,'print','scrollbars=yes,resizable=yes,width=960,height=686,right=100,top=100');
}


