////////////////////////////////////////////////////////////////////////////////
// MastheadImageRotator.js
// mpeters@medicine.bsd.uchicago.edu
//
// STARTED: WED/JUL/27/2005
//
// REFERENCES:
// http://www.uchicago.edu/
//
// TO USE: Insert lines similar to the ones below into your webpages.
// <SCRIPT language="JavaScript" src="MastheadImageRotator.js" > /* FOR MASTHEAD IMAGE ROTATOR MARKUP */ </script>
// <script language="JavaScript">rotateMastheadImage();</script>
// <noscript><img src="../images/uchosp.jpg" hspace="0" vspace="0" width="178" height="200" border="0"></noscript>

/*
 * MastheadImageRotator
 * Displays random masthead image from a set of images
 */
{ // begin MastheadImageRotator

	var bName = navigator.appName;
	var bVer = parseInt(navigator.appVersion);
	var homeBigImages = new Array();
	var ver = null;
	

	/* 
	 * function init()
	 * Initialize values for homeBigImages[] and homeBigSrc
	 * 
	 */
	function init() {		
		if(bName == "Netscape" && bVer >= 4) {
			ver = 4;
		} // end if

		else if(bName == "Microsoft Internet Explorer" && bVer >= 4) {
			ver = 4;
		} // end else if

		else {
			ver = 0;
		} // end else

		if((navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3) || (parseFloat(navigator.appVersion) >= 4)) { 
			scriptsOn = 1; 
		} // end if
		
		// ignore all the following scripting with older browsers
		if(scriptsOn == 1) {
			// set the large, upper left corner images
			homeBigImages[1] = "http://uccrc.uchicago.edu/current/images/uchosp.jpg";
			homeBigImages[2] = "http://www.uchicago.edu/uchi/graphics/homebig/active/springrockefeller.gif";

			if(navigator.appName == 'Netscape' || parseFloat(navigator.appVersion) >= 4) {
				homeBigSrc = (homeBigImages[(Math.round((homeBigImages.length - 2) * Math.random()) + 1)]);
			} // end if navigator.appName == 'Netscape' ||

			else {
				homeBigSrc = 'http://www.uchicago.edu/uchi/graphics/homebig/active/springlinneas.gif';
			} // end else

		} // end "if scriptsOn" statements (functions have to be outside of that in NN3)
		
	} // end init


	/* 
	 * function rotateMastheadImage()
	 * Displays various alert dialogs to determine messages passed
	 * 
	 */
	function rotateMastheadImage() {
		init();
		document.write('<img src="');
		if(navigator.appName == 'Netscape' || parseFloat(navigator.appVersion) >= 4) {
			document.write(homeBigImages[(Math.round((homeBigImages.length - 2) * Math.random()) + 1)]);
		} // end if

		else {
			document.write('http://uccrc.uchicago.edu/current/images/uchosp.jpg');
		} // end else

		document.write('" hspace=0 vspace=0 width=178 height=200 border="0" name="img1">');
		// doDebug(); // Uncomment only when debugging.
	} // end rotateMastheadImage
	
	
	/* 
	 * function doDebug()
	 * Displays one image from homeBigImages[]
	 * 
	 */
	function doDebug() {
		alert("DEBUGGING: " + ver);
		// alert("DEBUGGING: " + participantsWindow.window.top);
		if(ver >= 4) {
			document.write('<img src="http://www.uchicago.edu/wusage_screen_properties.gif?' +
				'width=' + screen.width	+ '&' +
				'height=' + screen.height + '&' +
				'depth=' + screen.colorDepth + '">'); 	
			document.writeln();
		} // end if
		
	} // end doDebug

} // end MastheadImageRotator