/* ====================================================================================================== MULTIPLE ONLOAD HANDLER */
var onLoadFunctions = new Array();
var iloadFunction = 0;

// Pass each function that needs to load
function addOnLoad(func) {
    onLoadFunctions[iloadFunction] = func;
    iloadFunction++;
}
// Loops through all of the functions that were added
function loadAllFunctions() {
    for(i=0; i < onLoadFunctions.length; i++) {
        eval(onLoadFunctions[i]+"()");
    }
}
// Load all of the functions that you've set
window.onload = loadAllFunctions;

/* ====================================================================================================== POSITION DIV OVER FLASH */
function getWinX() {
    var myWidth = -1;
    if (typeof(window.innerWidth) == 'number') {
	    myWidth = window.innerWidth; // non-ie
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	    myWidth = document.documentElement.clientWidth; // ie 6+ standards mode
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
	    myWidth = document.body.clientWidth; // ie4 compatible
    }
    return myWidth;
}

function positionDiv() {
    var container = document.getElementById("outerContainer");  
	var winX = getWinX();
	if (winX < 1200) { 
		if (container != null) {
			var FlashContent = document.getElementById("innerContainer");
	
			var LeftPosition = Math.round((winX/2)-600);	
			FlashContent.style.left = LeftPosition + "px";
			container.style.width = 1200 + LeftPosition + "px"; 
			container.style.left = LeftPosition * -1 + "px";
			// Subtracting 7 pixels here because the flash isn't centered as it was built.
			window.scrollTo((LeftPosition * -1) - 7, 0);
			container.style.visibility = "";
		}
	} 
	else {
		container.style.left = (winX - 1200) / 2 + "px";
		container.style.visibility = "";
	}
}
function windowResize() {	
    var container = document.getElementById("outerContainer");
	var winX = getWinX();	
	if (winX < 1200) {	
		if (container != null) {
			var FlashContent = document.getElementById("innerContainer");
	
			var LeftPosition = Math.round((winX/2)-600);
			FlashContent.style.left = LeftPosition + "px";
			container.style.width = 1200 + LeftPosition + "px"; 
			container.style.left = LeftPosition * -1 + "px";
			// Subtracting 7 pixels here because the flash isn't centered as it was built.
			window.scrollTo((LeftPosition * -1) - 7, 0);
		}
	}
	else {
		container.style.left = (winX - 1200) / 2 + "px";
	}	
}

/* ====================================================================================================== CALL FUNCTIONS TO BE LOADED */

addOnLoad("positionDiv");

/* ====================================================================================================== FUNCTIONS TO BE LOADED ON WINDOW RESIZE */
window.onresize = positionDiv;
