window.onload = function() {
	// global variables that will be used by later functions
	logo = document.getElementById('splash_logo');
	opacity = 0;
	opacityAdjustment = 2;

	// find the size of the browser window
	// http://www.javascripter.net/faq/browserw.htm
	var winW = 630, winH = 460;
	
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth;
	  winH = window.innerHeight;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth;
	  winH = document.body.offsetHeight;
	 }
	}
	
	var logoDiv = document.getElementById('splash_div');
	
	// set top margin of logo to center it vertically in the browser window
	if (winH > 440) {
		margin = Math.round((winH - 440)/2);
		logoDiv.style.marginTop = margin+"px";
	}		

	// wait half-a-second then set the logo image
	setTimeout("loadLogo()",500);
}

function loadLogo () {
	// set the logo image
	logo.src = "/images/splash_logo.gif";

	// setting a timer
	// http://www.faqts.com/knowledge_base/view.phtml/aid/1602
	
	// set timer for fade
	tid=setInterval('fade()',40);
}

function fade() {
	// changing image opacity
	// http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3206&lngWId=2
	
	// if the logo has faded all the way in (i.e., opacity at 100%), change opacity adjustment to fade the logo back out
	if (opacity==80) {
		opacityAdjustment = -1 * opacityAdjustment;
	}
	
	// adjust the opacity
	opacity = opacity + opacityAdjustment;
	
	// apply the new opacity setting to the logo in Netscape or I.E.
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5) {
		logo.style.MozOpacity=opacity/100;
	}
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4) {
		logo.filters.alpha.opacity=opacity;
	}
	
	// if logo has faded back out, stop the fade timer
	if (opacity==0) {
		clearInterval(tid);
		location='/index1.html';
	}
}
