var SNT_DEBUG=SNT_DEBUG||false;var Sonettic=Sonettic||{};Sonettic.Helper=(function(){var b={EVENT_ADD:"ADD_EVENT_LISTENER",EVENT_RM:"REMOVE_EVENT_LISTENER",EVENT_INIT:"INIT_STATE",EVENT_REGISTER:"PLAYER_REGISTER"};var a=null;var c=null;return{getConstant:function(d){return b[d]||null},getFlashObject:function(f){Sonettic.Helper.debug("Getting object with id ["+f+"]");var d=navigator.appName.indexOf("Microsoft")!=-1;var e=(d)?window[f]:document[f];return e},debug:function(g){if(SNT_DEBUG==false||SNT_DEBUG==null){return}if(window.console&&window.console.log){window.console.log(g)}else{a=a||document.getElementById("sonettic-debug");if(a==null){var d=document.getElementsByTagName("body")[0];var f=document.createElement("div");var e='<form action=""><textarea id="sonettic-debug" name="snt-debug" style="border:1px dashed #000; display:block; position:absolute; bottom: 10px; right: 10px; width: 500px; height:100px;background-color:#f8f8f8; border-top:15px solid #c8c8c8;overflow:auto; font-size:11px; font-family:sans-serif;">';f.innerHTML=e+"</textarea></form>";d.appendChild(f)}if(a!=null){a.value=a.value+">> "+g+"\n";var h=a.length;a.scrollTop=a.scrollHeight}}}}})();var SntEventsHolder=(function(){var c={};var e={};var b={};var a={};function d(f,g){return !f[g]||f[g]==null?null:f[g]}return function(){this.getConstant=function(f){return Sonettic.Helper.getConstant(f)};this.setPlayer=function(f,g){c[f]=g||null};this.getPlayer=function(f){return d(c,f)};this.setObj=function(f,g){e[f]=g||null};this.getObj=function(f){return d(e,f)};this.setStatus=function(f,g){b[f]=g||false};this.getStatus=function(f){return d(b,f)};this.setUnregistered=function(f,g){a[f]=g||null};this.getUnregistered=function(f){return d(a,f)}}})();SntEventsHolder.prototype.log=function(a){Sonettic.Helper.debug(a)};SntEventsHolder.prototype.registerPlayer=function(b,a){if(b==null||a==null){return false}this.setStatus(b,false);this.setPlayer(b,a);if(this.getUnregistered(b)!=null){this.setUnregistered(b,null);this.setStatus(b,true);this.getPlayer(b).register(true)}this.log("Player ["+b+"] registered sucessfull");return true};SntEventsHolder.prototype.receiveMessage=function(c,b,a){if(this.getUnregistered(b)!=null){this.log("Skipped commad ["+c+"] for UNREGISTERED player ["+b+"]");return}if(this.getPlayer(b)==null){this.log("Created new player instance ["+b+"] and received command ["+c+"]");this.setUnregistered(b,new SntPlayer(b));return}if(this.getStatus(b)==false&&c==this.getConstant("EVENT_REGISTER")){this.setStatus(b,true)}if(this.getObj(b)==null){var d=Sonettic.Helper.getFlashObject(b);if(d==null){throw new Error("Player with id ["+b+"] not exist");return}this.setObj(b,d)}this.getPlayer(b).register(true);this.log("Command reply ["+c+"] for player ["+b+"] received with data:");this.log(a);this.getPlayer(b).receiveMessage(c,a)};SntEventsHolder.prototype.sendMessage=function(f,b,a){if(this.getStatus(b)==false||this.getObj(b)==null){return}this.log("Command ["+f+"] sent from ["+b+"] with args:");this.log(a);var d=this.getObj(b);var e=d.receiveMessage;var c=this;setTimeout(function(){if(d==null){c.log("Copy of the SntPlayer Object doesn't exist anymore. The Conception of your code went wrong.");return}d.receiveMessage(f,b,a);d.focus()},30)};SntEventsHolder.prototype.addEventListener=function(b,a){if(this.getStatus(a)==false||this.getObj(a)==null){return}this.log("Event listener added for event ["+b+"] for player ["+a+"]");this.sendMessage(this.getConstant("EVENT_ADD"),a,[b])};SntEventsHolder.prototype.removeEventListener=function(b,a){if(this.getStatus(a)==false||this.getObj(a)==null){return}this.log("Event listener removed, event ["+b+"] for player ["+a+"]");this.sendMessage(this.getConstant("EVENT_RM"),a,[b])};SntEventsHolder.prototype.getFlashObject=function(a){return Sonettig.Helper.getFashObject(a)};function SntPlayer(b,a){this.id=b;this.c=0;this.registered=false;this.player=null;this.eventListeners={};window.getSntHolderInstance().registerPlayer(this.id,this)}SntPlayer.prototype.register=function(a){if(a==null){return this.registered}this.registered=a;return this.registered};SntPlayer.prototype.sendMessage=function(b,a,c){window.getSntHolderInstance().sendMessage(b,this.id,a);this.eventListeners[b]=c};SntPlayer.prototype.receiveMessage=function(d,c){if(this.eventListeners[d]!=null){var a=this.c++;var b="f"+a;this[b]=this.eventListeners[d];this[b](c);this[b]=null}};SntPlayer.prototype._isArray=function(a){return a&&typeof a==="object"&&a.constructor===Array};SntPlayer.prototype.addEventListener=function(a,d){var c=a;if(!this._isArray(a)){c=[a]}for(var b in c){this.eventListeners[c[b]]=d;window.getSntHolderInstance().addEventListener(c[b],this.id)}};SntPlayer.prototype.removeEventListener=function(a){var c=a;if(!this.isArray(a)){c=[a]}for(var b in c){this.eventListeners[event[b]]=null;window.getSntHolderInstance().removeEventListener(c[b],this.id)}};SntPlayer.prototype.ready=function(a){this.addEventListener(Sonettic.Helper.getConstant("EVENT_REGISTER"),a);if(this.register()){this.receiveMessage(Sonettic.Helper.getConstant("EVENT_REGISTER"))}};function SntEmbed(f,b,a,e,c){this.callback=null;this.callbackArgs=[];this.movie=b;this.haveSwfobject=swfobject!=null?true:false;this.width=470;this.height=264;this.id=f;this.flashvars=a!=null?a:{};this.attributes={id:f,name:f};this.params={allowFullScreen:"true",allowScriptAccess:"sameDomain",bgcolor:"transparent",wmode:"transparent"};if(e!=null){for(var d in e){this.params[d]=e[d]}}if(c!=null){for(var d in c){this.attributes[d]=c[d]}}return this}SntEmbed.prototype={render:function(a){a.setCallback(this.callback);return a.render(this.id,this.movie,{width:this.width,height:this.height},this.flashvars,this.params,this.attributes)},setFlashvars:function(b){for(var a in b){this.flashvars[a]=b[a]}},setCallback:function(a){this.callback=a},setAttributes:function(c){for(var b in c){this.attributes[b]=c[b]}},setParams:function(b){for(var a in b){this.params[a]=b[a]}},setSize:function(b,a){this.width=b;this.height=a}};function SntSwfobjectEmbed(){this.status=true;this.callback=null;return this}SntSwfobjectEmbed.prototype={setCallback:function(a){this.callback=a},render:function(f,b,d,a,e,c){if(swfobject==null){return false}if(this.callback!=null){Sonettic.Helper.debug("Set callback method: "+this.callback);swfobject.addLoadEvent(this.callback)}swfobject.embedSWF(b,f,d.width,d.height,"9.0.0","scripts/expressInstall.swf",a,e,c);return this.status}};var sntEventsHolderObj=new SntEventsHolder();window.sntEventsHolder=sntEventsHolderObj;function getSntHolderInstance(){return window.sntEventsHolder}function $$(a){return document.getElementById(a)||null}window.getSntHolderInstance=getSntHolderInstance;function sntReceiveMessage(c,b,a){window.sntEventsHolder.receiveMessage(c,b,a)};