var io=this.io={version:"0.6.2",setPath:function(a){if(window.console&&console.error){console.error("io.setPath will be removed. Please set the variable WEB_SOCKET_SWF_LOCATION pointing to WebSocketMain.swf")}this.path=/\/$/.test(a)?a:a+"/";WEB_SOCKET_SWF_LOCATION=a+"lib/vendor/web-socket-js/WebSocketMain.swf"}};if("jQuery" in this){jQuery.io=this.io}if(typeof window!="undefined"){if(typeof WEB_SOCKET_SWF_LOCATION==="undefined"){WEB_SOCKET_SWF_LOCATION="/socket.io/lib/vendor/web-socket-js/WebSocketMain.swf"}}(function(){var b=this.io;var a=false;b.util={ios:false,load:function(c){if(/loaded|complete/.test(document.readyState)||a){return c()}if("attachEvent" in window){window.attachEvent("onload",c)}else{window.addEventListener("load",c,false)}},inherit:function(e,c){for(var d in c.prototype){e.prototype[d]=c.prototype[d]}},indexOf:function(c,f,g){for(var d=c.length,e=(g<0)?Math.max(0,d+g):g||0;e<d;e++){if(c[e]===f){return e}}return -1},isArray:function(c){return Object.prototype.toString.call(c)==="[object Array]"},merge:function(e,c){for(var d in c){if(c.hasOwnProperty(d)){e[d]=c[d]}}}};b.util.ios=/iphone|ipad/i.test(navigator.userAgent);b.util.android=/android/i.test(navigator.userAgent);b.util.opera=/opera/i.test(navigator.userAgent);b.util.load(function(){a=true})})();(function(){var c=this.io;var a="~m~",b=function(d){if(Object.prototype.toString.call(d)=="[object Object]"){if(!("JSON" in window)){if("console" in window&&console.error){console.error("Trying to encode as JSON, but JSON.stringify is missing.")}return'{ "$error": "Invalid message" }'}return"~j~"+JSON.stringify(d)}else{return String(d)}};Transport=c.Transport=function(e,d){this.base=e;this.options={timeout:15000};c.util.merge(this.options,d)};Transport.prototype.send=function(){throw new Error("Missing send() implementation")};Transport.prototype.connect=function(){throw new Error("Missing connect() implementation")};Transport.prototype.disconnect=function(){throw new Error("Missing disconnect() implementation")};Transport.prototype._encode=function(h){var e="",g,h=c.util.isArray(h)?h:[h];for(var f=0,d=h.length;f<d;f++){g=h[f]===null||h[f]===undefined?"":b(h[f]);e+=a+g.length+a+g}return e};Transport.prototype._decode=function(h){var g=[],f,j;do{if(h.substr(0,3)!==a){return g}h=h.substr(3);f="",j="";for(var e=0,d=h.length;e<d;e++){j=Number(h.substr(e,1));if(h.substr(e,1)==j){f+=j}else{h=h.substr(f.length+a.length);f=Number(f);break}}g.push(h.substr(0,f));h=h.substr(f)}while(h!=="");return g};Transport.prototype._onData=function(g){this._setTimeout();var f=this._decode(g);if(f&&f.length){for(var e=0,d=f.length;e<d;e++){this._onMessage(f[e])}}};Transport.prototype._setTimeout=function(){var d=this;if(this._timeout){clearTimeout(this._timeout)}this._timeout=setTimeout(function(){d._onTimeout()},this.options.timeout)};Transport.prototype._onTimeout=function(){this._onDisconnect()};Transport.prototype._onMessage=function(d){if(!this.sessionid){this.sessionid=d;this._onConnect()}else{if(d.substr(0,3)=="~h~"){this._onHeartbeat(d.substr(3))}else{if(d.substr(0,3)=="~j~"){this.base._onMessage(JSON.parse(d.substr(3)))}else{this.base._onMessage(d)}}}},Transport.prototype._onHeartbeat=function(d){this.send("~h~"+d)};Transport.prototype._onConnect=function(){this.connected=true;this.connecting=false;this.base._onConnect();this._setTimeout()};Transport.prototype._onDisconnect=function(){this.connecting=false;this.connected=false;this.sessionid=null;this.base._onDisconnect()};Transport.prototype._prepareUrl=function(){return(this.base.options.secure?"https":"http")+"://"+this.base.host+":"+this.base.options.port+"/"+this.base.options.resource+"/"+this.type+(this.sessionid?("/"+this.sessionid):"/")}})();(function(){var e=this.io;var d=new Function,a=(function(){if(!("XMLHttpRequest" in window)){return false}var f=new XMLHttpRequest();return f.withCredentials!=undefined})(),c=function(h){if("XDomainRequest" in window&&h){return new XDomainRequest()}if("XMLHttpRequest" in window&&(!h||a)){return new XMLHttpRequest()}if(!h){try{var g=new ActiveXObject("MSXML2.XMLHTTP");return g}catch(i){}try{var f=new ActiveXObject("Microsoft.XMLHTTP");return f}catch(i){}}return false},b=e.Transport.XHR=function(){e.Transport.apply(this,arguments);this._sendBuffer=[]};e.util.inherit(b,e.Transport);b.prototype.connect=function(){this._get();return this};b.prototype._checkSend=function(){if(!this._posting&&this._sendBuffer.length){var f=this._encode(this._sendBuffer);this._sendBuffer=[];this._send(f)}};b.prototype.send=function(f){if(e.util.isArray(f)){this._sendBuffer.push.apply(this._sendBuffer,f)}else{this._sendBuffer.push(f)}this._checkSend();return this};b.prototype._send=function(g){var f=this;this._posting=true;this._sendXhr=this._request("send","POST");this._sendXhr.onreadystatechange=function(){var h;if(f._sendXhr.readyState==4){f._sendXhr.onreadystatechange=d;try{h=f._sendXhr.status}catch(i){}f._posting=false;if(h==200){f._checkSend()}else{f._onDisconnect()}}};this._sendXhr.send("data="+encodeURIComponent(g))};b.prototype.disconnect=function(){this._onDisconnect();return this};b.prototype._onDisconnect=function(){if(this._xhr){this._xhr.onreadystatechange=d;try{this._xhr.abort()}catch(f){}this._xhr=null}if(this._sendXhr){this._sendXhr.onreadystatechange=d;try{this._sendXhr.abort()}catch(f){}this._sendXhr=null}this._sendBuffer=[];e.Transport.prototype._onDisconnect.call(this)};b.prototype._request=function(g,i,f){var h=c(this.base._isXDomain());if(f){h.multipart=true}h.open(i||"GET",this._prepareUrl()+(g?"/"+g:""));if(i=="POST"&&"setRequestHeader" in h){h.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8")}return h};b.check=function(f){try{if(c(f)){return true}}catch(g){}return false};b.xdomainCheck=function(){return b.check(true)};b.request=c})();(function(){var b=this.io;var a=b.Transport.websocket=function(){b.Transport.apply(this,arguments)};b.util.inherit(a,b.Transport);a.prototype.type="websocket";a.prototype.connect=function(){var c=this;this.socket=new WebSocket(this._prepareUrl());this.socket.onmessage=function(d){c._onData(d.data)};this.socket.onclose=function(d){c._onClose()};this.socket.onerror=function(d){c._onError(d)};return this};a.prototype.send=function(c){if(this.socket){this.socket.send(this._encode(c))}return this};a.prototype.disconnect=function(){if(this.socket){this.socket.close()}return this};a.prototype._onClose=function(){this._onDisconnect();return this};a.prototype._onError=function(c){this.base.emit("error",[c])};a.prototype._prepareUrl=function(){if(!this.base.options.websocketport){this.base.options.websocketport=this.base.options.port}if(!this.base.options.websockethost){this.base.options.websockethost=this.base.host}return(this.base.options.secure?"wss":"ws")+"://"+this.base.options.websockethost+":"+this.base.options.websocketport+"/"+this.base.options.resource+"/"+this.type+(this.sessionid?("/"+this.sessionid):"")};a.check=function(){return"WebSocket" in window&&WebSocket.prototype&&(WebSocket.prototype.send&&!!WebSocket.prototype.send.toString().match(/native/i))&&typeof WebSocket!=="undefined"};a.xdomainCheck=function(){return true}})();(function(){var b=this.io;var a=b.Transport.flashsocket=function(){b.Transport.websocket.apply(this,arguments)};b.util.inherit(a,b.Transport.websocket);a.prototype.type="flashsocket";a.prototype.connect=function(){var c=this,d=arguments;WebSocket.__addTask(function(){b.Transport.websocket.prototype.connect.apply(c,d)});return this};a.prototype.send=function(){var c=this,d=arguments;WebSocket.__addTask(function(){b.Transport.websocket.prototype.send.apply(c,d)});return this};a.check=function(){if(typeof WebSocket=="undefined"||!("__addTask" in WebSocket)){return false}if(b.util.opera){return false}if("navigator" in window&&"plugins" in navigator&&navigator.plugins["Shockwave Flash"]){return !!navigator.plugins["Shockwave Flash"].description}if("ActiveXObject" in window){try{return !!new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){}}return false};a.xdomainCheck=function(){return true}})();(function(){var b=this.io;var a=b.Transport.htmlfile=function(){b.Transport.XHR.apply(this,arguments)};b.util.inherit(a,b.Transport.XHR);a.prototype.type="htmlfile";a.prototype._get=function(){var c=this;this._open();window.attachEvent("onunload",function(){c._destroy()})};a.prototype._open=function(){this._doc=new ActiveXObject("htmlfile");this._doc.open();this._doc.write("<html></html>");this._doc.parentWindow.s=this;this._doc.close();var c=this._doc.createElement("div");this._doc.body.appendChild(c);this._iframe=this._doc.createElement("iframe");c.appendChild(this._iframe);this._iframe.src=this._prepareUrl()+"/"+(+new Date)};a.prototype._=function(d,e){this._onData(d);var c=e.getElementsByTagName("script")[0];c.parentNode.removeChild(c)};a.prototype._destroy=function(){if(this._iframe){this._iframe.src="about:blank";this._doc=null;CollectGarbage()}};a.prototype.disconnect=function(){this._destroy();return b.Transport.XHR.prototype.disconnect.call(this)};a.check=function(){if("ActiveXObject" in window){try{var c=new ActiveXObject("htmlfile");return c&&b.Transport.XHR.check()}catch(d){}}return false};a.xdomainCheck=function(){return false}})();(function(){var b=this.io;var a=b.Transport["xhr-multipart"]=function(){b.Transport.XHR.apply(this,arguments)};b.util.inherit(a,b.Transport.XHR);a.prototype.type="xhr-multipart";a.prototype._get=function(){var c=this;this._xhr=this._request("","GET",true);this._xhr.onreadystatechange=function(){if(c._xhr.readyState==4){c._onData(c._xhr.responseText)}};this._xhr.send(null)};a.check=function(){return"XMLHttpRequest" in window&&"prototype" in XMLHttpRequest&&"multipart" in XMLHttpRequest.prototype};a.xdomainCheck=function(){return true}})();(function(){var c=this.io;var a=new Function(),b=c.Transport["xhr-polling"]=function(){c.Transport.XHR.apply(this,arguments)};c.util.inherit(b,c.Transport.XHR);b.prototype.type="xhr-polling";b.prototype.connect=function(){if(c.util.ios||c.util.android){var d=this;c.util.load(function(){setTimeout(function(){c.Transport.XHR.prototype.connect.call(d)},10)})}else{c.Transport.XHR.prototype.connect.call(this)}};b.prototype._get=function(){var d=this;this._xhr=this._request(+new Date,"GET");this._xhr.onreadystatechange=function(){var f;if(d._xhr.readyState==4){d._xhr.onreadystatechange=a;try{f=d._xhr.status}catch(g){}if(f==200){d._onData(d._xhr.responseText);d._get()}else{d._onDisconnect()}}};this._xhr.send(null)};b.check=function(){return c.Transport.XHR.check()};b.xdomainCheck=function(){return c.Transport.XHR.xdomainCheck()}})();(function(){var a=this.io;a.JSONP=[];JSONPPolling=a.Transport["jsonp-polling"]=function(){a.Transport.XHR.apply(this,arguments);this._insertAt=document.getElementsByTagName("script")[0];this._index=a.JSONP.length;a.JSONP.push(this)};a.util.inherit(JSONPPolling,a.Transport["xhr-polling"]);JSONPPolling.prototype.type="jsonp-polling";JSONPPolling.prototype._send=function(i){var k=this;if(!("_form" in this)){var c=document.createElement("FORM"),d=document.createElement("TEXTAREA"),b=this._iframeId="socket_io_iframe_"+this._index,h;c.style.position="absolute";c.style.top="-1000px";c.style.left="-1000px";c.target=b;c.method="POST";c.action=this._prepareUrl()+"/"+(+new Date)+"/"+this._index;d.name="data";c.appendChild(d);this._insertAt.parentNode.insertBefore(c,this._insertAt);document.body.appendChild(c);this._form=c;this._area=d}function f(){g();k._posting=false;k._checkSend()}function g(){if(k._iframe){k._form.removeChild(k._iframe)}try{h=document.createElement('<iframe name="'+k._iframeId+'">')}catch(l){h=document.createElement("iframe");h.name=k._iframeId}h.id=k._iframeId;k._form.appendChild(h);k._iframe=h}g();this._posting=true;this._area.value=i;try{this._form.submit()}catch(j){}if(this._iframe.attachEvent){h.onreadystatechange=function(){if(k._iframe.readyState=="complete"){f()}}}else{this._iframe.onload=f}};JSONPPolling.prototype._get=function(){var c=this,b=document.createElement("SCRIPT");if(this._script){this._script.parentNode.removeChild(this._script);this._script=null}b.async=true;b.src=this._prepareUrl()+"/"+(+new Date)+"/"+this._index;b.onerror=function(){c._onDisconnect()};this._insertAt.parentNode.insertBefore(b,this._insertAt);this._script=b};JSONPPolling.prototype._=function(){this._onData.apply(this,arguments);this._get();return this};JSONPPolling.check=function(){return true};JSONPPolling.xdomainCheck=function(){return true}})();(function(){var b=this.io;var a=b.Socket=function(d,c){this.host=d||document.domain;this.options={secure:false,document:document,port:document.location.port||80,resource:"socket.io",transports:["websocket","flashsocket","htmlfile","xhr-multipart","xhr-polling","jsonp-polling"],transportOptions:{"xhr-polling":{timeout:25000},"jsonp-polling":{timeout:25000}},connectTimeout:5000,reconnect:true,reconnectionDelay:500,maxReconnectionAttempts:5000,tryTransportsOnConnectTimeout:true,rememberTransport:true};b.util.merge(this.options,c);this.connected=false;this.connecting=false;this._events={};this.transport=this.getTransport();if(!this.transport&&"console" in window){console.error("No transport available")}};a.prototype.getTransport=function(f){var c=f||this.options.transports,d;if(this.options.rememberTransport&&!f){d=this.options.document.cookie.match("(?:^|;)\\s*socketio=([^;]*)");if(d){this._rememberedTransport=true;c=[decodeURIComponent(d[1])]}}for(var e=0,g;g=c[e];e++){if(b.Transport[g]&&b.Transport[g].check()&&(!this._isXDomain()||b.Transport[g].xdomainCheck())){return new b.Transport[g](this,this.options.transportOptions[g]||{})}}return null};a.prototype.connect=function(){if(this.transport&&!this.connected){if(this.connecting){this.disconnect(true)}this.connecting=true;this.emit("connecting",[this.transport.type]);this.transport.connect();if(this.options.connectTimeout){var c=this;this.connectTimeoutTimer=setTimeout(function(){if(!c.connected){c.disconnect(true);if(c.options.tryTransportsOnConnectTimeout&&!c._rememberedTransport){if(!c._remainingTransports){c._remainingTransports=c.options.transports.slice(0)}var d=c._remainingTransports;while(d.length>0&&d.splice(0,1)[0]!=c.transport.type){}if(d.length){c.transport=c.getTransport(d);c.connect()}}if(!c._remainingTransports||c._remainingTransports.length==0){c.emit("connect_failed")}}if(c._remainingTransports&&c._remainingTransports.length==0){delete c._remainingTransports}},this.options.connectTimeout)}}return this};a.prototype.send=function(c){if(!this.transport||!this.transport.connected){return this._queue(c)}this.transport.send(c);return this};a.prototype.disconnect=function(c){if(this.connectTimeoutTimer){clearTimeout(this.connectTimeoutTimer)}if(!c){this.options.reconnect=false}this.transport.disconnect();return this};a.prototype.on=function(c,d){if(!(c in this._events)){this._events[c]=[]}this._events[c].push(d);return this};a.prototype.emit=function(d,c){if(d in this._events){var f=this._events[d].concat();for(var e=0,g=f.length;e<g;e++){f[e].apply(this,c===undefined?[]:c)}}return this};a.prototype.removeEvent=function(e,f){if(e in this._events){for(var d=0,c=this._events[e].length;d<c;d++){if(this._events[e][d]==f){this._events[e].splice(d,1)}}}return this};a.prototype._queue=function(c){if(!("_queueStack" in this)){this._queueStack=[]}this._queueStack.push(c);return this};a.prototype._doQueue=function(){if(!("_queueStack" in this)||!this._queueStack.length){return this}this.transport.send(this._queueStack);this._queueStack=[];return this};a.prototype._isXDomain=function(){var c=window.location.port||80;return this.host!==document.domain||this.options.port!=c};a.prototype._onConnect=function(){this.connected=true;this.connecting=false;this._doQueue();if(this.options.rememberTransport){this.options.document.cookie="socketio="+encodeURIComponent(this.transport.type)}this.emit("connect")};a.prototype._onMessage=function(c){this.emit("message",[c])};a.prototype._onDisconnect=function(){var c=this.connected;this.connected=false;this.connecting=false;this._queueStack=[];if(c){this.emit("disconnect");if(this.options.reconnect&&!this.reconnecting){this._onReconnect()}}};a.prototype._onReconnect=function(){this.reconnecting=true;this.reconnectionAttempts=0;this.reconnectionDelay=this.options.reconnectionDelay;var c=this,e=this.options.tryTransportsOnConnectTimeout,g=this.options.rememberTransport;function d(){if(c.connected){c.emit("reconnect",[c.transport.type,c.reconnectionAttempts])}c.removeEvent("connect_failed",f).removeEvent("connect",f);delete c.reconnecting;delete c.reconnectionAttempts;delete c.reconnectionDelay;delete c.reconnectionTimer;delete c.redoTransports;c.options.tryTransportsOnConnectTimeout=e;c.options.rememberTransport=g;return}function f(){if(!c.reconnecting){return}if(!c.connected){if(c.connecting&&c.reconnecting){return c.reconnectionTimer=setTimeout(f,1000)}if(c.reconnectionAttempts++>=c.options.maxReconnectionAttempts){if(!c.redoTransports){c.on("connect_failed",f);c.options.tryTransportsOnConnectTimeout=true;c.transport=c.getTransport(c.options.transports);c.redoTransports=true;c.connect()}else{c.emit("reconnect_failed");d()}}else{c.reconnectionDelay*=2;c.connect();c.emit("reconnecting",[c.reconnectionDelay,c.reconnectionAttempts]);c.reconnectionTimer=setTimeout(f,c.reconnectionDelay)}}else{d()}}this.options.tryTransportsOnConnectTimeout=false;this.reconnectionTimer=setTimeout(f,this.reconnectionDelay);this.on("connect",f)};a.prototype.fire=a.prototype.emit;a.prototype.addListener=a.prototype.addEvent=a.prototype.addEventListener=a.prototype.on;a.prototype.removeListener=a.prototype.removeEventListener=a.prototype.removeEvent})();var swfobject=function(){var aq="undefined",aD="object",ab="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",aE="application/x-shockwave-flash",ac="SWFObjectExprInst",ax="onreadystatechange",af=window,aL=document,aB=navigator,aa=false,Z=[aN],aG=[],ag=[],al=[],aJ,ad,ap,at,ak=false,aU=false,aH,an,aI=true,ah=function(){var a=typeof aL.getElementById!=aq&&typeof aL.getElementsByTagName!=aq&&typeof aL.createElement!=aq,e=aB.userAgent.toLowerCase(),c=aB.platform.toLowerCase(),h=c?/win/.test(c):/win/.test(e),j=c?/mac/.test(c):/mac/.test(e),g=/webkit/.test(e)?parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,d=!+"\v1",f=[0,0,0],k=null;if(typeof aB.plugins!=aq&&typeof aB.plugins[ab]==aD){k=aB.plugins[ab].description;if(k&&!(typeof aB.mimeTypes!=aq&&aB.mimeTypes[aE]&&!aB.mimeTypes[aE].enabledPlugin)){aa=true;d=false;k=k.replace(/^.*\s+(\S+\s+\S+$)/,"$1");f[0]=parseInt(k.replace(/^(.*)\..*$/,"$1"),10);f[1]=parseInt(k.replace(/^.*\.(.*)\s.*$/,"$1"),10);f[2]=/[a-zA-Z]/.test(k)?parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof af.ActiveXObject!=aq){try{var i=new ActiveXObject(X);if(i){k=i.GetVariable("$version");if(k){d=true;k=k.split(" ")[1].split(",");f=[parseInt(k[0],10),parseInt(k[1],10),parseInt(k[2],10)]}}}catch(b){}}}return{w3:a,pv:f,wk:g,ie:d,win:h,mac:j}}(),aK=function(){if(!ah.w3){return}if((typeof aL.readyState!=aq&&aL.readyState=="complete")||(typeof aL.readyState==aq&&(aL.getElementsByTagName("body")[0]||aL.body))){aP()}if(!ak){if(typeof aL.addEventListener!=aq){aL.addEventListener("DOMContentLoaded",aP,false)}if(ah.ie&&ah.win){aL.attachEvent(ax,function(){if(aL.readyState=="complete"){aL.detachEvent(ax,arguments.callee);aP()}});if(af==top){(function(){if(ak){return}try{aL.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}aP()})()}}if(ah.wk){(function(){if(ak){return}if(!/loaded|complete/.test(aL.readyState)){setTimeout(arguments.callee,0);return}aP()})()}aC(aP)}}();function aP(){if(ak){return}try{var b=aL.getElementsByTagName("body")[0].appendChild(ar("span"));b.parentNode.removeChild(b)}catch(a){return}ak=true;var d=Z.length;for(var c=0;c<d;c++){Z[c]()}}function aj(a){if(ak){a()}else{Z[Z.length]=a}}function aC(a){if(typeof af.addEventListener!=aq){af.addEventListener("load",a,false)}else{if(typeof aL.addEventListener!=aq){aL.addEventListener("load",a,false)}else{if(typeof af.attachEvent!=aq){aM(af,"onload",a)}else{if(typeof af.onload=="function"){var b=af.onload;af.onload=function(){b();a()}}else{af.onload=a}}}}}function aN(){if(aa){Y()}else{am()}}function Y(){var d=aL.getElementsByTagName("body")[0];var b=ar(aD);b.setAttribute("type",aE);var a=d.appendChild(b);if(a){var c=0;(function(){if(typeof a.GetVariable!=aq){var e=a.GetVariable("$version");if(e){e=e.split(" ")[1].split(",");ah.pv=[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)]}}else{if(c<10){c++;setTimeout(arguments.callee,10);return}}d.removeChild(b);a=null;am()})()}else{am()}}function am(){var g=aG.length;if(g>0){for(var h=0;h<g;h++){var c=aG[h].id;var l=aG[h].callbackFn;var a={success:false,id:c};if(ah.pv[0]>0){var i=aS(c);if(i){if(ao(aG[h].swfVersion)&&!(ah.wk&&ah.wk<312)){ay(c,true);if(l){a.success=true;a.ref=av(c);l(a)}}else{if(aG[h].expressInstall&&au()){var e={};e.data=aG[h].expressInstall;e.width=i.getAttribute("width")||"0";e.height=i.getAttribute("height")||"0";if(i.getAttribute("class")){e.styleclass=i.getAttribute("class")}if(i.getAttribute("align")){e.align=i.getAttribute("align")}var f={};var d=i.getElementsByTagName("param");var k=d.length;for(var j=0;j<k;j++){if(d[j].getAttribute("name").toLowerCase()!="movie"){f[d[j].getAttribute("name")]=d[j].getAttribute("value")}}ae(e,f,c,l)}else{aF(i);if(l){l(a)}}}}}else{ay(c,true);if(l){var b=av(c);if(b&&typeof b.SetVariable!=aq){a.success=true;a.ref=b}l(a)}}}}}function av(b){var d=null;var c=aS(b);if(c&&c.nodeName=="OBJECT"){if(typeof c.SetVariable!=aq){d=c}else{var a=c.getElementsByTagName(aD)[0];if(a){d=a}}}return d}function au(){return !aU&&ao("6.0.65")&&(ah.win||ah.mac)&&!(ah.wk&&ah.wk<312)}function ae(f,d,h,e){aU=true;ap=e||null;at={success:false,id:h};var a=aS(h);if(a){if(a.nodeName=="OBJECT"){aJ=aO(a);ad=null}else{aJ=a;ad=h}f.id=ac;if(typeof f.width==aq||(!/%$/.test(f.width)&&parseInt(f.width,10)<310)){f.width="310"}if(typeof f.height==aq||(!/%$/.test(f.height)&&parseInt(f.height,10)<137)){f.height="137"}aL.title=aL.title.slice(0,47)+" - Flash Player Installation";var b=ah.ie&&ah.win?"ActiveX":"PlugIn",c="MMredirectURL="+af.location.toString().replace(/&/g,"%26")+"&MMplayerType="+b+"&MMdoctitle="+aL.title;if(typeof d.flashvars!=aq){d.flashvars+="&"+c}else{d.flashvars=c}if(ah.ie&&ah.win&&a.readyState!=4){var g=ar("div");h+="SWFObjectNew";g.setAttribute("id",h);a.parentNode.insertBefore(g,a);a.style.display="none";(function(){if(a.readyState==4){a.parentNode.removeChild(a)}else{setTimeout(arguments.callee,10)}})()}aA(f,d,h)}}function aF(a){if(ah.ie&&ah.win&&a.readyState!=4){var b=ar("div");a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(aO(a),b);a.style.display="none";(function(){if(a.readyState==4){a.parentNode.removeChild(a)}else{setTimeout(arguments.callee,10)}})()}else{a.parentNode.replaceChild(aO(a),a)}}function aO(b){var d=ar("div");if(ah.win&&ah.ie){d.innerHTML=b.innerHTML}else{var e=b.getElementsByTagName(aD)[0];if(e){var a=e.childNodes;if(a){var f=a.length;for(var c=0;c<f;c++){if(!(a[c].nodeType==1&&a[c].nodeName=="PARAM")&&!(a[c].nodeType==8)){d.appendChild(a[c].cloneNode(true))}}}}}return d}function aA(e,g,c){var d,a=aS(c);if(ah.wk&&ah.wk<312){return d}if(a){if(typeof e.id==aq){e.id=c}if(ah.ie&&ah.win){var f="";for(var i in e){if(e[i]!=Object.prototype[i]){if(i.toLowerCase()=="data"){g.movie=e[i]}else{if(i.toLowerCase()=="styleclass"){f+=' class="'+e[i]+'"'}else{if(i.toLowerCase()!="classid"){f+=" "+i+'="'+e[i]+'"'}}}}}var h="";for(var j in g){if(g[j]!=Object.prototype[j]){h+='<param name="'+j+'" value="'+g[j]+'" />'}}a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+f+">"+h+"</object>";ag[ag.length]=e.id;d=aS(e.id)}else{var b=ar(aD);b.setAttribute("type",aE);for(var k in e){if(e[k]!=Object.prototype[k]){if(k.toLowerCase()=="styleclass"){b.setAttribute("class",e[k])}else{if(k.toLowerCase()!="classid"){b.setAttribute(k,e[k])}}}}for(var l in g){if(g[l]!=Object.prototype[l]&&l.toLowerCase()!="movie"){aQ(b,l,g[l])}}a.parentNode.replaceChild(b,a);d=b}}return d}function aQ(b,d,c){var a=ar("param");a.setAttribute("name",d);a.setAttribute("value",c);b.appendChild(a)}function aw(a){var b=aS(a);if(b&&b.nodeName=="OBJECT"){if(ah.ie&&ah.win){b.style.display="none";(function(){if(b.readyState==4){aT(a)}else{setTimeout(arguments.callee,10)}})()}else{b.parentNode.removeChild(b)}}}function aT(a){var b=aS(a);if(b){for(var c in b){if(typeof b[c]=="function"){b[c]=null}}b.parentNode.removeChild(b)}}function aS(a){var c=null;try{c=aL.getElementById(a)}catch(b){}return c}function ar(a){return aL.createElement(a)}function aM(a,c,b){a.attachEvent(c,b);al[al.length]=[a,c,b]}function ao(a){var b=ah.pv,c=a.split(".");c[0]=parseInt(c[0],10);c[1]=parseInt(c[1],10)||0;c[2]=parseInt(c[2],10)||0;return(b[0]>c[0]||(b[0]==c[0]&&b[1]>c[1])||(b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]))?true:false}function az(b,f,a,c){if(ah.ie&&ah.mac){return}var e=aL.getElementsByTagName("head")[0];if(!e){return}var g=(a&&typeof a=="string")?a:"screen";if(c){aH=null;an=null}if(!aH||an!=g){var d=ar("style");d.setAttribute("type","text/css");d.setAttribute("media",g);aH=e.appendChild(d);if(ah.ie&&ah.win&&typeof aL.styleSheets!=aq&&aL.styleSheets.length>0){aH=aL.styleSheets[aL.styleSheets.length-1]}an=g}if(ah.ie&&ah.win){if(aH&&typeof aH.addRule==aD){aH.addRule(b,f)}}else{if(aH&&typeof aL.createTextNode!=aq){aH.appendChild(aL.createTextNode(b+" {"+f+"}"))}}}function ay(a,c){if(!aI){return}var b=c?"visible":"hidden";if(ak&&aS(a)){aS(a).style.visibility=b}else{az("#"+a,"visibility:"+b)}}function ai(b){var a=/[\\\"<>\.;]/;var c=a.exec(b)!=null;return c&&typeof encodeURIComponent!=aq?encodeURIComponent(b):b}var aR=function(){if(ah.ie&&ah.win){window.attachEvent("onunload",function(){var a=al.length;for(var b=0;b<a;b++){al[b][0].detachEvent(al[b][1],al[b][2])}var d=ag.length;for(var c=0;c<d;c++){aw(ag[c])}for(var e in ah){ah[e]=null}ah=null;for(var f in swfobject){swfobject[f]=null}swfobject=null})}}();return{registerObject:function(a,e,c,b){if(ah.w3&&a&&e){var d={};d.id=a;d.swfVersion=e;d.expressInstall=c;d.callbackFn=b;aG[aG.length]=d;ay(a,false)}else{if(b){b({success:false,id:a})}}},getObjectById:function(a){if(ah.w3){return av(a)}},embedSWF:function(k,e,h,f,c,a,b,i,g,j){var d={success:false,id:e};if(ah.w3&&!(ah.wk&&ah.wk<312)&&k&&e&&h&&f&&c){ay(e,false);aj(function(){h+="";f+="";var q={};if(g&&typeof g===aD){for(var o in g){q[o]=g[o]}}q.data=k;q.width=h;q.height=f;var n={};if(i&&typeof i===aD){for(var p in i){n[p]=i[p]}}if(b&&typeof b===aD){for(var l in b){if(typeof n.flashvars!=aq){n.flashvars+="&"+l+"="+b[l]}else{n.flashvars=l+"="+b[l]}}}if(ao(c)){var m=aA(q,n,e);if(q.id==e){ay(e,true)}d.success=true;d.ref=m}else{if(a&&au()){q.data=a;ae(q,n,e,j);return}else{ay(e,true)}}if(j){j(d)}})}else{if(j){j(d)}}},switchOffAutoHideShow:function(){aI=false},ua:ah,getFlashPlayerVersion:function(){return{major:ah.pv[0],minor:ah.pv[1],release:ah.pv[2]}},hasFlashPlayerVersion:ao,createSWF:function(a,b,c){if(ah.w3){return aA(a,b,c)}else{return undefined}},showExpressInstall:function(b,a,d,c){if(ah.w3&&au()){ae(b,a,d,c)}},removeSWF:function(a){if(ah.w3){aw(a)}},createCSS:function(b,a,c,d){if(ah.w3){az(b,a,c,d)}},addDomLoadEvent:aj,addLoadEvent:aC,getQueryParamValue:function(b){var a=aL.location.search||aL.location.hash;if(a){if(/\?/.test(a)){a=a.split("?")[1]}if(b==null){return ai(a)}var c=a.split("&");for(var d=0;d<c.length;d++){if(c[d].substring(0,c[d].indexOf("="))==b){return ai(c[d].substring((c[d].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(aU){var a=aS(ac);if(a&&aJ){a.parentNode.replaceChild(aJ,a);if(ad){ay(ad,true);if(ah.ie&&ah.win){aJ.style.display="block"}}if(ap){ap(at)}}aU=false}}}}();(function(){if(window.WebSocket){return}var a=window.console;if(!a||!a.log||!a.error){a={log:function(){},error:function(){}}}if(!swfobject.hasFlashPlayerVersion("10.0.0")){a.error("Flash Player >= 10.0.0 is required.");return}if(location.protocol=="file:"){a.error("WARNING: web-socket-js doesn't work in file:///... URL unless you set Flash Security Settings properly. Open the page via Web server i.e. http://...")}WebSocket=function(e,h,d,g,f){var c=this;c.__id=WebSocket.__nextId++;WebSocket.__instances[c.__id]=c;c.readyState=WebSocket.CONNECTING;c.bufferedAmount=0;setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(c.__id,e,h,d||null,g||0,f||null)})},0)};WebSocket.prototype.send=function(d){if(this.readyState==WebSocket.CONNECTING){throw"INVALID_STATE_ERR: Web Socket connection has not been established"}var c=WebSocket.__flash.send(this.__id,encodeURIComponent(d));if(c<0){return true}else{this.bufferedAmount+=c;return false}};WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING){return}this.readyState=WebSocket.CLOSING;WebSocket.__flash.close(this.__id)};WebSocket.prototype.addEventListener=function(d,e,c){if(!("__events" in this)){this.__events={}}if(!(d in this.__events)){this.__events[d]=[];if("function"==typeof this["on"+d]){this.__events[d].defaultHandler=this["on"+d];this["on"+d]=this.__createEventHandler(this,d)}}this.__events[d].push(e)};WebSocket.prototype.removeEventListener=function(e,f,c){if(!("__events" in this)){this.__events={}}if(!(e in this.__events)){return}for(var d=this.__events.length;d>-1;--d){if(f===this.__events[e][d]){this.__events[e].splice(d,1);break}}};WebSocket.prototype.dispatchEvent=function(e){if(!("__events" in this)){throw"UNSPECIFIED_EVENT_TYPE_ERR"}if(!(e.type in this.__events)){throw"UNSPECIFIED_EVENT_TYPE_ERR"}for(var d=0,c=this.__events[e.type].length;d<c;++d){this.__events[e.type][d](e);if(e.cancelBubble){break}}if(false!==e.returnValue&&"function"==typeof this.__events[e.type].defaultHandler){this.__events[e.type].defaultHandler(e)}};WebSocket.prototype.__handleEvent=function(c){if("readyState" in c){this.readyState=c.readyState}try{if(c.type=="open"){this.onopen&&this.onopen()}else{if(c.type=="close"){this.onclose&&this.onclose()}else{if(c.type=="error"){this.onerror&&this.onerror(c)}else{if(c.type=="message"){if(this.onmessage){var d=decodeURIComponent(c.message);var f;if(window.MessageEvent&&!window.opera){f=document.createEvent("MessageEvent");f.initMessageEvent("message",false,false,d,null,null,window,null)}else{f={data:d}}this.onmessage(f)}}else{throw"unknown event type: "+c.type}}}}}catch(f){a.error(f.toString())}};WebSocket.prototype.__createEventHandler=function(c,d){return function(g){var f=new b();f.initEvent(d,true,true);f.target=f.currentTarget=c;for(var e in g){f[e]=g[e]}c.dispatchEvent(f,arguments)}};WebSocket.CONNECTING=0;WebSocket.OPEN=1;WebSocket.CLOSING=2;WebSocket.CLOSED=3;WebSocket.__flash=null;WebSocket.__instances={};WebSocket.__tasks=[];WebSocket.__nextId=0;WebSocket.__initialize=function(){if(WebSocket.__flash){return}if(WebSocket.__swfLocation){window.WEB_SOCKET_SWF_LOCATION=WebSocket.__swfLocation}if(!window.WEB_SOCKET_SWF_LOCATION){a.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");return}var c=document.createElement("div");c.id="webSocketContainer";c.style.position="absolute";if(WebSocket.__isFlashLite()){c.style.left="0px";c.style.top="0px"}else{c.style.left="-100px";c.style.top="-100px"}var d=document.createElement("div");d.id="webSocketFlash";c.appendChild(d);document.body.appendChild(c);swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:true,swliveconnect:true,allowScriptAccess:"always"},null,function(f){if(!f.success){a.error("[WebSocket] swfobject.embedSWF failed")}})};WebSocket.loadFlashPolicyFile=function(c){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(c)})};WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash");WebSocket.__flash.setCallerUrl(location.href);WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var c=0;c<WebSocket.__tasks.length;++c){WebSocket.__tasks[c]()}WebSocket.__tasks=[]},0)};WebSocket.__onFlashEvent=function(){setTimeout(function(){var d=WebSocket.__flash.receiveEvents();for(var c=0;c<d.length;++c){WebSocket.__instances[d[c].webSocketId].__handleEvent(d[c])}},0);return true};WebSocket.__log=function(c){a.log(decodeURIComponent(c))};WebSocket.__error=function(c){a.error(decodeURIComponent(c))};WebSocket.__addTask=function(c){if(WebSocket.__flash){c()}else{WebSocket.__tasks.push(c)}};WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes){return false}var c=window.navigator.mimeTypes["application/x-shockwave-flash"];if(!c||!c.enabledPlugin||!c.enabledPlugin.filename){return false}return c.enabledPlugin.filename.match(/flashlite/i)?true:false};function b(){}b.prototype.cancelable=true;b.prototype.cancelBubble=false;b.prototype.preventDefault=function(){if(this.cancelable){this.returnValue=false}};b.prototype.stopPropagation=function(){this.cancelBubble=true};b.prototype.initEvent=function(c,e,d){this.type=c;this.cancelable=d;this.timeStamp=new Date()};if(!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION){if(window.addEventListener){window.addEventListener("load",function(){WebSocket.__initialize()},false)}else{window.attachEvent("onload",function(){WebSocket.__initialize()})}}})();
