// Create Instance of a Flash Object inside an HTML container object via script. Bypasses "Click to Activate Control" message in IE
// Usage: <script type="text/javascript">var oFlash=new insertFlashObject(['oContainerId','id','url','w','h','wmode']);</script>
// Notes: 'wmode' is an optional override and is not required when creating a new insertFlashObject call...simply end the array after 'h'...example: var oFlash=new insertFlashObject(['oContainerId','id','url','w','h']);


// Attaches an Event Listener to a valid document event type
function attachEventListener(target, eventType, functionRef, capture){if(typeof target.addEventListener!="undefined"){target.addEventListener(eventType,functionRef,capture);}else if(typeof target.attachEvent!="undefined"){target.attachEvent("on"+eventType,functionRef);window.attachEvent("onunload",function(e){removeEventListener(target,eventType,functionRef,capture);});}else{return false;}return true;}
function removeEventListener(target, eventType, functionRef, capture){if(typeof target.removeEventListener!="undefined"){target.removeEventListener(eventType,functionRef,capture);}else if(typeof target.detachEvent!="undefined"){target.detachEvent("on"+eventType,functionRef);}else{return false;}return true;}
	
var oFlash={
	containerId:null,
	movieId:null,
	movieUrl:null,
	flashVars:'',
	allowFullScreen:'true',
	mWidth:500,
	mHeight:375,
	wMode:'transparent',
	insert:function(){
		if(oFlash.containerId!==null&&oFlash.movieUrl!==null){
			var sTagStart='<object type="application/x-shockwave-flash" id="'+oFlash.movieId+'" data="'+oFlash.movieUrl+'" width="'+oFlash.mWidth+'" height="'+oFlash.mHeight+'">';
			var sParams ='<param name="allowScriptAccess" value="sameDomain" />';
				sParams+='<param name="movie" value="'+oFlash.movieUrl+'" />';
				sParams+='<param name="menu" value="false" />';
				sParams+='<param name="quality" value="high" />';
				sParams+='<param name="scale" value="exactfit" />';
				sParams+='<param name="autoStart" value="true" />';
				sParams+='<param name="WMode" value="'+oFlash.wMode+'" />';
				if(oFlash.allowFullScreen!=='undefined'){
					sParams+='<param name="allowfullscreen" value="'+oFlash.allowFullScreen+'">';
				}
				if(oFlash.flashVars!=='undefined'&&oFlash.flashVars.length>0){
					sParams+='<param name="FlashVars" value="'+oFlash.flashVars+'">';
				}
			var sTagEnd='</object>';
			if(document.getElementById){
				var c=document.getElementById(oFlash.containerId);
				if(typeof(c)!=='undefined'){
					c.innerHTML=sTagStart+sParams+sTagEnd;
					return true;
				}
			}else{
				return;
			}
		}else{
			return;
		}
	},
	init:function(){
		attachEventListener(window,'load',oFlash.insert,false);
	}
};