/*
	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


if(!dojo._hasResource["dojox.embed.Flash"]){
dojo._hasResource["dojox.embed.Flash"]=true;
dojo.provide("dojox.embed.Flash");
(function(){
var _1,_2;
var _3="dojox-embed-flash-",_4=0;
var _5={expressInstall:false,width:320,height:240,swLiveConnect:"true",allowScriptAccess:"sameDomain",allowNetworking:"all",style:null,redirect:null};
function _6(_7){
_7=dojo.delegate(_5,_7);
if(!("path" in _7)){
console.error("dojox.embed.Flash(ctor):: no path reference to a Flash movie was provided.");
return null;
}
if(!("id" in _7)){
_7.id=(_3+_4++);
}
return _7;
};
if(dojo.isIE){
_1=function(_8){
_8=_6(_8);
if(!_8){
return null;
}
var p;
var _a=_8.path;
if(_8.vars){
var a=[];
for(p in _8.vars){
a.push(p+"="+_8.vars[p]);
}
_a+=((_a.indexOf("?")==-1)?"?":"&")+a.join("&");
}
var s="<object id=\""+_8.id+"\" "+"classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "+"width=\""+_8.width+"\" "+"height=\""+_8.height+"\""+((_8.style)?" style=\""+_8.style+"\"":"")+">"+"<param name=\"movie\" value=\""+_a+"\" />";
if(_8.params){
for(p in _8.params){
s+="<param name=\""+p+"\" value=\""+_8.params[p]+"\" />";
}
}
s+="</object>";
return {id:_8.id,markup:s};
};
_2=(function(){
var _d=10,_e=null;
while(!_e&&_d>7){
try{
_e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_d--);
}
catch(e){
}
}
if(_e){
var v=_e.GetVariable("$version").split(" ")[1].split(",");
return {major:(v[0]!=null)?parseInt(v[0]):0,minor:(v[1]!=null)?parseInt(v[1]):0,rev:(v[2]!=null)?parseInt(v[2]):0};
}
return {major:0,minor:0,rev:0};
})();
dojo.addOnUnload(function(){
var _11=function(){
};
var _12=dojo.query("object").reverse().style("display","none").forEach(function(i){
for(var p in i){
if((p!="FlashVars")&&dojo.isFunction(i[p])){
try{
i[p]=_11;
}
catch(e){
}
}
}
});
});
}else{
_1=function(_15){
_15=_6(_15);
if(!_15){
return null;
}
var p;
var _17=_15.path;
if(_15.vars){
var a=[];
for(p in _15.vars){
a.push(p+"="+_15.vars[p]);
}
_17+=((_17.indexOf("?")==-1)?"?":"&")+a.join("&");
}
var s="<embed type=\"application/x-shockwave-flash\" "+"src=\""+_17+"\" "+"id=\""+_15.id+"\" "+"name=\""+_15.id+"\" "+"width=\""+_15.width+"\" "+"height=\""+_15.height+"\""+((_15.style)?" style=\""+_15.style+"\" ":"")+"swLiveConnect=\""+_15.swLiveConnect+"\" "+"allowScriptAccess=\""+_15.allowScriptAccess+"\" "+"allowNetworking=\""+_15.allowNetworking+"\" "+"pluginspage=\""+window.location.protocol+"//www.adobe.com/go/getflashplayer\" ";
if(_15.params){
for(p in _15.params){
s+=" "+p+"=\""+_15.params[p]+"\"";
}
}
s+=" />";
return {id:_15.id,markup:s};
};
_2=(function(){
var _1a=navigator.plugins["Shockwave Flash"];
if(_1a&&_1a.description){
var v=_1a.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".");
return {major:(v[0]!=null)?parseInt(v[0]):0,minor:(v[1]!=null)?parseInt(v[1]):0,rev:(v[2]!=null)?parseInt(v[2]):0};
}
return {major:0,minor:0,rev:0};
})();
}
dojox.embed.Flash=function(_1c,_1d){
if(location.href.toLowerCase().indexOf("file://")>-1){
throw new Error("dojox.av.FLVideo can't be run directly from a file. To instatiate the required SWF correctly it must be run from a server, like localHost.");
}
this.id=null;
this.movie=null;
this.domNode=null;
if(_1d){
_1d=dojo.byId(_1d);
}
if(_1c&&_1d){
this.init(_1c,_1d);
}
};
dojo.extend(dojox.embed.Flash,{onReady:function(_1e){
},onLoad:function(_1f){
},init:function(_20,_21){
this.destroy();
_21=dojo.byId(_21||this.domNode);
if(!_21){
throw new Error("dojox.embed.Flash: no domNode reference has been passed.");
}
var p=0;
this._poller=null;
this._pollCount=0,this._pollMax=250;
if(dojox.embed.Flash.initialized){
this.id=dojox.embed.Flash.place(_20,_21);
this.domNode=_21;
setTimeout(dojo.hitch(this,function(){
this.movie=(dojo.isIE)?dojo.byId(this.id):document[this.id];
this.onReady(this.movie);
this._poller=setInterval(dojo.hitch(this,function(){
try{
p=(this.movie&&this.movie.PercentLoaded)?this.movie.PercentLoaded():0;
}
catch(e){
}
if(p==100||this._pollCount++>this._pollMax){
clearInterval(this._poller);
delete this._poller;
delete this._pollCount;
delete this._pollMax;
this.onLoad(this.movie);
}
}),10);
}),1);
}
},_destroy:function(){
try{
this.domNode.removeChild(this.movie);
}
catch(e){
}
this.id=this.movie=this.domNode=null;
},destroy:function(){
if(!this.movie){
return;
}
var _23=dojo.delegate({id:true,movie:true,domNode:true,onReady:true,onLoad:true});
for(var p in this){
if(!_23[p]){
delete this[p];
}
}
if(this._poller){
dojo.connect(this,"onLoad",this,"_destroy");
}else{
this._destroy();
}
}});
dojo.mixin(dojox.embed.Flash,{minSupported:8,available:_2.major,supported:(_2.major>=8),version:_2,initialized:false,onInitialize:function(){
dojox.embed.Flash.initialized=true;
},__ie_markup__:function(_25){
return _1(_25);
},proxy:function(obj,_27){
dojo.forEach((dojo.isArray(_27)?_27:[_27]),function(_28){
this[_28]=dojo.hitch(this,function(){
return (function(){
return eval(this.movie.CallFunction("<invoke name=\""+_28+"\" returntype=\"javascript\">"+"<arguments>"+dojo.map(arguments,function(_29){
return __flash__toXML(_29);
}).join("")+"</arguments>"+"</invoke>"));
}).apply(this,arguments||[]);
});
},obj);
}});
if(dojo.isIE){
if(dojo._initFired){
var e=document.createElement("script");
e.type="text/javascript";
e.src=dojo.moduleUrl("dojox","embed/IE/flash.js");
document.getElementsByTagName("head")[0].appendChild(e);
}else{
document.write("<scr"+"ipt type=\"text/javascript\" src=\""+dojo.moduleUrl("dojox","embed/IE/flash.js")+"\">"+"</scr"+"ipt>");
}
}else{
dojox.embed.Flash.place=function(_2a,_2b){
var o=_1(_2a);
_2b=dojo.byId(_2b);
if(!_2b){
_2b=dojo.doc.createElement("div");
_2b.id=o.id+"-container";
dojo.body().appendChild(_2b);
}
if(o){
_2b.innerHTML=o.markup;
return o.id;
}
return null;
};
dojox.embed.Flash.onInitialize();
}
})();
}
