var SWFLoader=Class.create();SWFLoader.prototype={initialize:function(){this.swfobjects={};this.deeplinkListener=null;this.requiredVersion={"major":9,"minor":0,"rev":115};this.expressInstallVersion={"major":6,"minor":0,"rev":65};this.expressInstallSize={"width":215,"height":138};window.SWFCall=this.SWFCall.bind(this);window.SWFError=this.SWFError.bind(this);window.SWFLogStart=this.SWFLogStart.bind(this);window.SWFLogEnd=this.SWFLogEnd.bind(this);window.SWFDebug=this.SWFDebug.bind(this);window.SWFDeeplink=this.SWFDeeplink.bind(this);this.initUnload();},load:function(element,swfname,swffile,width,height,bgcolor,swfvars){swfobject=this.getSWFObject(element,swfname,swffile,width,height,bgcolor,swfvars);this.loadSWFObject(element,swfobject);},loadSWFObject:function(element,swfobject){swfName=swfobject.getAttribute("swfname");swfWidth=swfobject.getAttribute("width");swfHeight=swfobject.getAttribute("height");this.checkDeeplinking(swfobject);if(this.checkPlayerVersion()){this.addSWFObject.bind(this).defer(element,swfobject);}
else if(this.checkExpressInstallVersion()&&this.checkExpressInstallSize(swfWidth,swfHeight)){installObject=this.getSWFObject(element,swfName,"/lib/swfloader/expressinstall.swf",swfWidth,swfHeight,"transparent",{"SWFContainer":element,"MMredirectURL":escape(window.location),"MMdoctitle":document.title});this.addSWFObject.bind(this).defer(element,installObject);}
else{this.addAlternateContent(element,swfWidth,swfHeight);}},checkPlayerVersion:function(){installedVersion=this.getPlayerVersion();if(this.getVersionInt(installedVersion)>=this.getVersionInt(this.requiredVersion)){return true;}
return false;},checkExpressInstallVersion:function(){installedVersion=this.getPlayerVersion();if(this.getVersionInt(installedVersion)>=this.getVersionInt(this.expressInstallVersion)){return true;}
return false;},checkExpressInstallSize:function(width,height){if(width>=this.expressInstallSize.width&&height>=this.expressInstallSize.height){return true;}
return false;},getPlayerVersion:function(){if(!this.installedVersion){this.installedVersion={"major":0,"minor":0,"rev":0};if(navigator.plugins&&navigator.mimeTypes.length){version=this.getPlayerVersionFF();}else{version=this.getPlayerVersionIE();}
if(version){var i=0;for(property in this.installedVersion){this.installedVersion[property]=version[i]!=null?parseInt(version[i]):0;i++;}}
else{return false;}}
return this.installedVersion;},getVersionInt:function(version){return(version.major*Math.pow(1000,2))+(version.minor*1000)+version.rev;},getPlayerVersionFF:function(){var flashplayer=navigator.plugins["Shockwave Flash"];if(flashplayer&&flashplayer.description){var version=flashplayer.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".");if(version[2]==""){version[2]="0";}
return version;}
return false;},getPlayerVersionIE:function(){try{flashplayer=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");flashplayer.AllowScriptAccess="always";return flashplayer.GetVariable("$version").split(" ")[1].split(",");}
catch(e){return false;}},getSWFObject:function(element,swfname,swffile,width,height,bgcolor,swfvars){swfobject=new SWFObject(swfname,swffile,width,height,bgcolor.replace(/#/g,""),swfvars);return swfobject;},addSWFObject:function(element,swfobject){swfname=swfobject.getAttribute("swfname");this.swfobjects[swfname]={};this.swfobjects[swfname]["element"]=$(element);this.swfobjects[swfname]["object"]=swfobject;this.swfobjects[swfname]["object"].write(element);},addAlternateContent:function(element,width,height,bgcolor){if($(element)){var noflashelements=$(element).select(".noflash");if(noflashelements.length>0){noflashelements.invoke("show").invoke("fire","swfloader:shown-noflashelement",{"swfloader":this});return true;}
else{$(element).setStyle({"width":width,"height":height,"textAlign":"center"});$(element).innerHTML="<a class='swfloadergetflash' href='http://www.adobe.com/go/flashplayer' target='_blank'><img src='/lib/swfloader/images/getflashplayer.gif' border='0'/></a>";$(element).fire("swfloader:loaded-getflashplayer",{"swfloader":this});return true;}}
return false;},addAlternateContentCallback:function(element,width,height){this.addAlternateContent(element,width,height);},unload:function(swfname){this.processUnload.bind(this).defer(swfname);},processUnload:function(swfname){divElement=this.getDivByName(swfname);if(divElement){divElement.removeChild(divElement.getElementsByTagName("embed")[0]);this.swfobjects[swfname]=undefined;}},getSWFObjectByName:function(swfname){if(this.swfobjects[swfname]){return this.swfobjects[swfname]["object"];}
else{return false;}},getDivByName:function(swfname){if(this.swfobjects[swfname]){return this.swfobjects[swfname]["element"];}
else{return false;}},SWFCall:function(){flashVars=$A(arguments);swfname=flashVars.shift();methodName=flashVars.shift();methodVars=flashVars;swfobject=this.getSWFObjectByName(swfname);if(swfobject){callbackFunction=swfobject.getCallbackByMethod(methodName);if(typeof(callbackFunction["callback"])=="function"){return callbackFunction["callback"].apply(swfobject,methodVars);}
else if(typeof(swfobject[methodName])=="function"){return swfobject[methodName].apply(swfobject,methodVars);}
else{this.SWFError("Method "+methodName+" doesn't exist in object "+swfname+".");}}
else{this.SWFError("Object with name "+swfname+" doesn't exist.");}},SWFLogStart:function(debugInfo){if(console){console.log("loading ("+debugInfo.id+"): "+debugInfo.url);console.time("response time ("+debugInfo.id+")");}},SWFLogEnd:function(debugInfo){if(console){console.timeEnd("response time ("+debugInfo.id+")");console.log(debugInfo);}},SWFError:function(message,log){if($("consolewindow")){if(!log){message="ERROR: "+message;}
$("consolewindow").innerHTML+=message+"<br/>";return;}
if(console){if(log){console.log(message);}
else{console.error("ERROR: "+message);}
return;}},SWFDebug:function(level){var args=$A(arguments);args.shift();if(typeof(console)!="undefined"&&typeof(console.error)=="function"&&typeof(console.warn)=="function"&&typeof(console.log)=="function"){switch(level){case 1:console.error.apply(console,args);break;case 2:console.warn.apply(console,args);break;default:console.log.apply(console,args);break;}}
else{throw Error(args);}},checkDeeplinking:function(swfobject){var swfvars=swfobject.getVariables();if(swfvars["deeplinking"]==true){swfobject.deeplinking=true;if(this.deeplinkListener==null){this.deeplinkListener=new PeriodicalExecuter(this.broadcastDeeplink.bind(this),0.05);}}},SWFDeeplink:function(link,title){document.location.hash="#"+link;if(title!=""){document.title=title;}},broadcastDeeplink:function(){var deeplink=document.location.hash.replace(/#/g,"");if(deeplink!=""&&this.broadcastedDeeplink!=deeplink){this.broadcastedDeeplink=deeplink;for(var swfname in this.swfobjects){if(this.swfobjects[swfname]["object"].deeplinking){this.swfobjects[swfname]["object"].setDeeplink(deeplink);}}}},initUnload:function(){if(!window.opera&&document.all){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};}},cleanupSWFObjects:function(){if(window.opera||!document.all){return;}
var objects=document.getElementsByTagName("object");for(i=0;i<objects.length;i++){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}}}}
var SWFObject=Class.create();SWFObject.prototype={initialize:function(swfname,swffile,width,height,bgcolor,swfvars){this.deeplinking=false;this.registeredCallbacks={};this.initAttributes({"swffile":swffile,"swfname":swfname,"width":width,"height":height});this.initParams({"quality":"high","menu":"false","scale":"noscale","AllowScriptAccess":"always","bgcolor":this.getColor(bgcolor),"wmode":this.getWMode(bgcolor)});this.initVariables(swfvars);this.addFlashConfigVars();},initAttributes:function(attributes){this.attributes={};for(property in attributes){if(attributes[property]){this.setAttribute(property,attributes[property]);}}},initParams:function(params){this.params={};for(property in params){if(params[property]){this.addParam(property,params[property]);}}},initVariables:function(variables){this.variables={};for(property in variables){if(variables[property]){this.addVariable(property,variables[property]);}}},addFlashConfigVars:function(){this.addVariable("swfname",this.getAttribute("swffile").substr(this.getAttribute("swffile").lastIndexOf("/")+1,this.getAttribute("swffile").lastIndexOf(".swf")-(this.getAttribute("swffile").lastIndexOf("/")+1)));this.addVariable("swfpath",this.getAttribute("swffile").substr(0,this.getAttribute("swffile").lastIndexOf("/")+1));},getColor:function(bgcolor){if(bgcolor=="transparent"){return false;}
return bgcolor;},getWMode:function(bgcolor){if(bgcolor!="transparent"){return false;}
return bgcolor;},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariables:function(){return this.variables;},getVariablePairs:function(){variables=this.getVariables();variablePairs=new Array();for(property in variables){variablePairs.push(property+"="+variables[property]);}
return variablePairs;},getSWFHTML:function(){if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){this.addVariable("MMplayerType","PlugIn");SWFNode=this.getSWFHTMLEmbed();}else{this.addVariable("MMplayerType","ActiveX");SWFNode=this.getSWFHTMLObject();}
return SWFNode;},getSWFHTMLEmbed:function(){SWFNode="<embed type='application/x-shockwave-flash' src='"+this.getAttribute("swffile")+"'";SWFNode+=" width='"+this.getAttribute("width")+"' height='"+this.getAttribute("height")+"'";SWFNode+=" id='"+this.getAttribute("swfname")+"' name='"+this.getAttribute("swfname")+"' ";SWFNode+=this.getParamHTML(true);SWFNode+=this.getVariableHTML(true);SWFNode+="/>";return SWFNode;},getSWFHTMLObject:function(){SWFNode="<object id='"+this.getAttribute("swfname")+"' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'";SWFNode+=" width='"+this.getAttribute("width")+"' height='"+this.getAttribute("height")+"'>";SWFNode+="<param name='movie' value='"+this.getAttribute("swffile")+"'/>";SWFNode+=this.getParamHTML(false);SWFNode+=this.getVariableHTML(false);SWFNode+="</object>";return SWFNode;},getParamHTML:function(embed){paramHTML="";params=this.getParams();for(var property in params){if(embed){paramHTML+=property+"='"+params[property]+"' ";}
else{paramHTML+='<param name="'+property+'" value="'+params[property]+'" />';}}
return paramHTML;},getVariableHTML:function(embed){variableHTML="";variablestring=this.getVariablePairs().join("&");if(variablestring.length>0){if(embed){variableHTML+="flashvars='"+variablestring+"'";}
else{variableHTML+="<param name='flashvars' value='"+variablestring+"'/>";}}
return variableHTML;},write:function(element){if($(element)){$(element).innerHTML=this.getSWFHTML();return true;}
return false;},methodExists:function(methodName){element=$(this.getAttribute("swfname"));if(element){if(typeof(element[methodName])=="function"){return true;}}
return false;},registerCallback:function(methodName,callbackFunction){this.registeredCallbacks[methodName]={};this.registeredCallbacks[methodName]["callback"]=callbackFunction;},getCallbackByMethod:function(methodName){if(this.registeredCallbacks[methodName]!=undefined){return this.registeredCallbacks[methodName];}
return false;},getContainer:function(){return swfloader.getDivByName(this.getAttribute("swfname"));},setDeeplink:function(link){if(this.methodExists("setDeeplink")){$(this.getAttribute("swfname")).setDeeplink(link);}
else{this.setDeeplink.bind(this).delay(0.05,link);}}}
var swfloader=new SWFLoader();
