/**
 * Autobahn JavaScript Library
 *
 * @version 0.3.1.148
 * @author Joe Gornick <joe@swarmcast.com>
 * @copyright 2009 Swarmcast
 */
(function(u){var v=document,br=v.documentElement,bs=navigator.userAgent,bt=v.createElement('div'),N=Array.prototype.slice;if(typeof u.console==='undefined'){var R=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];u.console={};var Y=(u.opera)?opera.postError:function(){};for(var O=0;O<R.length;++O)u.console[R[O]]=Y}var d={Version:'0.3.1.148',emptyFunction:function(){}};d.Object={isArray:function(a){return Object.prototype.toString.call(a)==='[object Array]'},extend:function(a,b){for(var c in b)a[c]=b[c];return a},keys:function(a){var b=[];for(var c in a)b.push(c);return b},toQueryString:function(a){var b=[];for(var c in a){var f=encodeURIComponent(c),g=a[c];var h=f+'=';if(d.Object.isArray(g)){for(var k=0,i=g.length;k<i;k++){var j=g[k];j=encodeURIComponent((j==null)?'':String(j));b.push(h+j)}}else{g=encodeURIComponent((g==null)?'':String(g));b.push(h+g)}}return b.join('&')}};d.Array={indexOf:(function(){if(Array.prototype.indexOf){return function(a,b,c){return a.indexOf(b,c)}}return function(a,b,c){c=c||0;var f=a.length;if(c<0)c=f+c;for(;c<f;c++)if(a[c]===b)return c;return-1}})()};d.Function={bind:function(a,b){if(arguments.length<3){if(typeof b==='undefined')return a;return function(){return arguments.length?a.apply(b,arguments):a.call(b)}}var c=N.call(arguments,2);return function(){return a.apply(b,arguments.length?mergeList(c,arguments):c)}}};d.String={trim:function(a){var b=new RegExp('^\\s+'),c=new RegExp('\\s+$');return a.replace(b,'').replace(c,'')},toQueryParams:function(a,b){a=String(a);var c=d.String.trim(a).match(/([^?#]*)(#.*)?$/);if(!c||c[0]===a)return{};var f={};var g=c[1].split(b||'&');for(var h=0,k=g.length;h<k;h++){var i;if((i=g[h].split('='))[0]){var j=decodeURIComponent(i.shift());var l=i.length>1?i.join('='):i[0];if(l!=undefined)l=decodeURIComponent(l);if(j in f){if(!d.Object.isArray(f[j]))f[j]=[f[j]];f[j].push(l)}else f[j]=l}}return f}};d.Element={firstDescendant:function(a){a=a.firstChild;while(a&&a.nodeType!==1)a=a.nextSibling;return a}};(function(){var k,i,j,l,p,q;var D=[{string:navigator.userAgent,subString:'Chrome',versionSearch:'Chrome',engineSearch:'AppleWebKit',identity:'Chrome'},{string:navigator.vendor,subString:'Apple',versionSearch:'Version',versionSearchAlt:'Safari',engineSearch:'AppleWebKit',identity:'Safari'},{prop:window.opera,identity:'Opera'},{string:navigator.userAgent,subString:'Camino',versionSearch:'Camino',engineSearch:'Gecko',identity:'Camino'},{string:navigator.userAgent,subString:'Navigator',versionSearch:'Navigator',engineSearch:'Gecko',identity:'Netscape'},{string:navigator.userAgent,subString:'Netscape',versionSearch:'Netscape',engineSearch:'Gecko',identity:'Netscape'},{string:navigator.userAgent,subString:'Netscape6',versionSearch:'Netscape6',engineSearch:'Gecko',identity:'Netscape'},{string:navigator.userAgent,subString:'Firefox',versionSearch:'Firefox',engineSearch:'Gecko',identity:'Firefox'},{string:navigator.userAgent,subString:'MSIE',identity:'IE',versionSearch:'MSIE'},{string:navigator.userAgent,subString:'Gecko',identity:'Mozilla',versionSearch:'rv',engineSearch:'Gecko'},{string:navigator.userAgent,subString:'Mozilla',identity:'Netscape',versionSearch:'Mozilla'}],E=[{string:navigator.userAgent,subString:'Win',identity:'Windows NT',versionSearch:'Windows NT'},{string:navigator.userAgent,subString:'Win',identity:'Windows',versionSearch:'Windows'},{string:navigator.userAgent,subString:'Mac OS X',identity:'Mac OS X',versionSearch:'Mac OS X'},{string:navigator.userAgent,subString:'Mac',identity:'Mac'},{string:navigator.userAgent,subString:'iPhone',identity:'iPhone',versionSearch:'iPhone OS'},{string:navigator.userAgent,subString:'Linux',identity:'Linux'}];var F={'5.0':'2000','5.1':'XP','5.2':'Server 2003','6.0':'Vista','7.0':'7'},G={'10.0':'Cheetah','10.1':'Puma','10.2':'Jaguar','10.3':'Panther','10.4':'Tiger','10.5':'Leopard','10.6':'Snow Leopard'};function w(a){for(var b=0,c=a.length;b<c;b++){var f=a[b],g=f.string,h=f.prop;if(typeof g!=='undefined'){if(g.indexOf(f.subString)!==-1)return f}else if(typeof h!=='undefined'){return f}}}function s(a,b){if(typeof b==='undefined')return;a=a.toLowerCase().split(' ');b=b.toLowerCase();var c=-1;for(var f=0,g=a.length;f<g;f++){if(a[f].indexOf(b)!==-1){c=f;break}}if(c===-1)return;if(b.indexOf('msie')!==-1)return a[c+1].replace(';','')||0;return a[c].split('/')[1]||0}function m(a,b){if(typeof b==='undefined')return;a=a.toLowerCase();b=b.toLowerCase();var c=a.indexOf(b);if(c===-1)return;var f=a.substring(c,a.indexOf(';',c)).replace(b,'');f=f.replace(/^\s+/,'').replace(/\s+$/,'').replace(/_/g,'.');return f}q=w(D);if(q){k=q.identity;i=s(navigator.userAgent,q.versionSearch);if(!i&&q.versionSearchAlt)i=s(navigator.userAgent,q.versionSearchAlt);j=s(navigator.userAgent,q.engineSearch)}var r=w(E);if(r){l=r.identity;p=m(navigator.userAgent,r.versionSearch)}d.Browser={name:k,version:i,engineVersion:j,os:l,osVersion:p,windowsVersionNames:F,macOSXVersionNames:G}})();d.Class=(function(){function l(){var a=null,b=N.call(arguments,0);if(typeof b[0]==='function')a=b.shift();function c(){this.initialize.apply(this,arguments)}d.Object.extend(c,d.Class.Methods);c.superclass=a;c.subclasses=[];if(a){var f=function(){};f.prototype=a.prototype;c.prototype=new f;a.subclasses.push(c)}for(var g=0;g<b.length;g++)c.addMethods(b[g]);if(!c.prototype.initialize)c.prototype.initialize=d.emptyFunction;c.prototype.constructor=c;return c}function p(b){var c=this.superclass&&this.superclass.prototype;var f=d.Object.keys(b);if(!d.Object.keys({toString:true}).length)f.push('toString','valueOf');for(var g=0,h=f.length;g<h;g++){var k=f[g],i=b[k];if(c&&typeof i==='function'&&i.argumentNames()[0]==='$super'){var j=i,i=(function(a){return function(){return c[a].apply(this,arguments)}})(k).wrap(j);i.valueOf=d.Function.bind(j.valueOf,j);i.toString=d.Function.bind(j.toString,j)}this.prototype[k]=i}return this}return{'create':l,'Methods':{'addMethods':p}}})();d.Timer=d.Class.create((function(){function c(a,b){this.callback=a;this.interval=b;this.executing=false;this.onTimerEvent=d.Function.bind(f,this)}function f(){if(!this.executing){this.executing=true;try{this.execute()}catch(e){}if(this.timerID!==null)this.start();this.executing=false}}function g(){this.callback(this)}function h(){this.timerID=u.setTimeout(this.onTimerEvent,this.interval);return this}function k(){if(this.timerID===null)return;u.clearTimeout(this.timerID);this.timerID=null;return this}return{'initialize':c,'execute':g,'start':h,'stop':k}})());d.Utils={};d.Utils.loadScript=function(b,c){c=d.Object.extend({onComplete:d.emptyFunction,onTimeout:d.emptyFunction,id:String(+new Date+Math.random()),timeout:1000},c||{});if(typeof d._3==='undefined')d._3=[];var f=false;var g=false;var h=v.createElement('script');h.id=c.id;h.type='text/javascript';var k=function(){if(d._3[b]){u.clearTimeout(d._3[b]);d._3[b]=null;delete d._3[b]}h.onload=h.onreadystatechange=null;h.src=null;if(h&&h.parentNode!==null)h.parentNode.removeChild(h)};var i=function(){k();c.onComplete.apply(this,arguments)};var j=function(){k();c.onTimeout.apply(this,arguments)};h.onload=function(){g=true;if(!f){f=true;i();return}};h.onreadystatechange=function(){g=true;if(/loaded|complete/.test(h.readyState)){if(!f){f=true;i();return}}};h.src=b;v.getElementsByTagName('HEAD')[0].appendChild(h);var l=function(){if(g)return;if(/loaded|complete/.test(v.readyState)){u.clearTimeout(d._3[b]);d._3[b]=null;if(!f){f=true;i();return}}var a=+new Date;if((a-q)>=c.timeout){j();return}p()};var p=function(a){if(g)return;d._3[a]=u.setTimeout(l,500)};var q=+new Date;p(b);return h};d.Autobahn={requiredVersion:'4.2.17.104'};d.Autobahn.Detection={};(function(){var k=['KITE','LOON','MALLARD','NENE','OSPREY','PUFFIN'];function i(a,b){if(Object.prototype.toString.call(a)!=='[object String]')throw new Error('Required version requires a string.');if(Object.prototype.toString.call(b)!=='[object String]')throw new Error('Autobahn version requires a string.');var c=0;a=a.split('.');if(b.indexOf('(development snapshot)')>-1)return 0;b=b.split('.');while(a.length<4)a.push('0');var f='0';var g=b.pop().split('_');if(g.length>1)f=g.pop();b.push(g.join('_'));b.push(f);f='0';g=a.pop().split('_');if(g.length>1)f=g.pop();a.push(g.join('_'));a.push(f);while((b.length>0)&&((c=j(a.shift(),b.shift()))==0)){}return c}function j(a,b){var c=parseInt(a);var f=parseInt(b);if(String(a)===String(b))return 0;if((!isNaN(c))&&(!isNaN(f)))return f-c;var g=d.Array.indexOf(k,a);var h=d.Array.indexOf(k,b);return h-g}function l(a){a=String(a);if(a.indexOf('Autobahn')>-1)a=a.split(' ')[1];return a}function p(a){a=l(a);if(a.indexOf('(development snapshot)')>-1)return{major:-1,minor:-1,release:-1,build:-1,developmentSnapshot:true};a=a.split('.');while(a.length<4)a.push('0');var b={};for(var c=0,f=a.length;c<f;c++){var g=a[c];if(c==0)b['major']=g;else if(c==1)b['minor']=g;else if(c==2)b['release']=g;else if(c==3)b['build']=g}return b}d.Autobahn.Detection.Version={validate:i,parse:l,parseAsObject:p}})();(function(){var g='/protected/api/img/',h='/protected/api/js/',k='ping.gif',i='ping.js';var j,l;function p(){this._0=v.createElement('img');this._0.onload=d.Function.bind(D,this);this._0.onerror=d.Function.bind(E,this);this._0.style.cssText='position: absolute; display: block; visibility: hidden';v.body.appendChild(this._0)}function q(a,b,c){var f="http://";f+=a;f+=":"+b;f+=c;f+="?unique="+String(+new Date+Math.random());return f}function D(){if(this._0.width>=1&&this._0.height>=1){this._4.stop();w.call(this)}}function E(){this._4.stop();s.call(this)}function F(){if(typeof u.swarmcastVersion!=='undefined'){this._4.stop();this._7=l.parse(u.swarmcastVersion);w.call(this)}}function G(a){this._4.stop();this.stop();if(this._5===j.Status.ACTIVE)return;if(this.options.type===j.Type.JS){if(typeof u.swarmcastVersion!=='undefined'){this._7=l.parse(u.swarmcastVersion);w.call(this);return}}s.call(this)}function w(){this._5=j.Status.ACTIVE;if(!this._8){this._8=true;this.options.onActive(this,this._7)}}function s(){this._5=j.Status.ERROR;if(!this._9){this._9=true;this.options.onError(this)}}function m(a){this.options=d.Object.extend({type:d.Autobahn.Detection.Observer.Type.IMAGE,timeout:1000,host:'local.swarmcast.net',port:8001,assetName:k,onActive:d.emptyFunction,onError:d.emptyFunction},a||{});l=d.Autobahn.Detection.Version;this._b,this._0,this._2,this._7;this._8=false;this._9=false;this._4=new d.Timer(d.Function.bind(G,this),this.options.timeout);this._5=j.Status.ERROR}function r(){this.stop();this._7=null;this._5=j.Status.ERROR;this._8=false;this._9=false;if(this.options.type===j.Type.IMAGE){p.call(this);this._0.src=q(this.options.host,this.options.port,g+this.options.assetName)}else{var a=q(this.options.host,this.options.port,h+this.options.assetName);this._2=d.Utils.loadScript(a,{onComplete:d.Function.bind(F,this),timeout:this.options.timeout})}this._4.interval=this.options.timeout;this._4.start()}function n(){return this._5}function z(){if(this._4)this._4.stop();if(this._0){this._0.onload=this._0.onerror=null;this._0.src='data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D';if(this._0.parentNode!==null)this._0.parentNode.removeChild(this._0);this._0=null}if(this._2){this._2.onload=this._2.onreadystatechange=null;this._2.src=null;if(this._2.parentNode!==null)this._2.parentNode.removeChild(this._2);this._2=null}}j=d.Autobahn.Detection.Observer=d.Class.create({'initialize':m,'start':r,'stop':z,'getStatus':n})})();d.Autobahn.Detection.Observer.Status={ACTIVE:'ACTIVE',ERROR:'ERROR'};d.Autobahn.Detection.Observer.Type={IMAGE:'IMAGE',JS:'JS'};(function(){var h='local.swarmcast.net',k='127.0.0.1',i='ping.gif',j='version.gif',l='ping.js',p='version.js',q=500,D=1000,E=500,F=5000,G=5;var w,s,m,r,n,z=0,o=[],x=[],A=true,H,t,B=false,I=false,J=false,L,P=0;var C,y,S;function Z(a){this.options=d.Object.extend({requiredVersion:d.Autobahn.requiredVersion,timeout:-1,requestTimeout:1000,checkProxy:true,enablePortRangeDetection:false,minPort:8001,maxPort:8005,startPort:8001,onMissing:d.emptyFunction,onUpdateRequired:d.emptyFunction,onVersionCurrent:d.emptyFunction,onTimeout:d.emptyFunction},a||{});y=d.Autobahn.Detection.Observer;S=d.Autobahn.Detection.Version;r=new y({onActive:d.Function.bind(T,this),onError:d.Function.bind(U,this)});s=new d.Timer(d.Function.bind(ba,this),-1);m=new d.Timer(d.Function.bind(bb,this),q);H=C.Status.AUTOBAHN_MISSING;L=this.options.requestTimeout}function K(a,b,c,f,g){a.options.type=b;a.options.host=c;a.options.port=f;a.options.assetName=g;a.options.timeout=L;a.finished=false;I=true;a.start()}function T(a,b){if(A)return;t=b;if(a.options.type===y.Type.IMAGE&&a.options.assetName===i){for(var c=0,f=o.length;c<f;c++){if(o[c]===a)continue;o[c].stop();o[c].finished=true}if(a.options.host===k&&this.options.checkProxy&&!B){B=true;K.apply(this,[a,a.options.type,h,a.options.port,a.options.assetName]);return}if(a.options.host===h&&B)B=false;n=a;L=F;K.apply(this,[a,y.Type.JS,a.options.host,a.options.port,l]);return}if(n&&n===a)z=0;Q.call(this)}function U(a){if(A)return;a.stop();if(a.options.type===y.Type.IMAGE&&a.options.assetName===i){if(a.options.host===h&&this.options.checkProxy){if(B){bc.call(this);n=a;K.apply(this,[a,y.Type.JS,k,a.options.port,l]);return}K.apply(this,[a,y.Type.IMAGE,k,a.options.port,i]);return}if(r===a&&this.options.enablePortRangeDetection&&!J&&!n){var b,c;if(o.length===0){for(b=this.options.minPort;b<=this.options.maxPort;b++){if(b===r.options.port)continue;o.push(new y({port:b,onActive:d.Function.bind(T,this),onError:d.Function.bind(U,this)}))}}J=true;for(b=0,c=o.length;b<c;b++)K.apply(this,[o[b],y.Type.IMAGE,h,o[b].options.port,i]);return}if(J){a.finished=true}}if(a.options.type===y.Type.JS){Q.call(this);return}if(n&&n===a){a.finished=true;if(z===G){z=0;n=null;B=false}else z++;if(!B)a.options.host=h}if(bd.call(this))Q.call(this)}function bd(){if(o.length===0)return true;for(var a=0,b=o.length;a<b;a++)if(!o[a].finished)return false;return true}function bc(){if(o.length===0)return;for(var a=0,b=o.length;a<b;a++)o[a].finished=true}function ba(a){be.call(this)}function bb(){if(A){m.stop();I=false;return}if(!I){if(+new Date-P<=D)return;if(d.Browser.name==='IE')window.location.href='javascript:void(0)';L=E;P=+new Date;if(n)K.apply(this,[n,y.Type.IMAGE,n.options.host,n.options.port,i]);else K.apply(this,[r,y.Type.IMAGE,h,this.options.startPort,i])}}function Q(){var a;if(t&&this.options.requiredVersion)a=S.validate(this.options.requiredVersion,t);if(isNaN(a))bf.call(this);else if(a<0)V.call(this);else if(a>=0)bg.call(this)}function bf(){if(H===C.Status.AUTOBAHN_UPDATE_REQUIRED){V();return}H=C.Status.AUTOBAHN_MISSING;this.options.onMissing(this);M.apply(this,[C.Event.AUTOBAHN_MISSING,{detector:this,version:t}]);I=false;J=false}function V(){H=C.Status.AUTOBAHN_UPDATE_REQUIRED;this.options.onUpdateRequired(this,t);M.apply(this,[C.Event.AUTOBAHN_UPDATE_REQUIRED,{detector:this,version:t}]);I=false;J=false}function bg(){this.stop();H=C.Status.AUTOBAHN_VERSION_CURRENT;this.options.onVersionCurrent(this,t);M.apply(this,[C.Event.AUTOBAHN_VERSION_CURRENT,{detector:this,version:t}]);I=false;J=false}function be(){this.stop();this.options.onTimeout(this,t);M.apply(this,[C.Event.AUTOBAHN_DETECTOR_TIMEOUT,{detector:this,version:t}]);I=false;J=false}function bh(a){if(!A)return;d.Object.extend(this.options,a||{});L=this.options.requestTimeout;A=false;B=false;H=C.Status.AUTOBAHN_MISSING;n=null;z=0;t=null;P=+new Date;K.apply(this,[r,y.Type.IMAGE,h,this.options.startPort,i]);m.start();if(this.options.timeout>-1){s.interval=this.options.timeout;s.start()}}function bi(){if(A)return;A=true;for(var a=0,b=o.length;a<b;a++){o[a].stop();o[a].finished=true}if(r)r.stop();m.stop();s.stop();if(d.Browser.name==='IE')window.location.href='javascript:void(0)'}function bj(){return H}function bk(){return A}function bl(){return t}function W(){if(!n)return null;return n.options.host}function X(){if(!n)return-1;return n.options.port}function bm(){if(!n)return null;return'http://'+W.call(this)+':'+X.call(this)}function bn(){return B}function bo(a,b){if(typeof a==='undefined'||typeof a!=='string')return;if(typeof b==='undefined'||typeof b!=='function')return;if(typeof x[a]==='undefined')x[a]=[];if(d.Array.indexOf(x[a],b)===-1)x[a].push(b)}function bp(a,b){if(typeof a==='undefined'||typeof a!=='string')return;if(typeof b!=='undefined'&&typeof b!=='function')return;if(typeof x[a]==='undefined')return;if(typeof b==='undefined'){x[a]=[]}else{var c=d.Array.indexOf(x[a],b);if(c===-1)return;x[a]=x[a].splice(c,1)}}function M(a,b){if(typeof a==='undefined'||typeof a!=='string')return;if(typeof x[a]==='undefined')return;for(var c=0,f=x[a].length;c<f;c++){var g=x[a][c];g(b)}}function bq(){if(typeof w==='undefined'){w=new function(){Z.apply(this,arguments);this.start=bh;this.stop=bi;this.getStatus=bj;this.getStopped=bk;this.getAutobahnVersion=bl;this.getAutobahnHost=W;this.getAutobahnPort=X;this.getAutobahnBaseUrl=bm;this.getProxyExists=bn;this.addEventListener=bo;this.removeEventListener=bp}}return w}C=d.Autobahn.Detection.Detector={getInstance:bq}})();d.Autobahn.Detection.Detector.Status={AUTOBAHN_DETECTOR_TIMEOUT:'AUTOBAHN_DETECTOR_TIMEOUT',AUTOBAHN_MISSING:'AUTOBAHN_MISSING',AUTOBAHN_UPDATE_REQUIRED:'AUTOBAHN_UPDATE_REQUIRED',AUTOBAHN_VERSION_CURRENT:'AUTOBAHN_VERSION_CURRENT'};d.Autobahn.Detection.Detector.Event={AUTOBAHN_DETECTOR_TIMEOUT:'AUTOBAHN_DETECTOR_TIMEOUT',AUTOBAHN_MISSING:'AUTOBAHN_MISSING',AUTOBAHN_UPDATE_REQUIRED:'AUTOBAHN_UPDATE_REQUIRED',AUTOBAHN_VERSION_CURRENT:'AUTOBAHN_VERSION_CURRENT'};d.Autobahn.Installation={};(function(){var k=true,i,j=null,l=null,p=null;function q(a){this.options=d.Object.extend({appletUrl:'http://www.getautobahn.com/jar/autobahn-bootstrap.jar',environment:'prod',installationAssetPath:null,debug:'false',requiredVersion:d.Autobahn.requiredVersion,appletInitTimeout:3000,autobahnStartTimeout:15000,onReady:d.emptyFunction,onError:d.emptyFunction,onDownloadProgress:d.emptyFunction,onDownloadComplete:d.emptyFunction,onComplete:d.emptyFunction},a||{})}function D(a){var b=[];b.push('<applet');b.push('width="10"');b.push('height="10"');b.push('id="ab_installer_applet"');b.push('code="com.swarmcast.bootstrap.AutobahnBootstrapApplet"');b.push('archive="'+a.appletUrl+'"');b.push('style="width: 1px; height: 1px; float: left;"');b.push('mayscript>');var c=[];c.push('<param name="autobahn.deployment_environment" value="'+a.environment+'" />');if(a.installationAssetPath)c.push('<param name="autobahn.installation.asset.path" value="'+a.installationAssetPath+'" />');c.push('<param name="autobahn.debug.mode" value="'+a.debug+'" />');c.push('<param name="autobahn.version.datum" value="'+a.requiredVersion+'" />');c.push('<param name="autobahn.pong.wait_time.applet_init" value="'+a.appletInitTimeout+'" />');c.push('<param name="autobahn.pong.wait_time.autobahn_startup" value="'+a.autobahnStartTimeout+'" />');var f='Swarmcast.Autobahn.Installation.AppletInstaller';c.push('<param name="autobahn.progress.download.graphical.component" value="'+f+'.getInstance().updateDownloadStatus" />');c.push('<param name="autobahn.progress.error.event.consumer" value="'+f+'.getInstance().showErrorMessage" />');c.push('<param name="autobahn.progress.download.complete.event.consumer" value="'+f+'.getInstance().setDownloadComplete" />');c.push('<param name="autobahn.progress.start.event.consumer" value="'+f+'.getInstance().setAutobahnStarted" />');c.push('<param name="autobahn.applet.start.event.consumer" value="'+f+'.getInstance().setAppletReady" />');c.push('<param name="autobahn.js.started.provider" value="'+f+'.getInstance().isJsReady" />');b.push(c.join(''));b.push('</applet>');var g=v.createElement('DIV');g.innerHTML=b.join(' ');var h=g.firstChild;g=null;return h}function E(){if(p===null)p=+new Date;j=new d.Timer(d.Function.bind(F),1000);j.start()}function F(){var a=Math.abs(p- +new Date)/1000;if((a>=60)&&(l===null)){m.apply(this,['Timed out while waiting for authorization. Please reload the page to try again.']);p=null;j.stop();return}if(l!==null){p=null;j.stop();return}}function G(a){d.Object.extend(this.options,a||{});var b=v.getElementById('ab_installer_applet');if(b)b.parentNode.removeChild(b);E.call(this);v.body.appendChild(D.apply(this,[this.options]))}function w(){return k}function s(){l=+new Date;this.options.onReady()}function m(a){this.options.onError(a)}function r(a){this.options.onDownloadProgress(a)}function n(){this.options.onDownloadComplete()}function z(){this.options.onComplete()}function o(){if(typeof i==='undefined'){i=new function(){q.apply(this,arguments);this.start=G;this.updateDownloadStatus=r;this.showErrorMessage=m;this.setDownloadComplete=n;this.setAutobahnStarted=z;this.setAppletReady=s;this.isJsReady=w}}return i}d.Autobahn.Installation.AppletInstaller={getInstance:o}})();d.Autobahn.Players={};(function(){var i='9.0.115',j='10.0.12.36',l='2.0.31005',p='2.0.31005',q='http://www.swarmcast.com/swf/AutobahnHDPlayer.swf',D='http://www.swarmcast.com/swf/expressInstall.swf',E='http://www.swarmcast.com/xap/Swarmcast.Autobahn.HDPlayer.xap',F=14,G=42,w=16,s=44;var m;function r(){swfobject.expressInstallCallback();t.call(this)}function n(){d.Array.indexOf(m.instances,this)}function z(a){var b={env:this.options.environment,vidWidth:this.options.videoWidth,vidHeight:this.options.videoHeight,defaultVideoURL:this.options.videoFilename||'',autobahnVideoURL:this.options.autobahnVideoUrl||'',imageURL:this.options.thumbnailImageUrl||'',captionText:this.options.caption||'',autoplay:this.options.autoplay,bgColor:this.options.bgColor.replace('#',''),bufferSeconds:this.options.bufferTime,bufferTime:this.options.bufferTime,throttleKbps:this.options.throttleKbps,allowSmoothing:this.options.allowSmoothing};var c={allowFullScreen:'true',allowScriptAccess:'always'};var f={id:this.options.id,name:this.options.id,bgcolor:this.options.bgColor};var g='';if(a){g=this.options.expressInstallerUrl;d.Object.extend(b,{onDeclineCallback:'Swarmcast.Autobahn.Players.HDPlayer.instances['+n.call(this)+']._c()'});d.Object.extend(f,{xiRedirectUrl:location.href})}var h=d.Element.firstDescendant(this._1);if(h)swfobject.removeSWF(h.id);this._1.innerHTML='';var k=v.createElement('div');k.id=this.options.id;this._1.appendChild(k);swfobject.embedSWF(this.options.playerUrl,k.id,this.options.videoWidth+F,this.options.videoHeight+G,i,g,b,c,f);this._a=v.getElementById(k.id)}function o(){var a={videoWidth:this.options.videoWidth,videoHeight:this.options.videoHeight,videoSource:this.options.videoUrl||'',autobahnVideoSource:this.options.autobahnVideoUrl||'',playlistSource:this.options.playlistUrl||'',thumbnailImageSource:this.options.thumbnailImageUrl||'',caption:this.options.caption||'',bgColor:this.options.bgColor,autoplay:this.options.autoplay,bufferTime:this.options.bufferTime};var b='';for(var c in a)b+=c+'='+a[c]+',';b=b.substr(0,b.length-1);Silverlight.createObjectEx({source:this.options.playerUrl,parentElement:this._1,id:this.options.id,properties:{width:this.options.videoWidth+w,height:this.options.videoHeight+s,inplaceInstallPrompt:false,background:this.options.bgColor,isWindowless:false,framerate:'24',version:l,enableHtmlAccess:'true'},events:{},initParams:b,context:null});this._a=v.getElementById(this.options.id)}function x(){this.options.videoWidth=Number(this.options.videoWidth);this.options.videoHeight=Number(this.options.videoHeight)}function A(a){var b='Please upgrade to the latest {0} plug-in by <a href="{1}">clicking here</a>.';if(a===m.Platform.FLASH){b=b.replace('{0}','Flash');b=b.replace('{1}','http://www.adobe.com/go/getflashplayer?redirect='+location.href)}else if(a===m.Platform.SILVERLIGHT){b=b.replace('{0}','Silverlight');b=b.replace('{1}','http://go.microsoft.com/fwlink/?LinkID=124807')}this._1.innerHTML='<p class="hdplayer-plugin-update">'+b+'</p>'}function H(a,b,c){this._1=a;if(typeof this._1==='string')this._1=v.getElementById(a);if(!this._1)throw new Error('Error initializing HDPlayer: Specified container element not found!');this._6=b||m.Platform.FLASH;this.options=d.Object.extend({id:'hdplayer_'+String(+new Date+Math.random()),playerUrl:q,expressInstallerUrl:D,videoWidth:320,videoHeight:180,videoUrl:null,autobahnVideoUrl:null,playlistUrl:null,thumbnailImageUrl:null,caption:null,bgColor:'#FFFFFF',autoplay:false,bufferTime:5,throttleKbps:1500,allowSmoothing:false},c||{});if(this._6===m.Platform.FLASH){if(typeof swfobject==='undefined')throw new Error('Error initializing HDPlayer: SWFObject 2.0+ is required!');}else if(this._6===m.Platform.SILVERLIGHT){if(typeof Silverlight==='undefined')throw new Error('Error initializing HDPlayer: Silverlight.js required!');}if(typeof m.instances==='undefined')m.instances=[];m.instances.push(this)}function t(a,b){d.Object.extend(this.options,a||{});x.call(this);if(this._6===m.Platform.FLASH){var c=d.Element.firstDescendant(this._1);if(c)swfobject.removeSWF(c.id);if(!swfobject.hasFlashPlayerVersion(i))return A.apply(this,[m.Platform.FLASH]);z.call(this)}else if(this._6===m.Platform.SILVERLIGHT){if(!Silverlight.isInstalled(l))return A.apply(this,[m.Platform.SILVERLIGHT]);if(!/\.xap/i.test(this.options.playerUrl))this.options.playerUrl=E;o.call(this)}}function B(){var a=N.call(arguments,0),b=a.shift();var c=this._a.CallFunction('<invoke name="'+b+'" returntype="javascript">'+__flash__argumentsToXML(a,0)+'</invoke>');if(typeof c!=='undefined')return eval(c)}function I(){return this._1}function J(){return this._6}function L(){return this._a}m=d.Autobahn.Players.HDPlayer=d.Class.create({'initialize':H,'build':t,'getContainer':I,'getPlatform':J,'getPlayer':L,'remote':B,'_d':r})})();d.Autobahn.Players.HDPlayer.Platform={SILVERLIGHT:'SILVERLIGHT',FLASH:'FLASH'};u.Swarmcast=d})(this);
