// make sure swfobject load after document completes loading
var onLoadInterval = 0;
var jsLoadTimer = 0;

// start the process, this is called when document is loaded
function startOnLoadInterval(){
	onLoadInterval=setInterval("ensureSwfobjectIsLoaded()",300); // change the delay
}

 function ensureSwfobjectIsLoaded() {
	 	clearInterval(onLoadInterval);
	   if (self.swfobjectjs) { // Already exists
	     return;
	   }
	   var head = document.getElementsByTagName("head")[0];
	   script = document.createElement('script');
	   script.id = 'swfobjectjs';
	   script.type = 'text/javascript';
	   script.src = "/files/swfobject/swfobject.js";
	   head.appendChild(script);
	   startSwfObjectLoaded();
	   //showFlash();
}

function startSwfObjectLoaded(){
	jsLoadTimer = setInterval("swfobjectLoadCheck()",10);
}

function swfobjectLoadCheck(){
 	if(self.swfobject==null){
		// dont do anything, wait for next pass;
 	}else{
	 	// swfobject is loaded, so show flash
	 	clearInterval(jsLoadTimer);
	 	onSwfobjectLoaded(); // have this in the file.. which means swfobject has loaded
 	}
 }
 
// make sure jquery is loaded
$(document).ready(function(){
	startOnLoadInterval();
});