/** 
 * mooflashembed - refactored flashembed to make use of mootools
 * adamnfish 2008
 * 
 * flashembed 0.31. Adobe Flash embedding script
 * 
 * http://flowplayer.org/tools/flash-embed.html
 *
 * Copyright (c) 2008 Tero Piirainen (tipiirai@gmail.com)
 *
 * Released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * >> Basically you can do anything you want but leave this header as is <<
 *
 * version 0.01 - 03/11/2008 
 * version 0.31 - Tue Jul 22 2008 06:30:34 GMT+0200 (GMT+02:00)
 */

function flashembed(J,L,D){function A(){var O="";if($type(D)=="function"){D=D()}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){O='<embed type="'+E.type+'" ';if(E.id){E=$merge(E,{name:E.id})}for(var N in E){if(E[N]!==null){O+=[N]+'="'+E[N]+'"\n\t'}}if(D){O+="flashvars='"+F(D)+"'"}O+="/>"}else{O='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';O+='width="'+E.width+'" height="'+E.height+'"';if(!E.id&&document.all){E.id="_"+$time()}if(E.id){O+=' id="'+E.id+'"'}O+=">";O+='\n\t<param name="movie" value="'+E.src+'" />';E.id=E.src=E.width=E.height=null;for(var M in E){if(E[M]!==null){O+='\n\t<param name="'+M+'" value="'+E[M]+'" />'}}if(D){O+='\n\t<param name="flashvars" value=\''+F(D)+"' />"}O+="</object>";if(B){alert(O)}}return O}function K(M){var N=setInterval(function(){var P=document;var O=$(M);if(O){flashembed(O,L,D);clearInterval(N)}else{if(P&&P.getElementsByTagName&&P.getElementById&&P.body){clearInterval(N)}}},13);return true}var E={src:"#",width:"100%",height:"100%",version:null,onFail:null,expressInstall:null,debug:false,type:"application/x-shockwave-flash",pluginspage:"http://www.adobe.com/go/getflashplayer"};if($type(L)=="string"){L={src:L}}E=$merge(E,L);var H=flashembed.getVersion();var I=E.version;var C=E.expressInstall;var B=E.debug;if($type(J)=="string"){if(el=$(J)){J=$(el)}else{return K(J)}}if(!J){return}if(!I||flashembed.isSupported(I)){E.onFail=E.version=E.expressInstall=E.debug=null;$(J).set("html",A());return J.firstChild}else{if(E.onFail){var G=E.onFail.call(E,flashembed.getVersion(),D);if(G){$(J).set("html",G)}}else{if(I&&C&&flashembed.isSupported([6,65])){E=$merge(E,{src:C});D={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};$(J).set("html",A())}else{if(J.innerHTML.replace(/\s/g,"")!==""){}else{J.innerHTML="<h2>Flash version "+I+" or greater is required</h2><h3>"+(H[0]>0?"Your version is "+H:"You have no flash plugin installed")+"</h3><p>Download latest version from <a href='"+E.pluginspage+"'>here</a></p>"}}}}function F(O){var M="";for(var N in O){if(O[N]){M+=[N]+"="+JSON.encode(O[N])+"&"}}return M.substring(0,M.length-1)}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}return J}flashembed=flashembed||{};flashembed.getVersion=function(){var C=[0,0];if(navigator.plugins&&$type(navigator.plugins["Shockwave Flash"])=="object"){var B=navigator.plugins["Shockwave Flash"].description;if($type(B)!="undefined"){B=B.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var D=parseInt(B.replace(/^(.*)\..*$/,"$1"),10);var H=/r/.test(B)?parseInt(B.replace(/^.*r(.*)$/,"$1"),10):0;C=[D,H]}}else{if(window.ActiveXObject){try{var F=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(G){try{F=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");C=[6,0];F.AllowScriptAccess="always"}catch(A){if(C[0]==6){return}}try{F=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(E){}}if($type(F)=="object"){B=F.GetVariable("$version");if($type(B)!="undefined"){B=B.replace(/^\S+\s+(.*)$/,"$1").split(",");C=[parseInt(B[0],10),parseInt(B[2],10)]}}}}return C};flashembed.isSupported=function(A){var C=flashembed.getVersion();var B=(C[0]>A[0])||(C[0]==A[0]&&C[1]>=A[1]);return B};