var isIE4 = document.all ? 1 : 0;
var isW3C = document.getElementById ? 1 : 0;
var isIE6 = document.documentElement  && document.documentElement.clientHeight ? 1 : 0;  <!-- for explorer on PC window height -->
var timerID;

function showNavRoll(pixleft,pixtop,pixwide,targetURL){
	if (isIE6) {
		//do nothing -- it doesn't work
	} else if (isIE4) {
		eval("document.all.rollover.style.visibility = 'visible'");
		eval("document.all.rollover.style.left = '" + pixleft + "px'");
		eval("document.all.rollover.style.top = '" + pixtop + "px'");
		eval("document.images['highlighter'].width = '" + pixwide + "'");
		eval("document.getElementsByName('highlink').href = '" + targetURL + "'");
		//eval("document.anchors['highlink'].href = '" + targetURL + "'");
	} else {
		eval("document.getElementById('rollover').style.visibility = 'visible'");
		eval("document.getElementById('rollover').style.left = '" + pixleft + "px'");
		eval("document.getElementById('rollover').style.top = '" + pixtop + "px'");
		eval("document.images['highlighter'].width = '" + pixwide + "'");
		eval("document.anchors['highlink'].href = '" + targetURL + "'");
	}
}
function hideNavRoll(){
	if (isIE4) {
		eval("document.all.rollover.style.visibility = 'hidden'");
	} else {
		eval("document.getElementById('rollover').style.visibility = 'hidden'");
	}
}

function showContents(){
	clearTimeout(timerID);
	if (isIE4) {
		eval("document.all.contents_menu.style.visibility = 'visible'");
		//eval("document.all.contents_menu3.style.visibility = 'visible'");
	} else {
		eval("document.getElementById('contents_menu').style.visibility = 'visible'");
	}
}

function hideContents(){
	timerID = setTimeout('hideContents2()',300)
}

function hideContents2(){
	clearTimeout(timerID);
	if (isIE4) {
		eval("document.all.contents_menu.style.visibility = 'hidden'");
		//eval("document.all.contents_menu3.style.visibility = 'hidden'");
	} else {
		eval("document.getElementById('contents_menu').style.visibility = 'hidden'");
	}
}

function makeIFrame(pagename,thestring){
	if (isIE6) {
		setHeight = document.documentElement.clientHeight - 176;
	} else if (isIE4) {
		setHeight = document.body.clientHeight - 176;
	} else {
		setHeight = window.innerHeight - 176;
	}
	//alert(thestring);
	if (thestring=='eventemail') {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='calendar/pdf/emailservices.htm' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring=='podcast') {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='http://ris-systech2.its.yale.edu/whc/podcasts.asp' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring=='franke') {
	document.write("<IFRAME id='calendar_frame' name='calendar_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='calendar/pdf/Franke.htm' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring=='tanner') {
	document.write("<IFRAME id='calendar_frame' name='calendar_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='calendar/pdf/tanner.htm' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring=='shulman') {
	document.write("<IFRAME id='calendar_frame' name='calendar_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='calendar/pdf/shulman.htm' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring=='finzi-contini') {
	document.write("<IFRAME id='calendar_frame' name='calendar_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='calendar/pdf/finzi-contini.htm' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else if (thestring==undefined||thestring=='') {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='"+pagename+"_content.html' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='"+pagename+"_content.html' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	}
}

function makeIFrameAnchor(pagename,anchorname){
	if (isIE6) {
		setHeight = document.documentElement.clientHeight - 176;
	} else if (isIE4) {
		setHeight = document.body.clientHeight - 176;
	} else {
		setHeight = window.innerHeight - 176;
	}
	if (anchorname!='undefined') {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='"+pagename+"_content.html#" + anchorname + "' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	} else {
	document.write("<IFRAME id='"+pagename+"_frame' name='"+pagename+"_frame' style='position:absolute; height:"+setHeight+"px; left:314px; top:166px; z-index:6;' src='"+pagename+"_content.html' scrolling='auto' width='556px' frameborder='0'></IFRAME>");
	}
}

function printwindow(thepage){
makeNewPrintWindow(thepage);}
var newPrintWindow = null;
function makeNewPrintWindow(thepage) {
	var theParams = "width=600,height=600,"
	theParams += "toolbar=yes,scrollbars=yes,status=yes,location=no,resizable=yes,menubar=yes"
	var windowName = "Popup"
	//exception for podcast page, to avoid permissions error
	if (thepage=='podcast') {
		theLocation = "http://ris-systech2.its.yale.edu/whc/podcasts.asp";
	} else {
		theLocation = eval(thepage+"_frame.location.href");
	}
	//alert(theLocation);
	newPrintWindow = window.open("",windowName,theParams);
	if (newPrintWindow != null) {
		newPrintWindow.location = theLocation;
		newPrintWindow.focus;
	}
}

function makePrintButton(thepage){
	document.write('<a href="javascript:printwindow(&quot;'+thepage+'&quot;)"><img src="images/printbuttons/'+thepage+'_print.gif" alt="Print Version" width="106" height="19" border="0" /></a>');
}

function showMap(mapname){
	if (isIE4) {
		eval("document.all."+mapname+".style.visibility = 'visible'");
	} else {
		eval("document.getElementById('"+mapname+"').style.visibility = 'visible'");
	}
}

function hideMap(mapname){
	if (isIE4) {
		eval("document.all."+mapname+".style.visibility = 'hidden'");
	} else {
		eval("document.getElementById('"+mapname+"').style.visibility = 'hidden'");
	}
}
