/*
Javascript file for Bombastic
*/

function init() {
	// quit if this function has already been called
	if (arguments.callee.done) return;
	
	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
	
	// kill the timer
	if (_timer) {
		clearInterval(_timer);
		_timer = null;
	}
	
	// create the "page loaded" message
//	var text = document.createTextNode("Page loaded!");
//	var message = document.getElementById("message");
//	message.appendChild(text);
	overlay(bro);
	setupZoom();
};

bro="";
/* for Mozilla */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
	bro='Mozilla';
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	bro='ie';
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			ie=true;
			init(); // call the onload handler
		}
	};
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	bro='webkit';
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 10);
}

/* for other browsers */
if (bro=="") { bro='other'; }
window.onload = init;

function overlay(bro) {
	if (bro=='ie') { return; }
	if(desc=document.getElementById("desc1")) {
		hidedesc('1');
		hidedesc('2');
		$('desc1').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		if(desc=document.getElementById("desc2")) {
			$('desc2').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		}
		if(desc=document.getElementById("desc3")) {
			$('desc3').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		}
	} else if(desc=document.getElementById("desc13")) {
		hidedesc('13');
		hidedesc('23');
		hidedesc('33');
		$('desc13').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		if(desc=document.getElementById("desc23")) {
			$('desc23').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		}
		if(desc=document.getElementById("desc33")) {
			$('desc33').appear({ duration: 4.0, transition: Effect.Transitions.sinoidal });
		}
	} else {
		return;
	}
}

function hidedesc(a) {
	if (bro=='ie') { return; }
	if(desc=document.getElementById("desc"+a)) {
		desc.style.display="none";
	}
}

function showdesc(a) {
	if (bro=='ie') { return; }
	if(desc=document.getElementById("desc"+a)) {
		desc.style.display="block";
	}
}

