/*
 *  author: James Lin
 *  Here is where we have our relatively simple logic for the
 *	accordion and the Flash player interface.
 *
 *  The JavaScript code simply adds and removes CSS classes from
 * 	the page elements.
 *
 *  The CSS actually handles the different accordion states.
 */

//Wait for the DOM to load before trying anything.
document.observe("dom:loaded", initSite);


/***********ACCORDION STUFF***********/

function initSite() {		
	
	detectPlatform();
	
	if(!isMobile) {
	
		var params = {};
		
		params.menu = "false";
		params.quality = "high";
		params.wmode = "transparent";

	
		var flashvars = {deeplink:document.location.search.substring(1)};
		
		var randomnumber = Math.floor(Math.random()*2)
		
		
		if(randomnumber){
			document.bgColor = '#333438';
			flashvars.textColor = true;
			swfobject.embedSWF("siteLoader1.swf", "flashcontent", "100%", "100%", "9.0.0", "swf/expressInstall.swf", flashvars, params);
		}else{
			document.bgColor = '#ffffff';
			flashvars.textColor = false;
			swfobject.embedSWF("siteLoader2.swf", "flashcontent", "100%", "100%", "9.0.0", "swf/expressInstall.swf", flashvars, params);
		}


	} else {

		
	}
}

/***********USERAGENT SNIFFER***********/
var isMobile;

function detectPlatform() {
	//The width is set to 710 in the CSS for screen and 0 for handheld.	
	//Using visible would be even better, but there seems to be a CSS limitation when it comes
	//to checking the CSS applied display status.  Only inline works.
	var fp = $("flashcontent");
	isMobile = fp.getWidth() == 0;
}

