// General functions


//Function to handle flash animation callback
function aniDone() {
	//Grab a reference to the logo element (SWF Object)
	var aniObj = document.getElementById("splashLogo");
	
	//grab a reference to the current logo image
	var fixedLogo = document.getElementById("jumpFixedLogo");
	var left = (fixedLogo.parentNode.parentNode.parentNode.offsetLeft) + fixedLogo.offsetLeft;
	
	var top = 0;
	var theEle = fixedLogo;
	while (theEle.offsetTop != null) {
		top += theEle.offsetTop;
		theEle = theEle.parentNode;
	}
	//var top = fixedLogo.parentNode.parentNode.parentNode.offsetTop + fixedLogo.offsetTop;
	if (top == 0) {
		//stupid IE
		top = 8;
	}
	moveElementTo (aniObj, left, top + 4, 100, 100, testDone);
	
	aniObj.resizeInt = setInterval("scaleElementLoop('" + aniObj.id + "', 183, 78, -4, -1.7)", 10);

}

function testDone() {
	//alert ("done");
	fadeBoxOut("splashBG");
}



//Load and display initial animation
function initAni() {
	var splashBG = document.createElement("div");
	splashBG.id = "splashBG";
	splashBG.fadeSpeed = 20;
	splashBG.unloadFunc = function () {
		this.parentNode.removeChild(this);
		aniDiv.unloadFunc();
	}
	document.body.appendChild(splashBG);
	
	var aniDiv = document.createElement("div");
	
	aniDiv.id = "splashLogo";
	
	var screenSize = getScreenSize();
	
	
	aniDiv.style.width = "540px";
	aniDiv.style.height = "230px";
	aniDiv.style.position = "absolute";
	aniDiv.style.zIndex = "50";
	//aniDiv.style.backgroundColor = "#FF0000";
	aniDiv.style.left = (screenSize[0] / 2) - (540 /2) + "px";
	aniDiv.style.top = (screenSize[1] / 2) - (230 /2) + "px";
	
	
	
	//Add the flash content
	aniDiv.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="logoAniB" align="middle"> \
	<param name="allowScriptAccess" value="sameDomain" /> \
	<param name="movie" value="images/logoAniB.swf" /> \
	<param name="loop" value="false" /> \
	<param name="menu" value="false" /> \
	<param name="quality" value="high" /> \
	<param name="wmode" value="transparent" /> \
	<param name="bgcolor" value="#ffffff" /> \
	<param name="scale" value="noborder" /> \
	<embed src="images/logoAniB.swf" loop="false" menu="false" quality="high" scale="noborder" wmode="transparent" bgcolor="#ffffff" width="100%" height="100%" name="logoAniB" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> \
	</object>';
	
	aniDiv.fadeSpeed = 5;
	aniDiv.unloadFunc = function () {
		this.parentNode.removeChild(this);
	}
	
	//Okay, now we're good
	document.body.appendChild(aniDiv);
	
}

//Function to get screen size
function getScreenSize() {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	
	return (new Array(x, y));
	
}