Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add CommonJS support

  • Loading branch information...
commit 35f4b2337ef910e387626ebbd4785b124e8cffec 1 parent b88f528
@maccman authored
View
4 Rakefile
@@ -3,12 +3,14 @@ require "yui/compressor"
require "fileutils"
require "sprockets"
-APP_PATH = File.expand_path("./public/application.js")
+APP_PATH = File.expand_path("./public/application.js")
+CLIENT_PATH = File.expand_path("./client.js")
task :build do
env = Sprockets::Environment.new
env.append_path 'client/vendor/assets/javascripts'
File.open(APP_PATH, 'w') { |f| f << env['juggernaut.js'].to_s }
+ File.open(CLIENT_PATH, 'w') { |f| f << env['juggernaut.js'].to_s }
end
task :compress do
View
4,326 client.js
4,326 additions, 0 deletions not shown
View
5 client/vendor/assets/javascripts/juggernaut.js
@@ -1,5 +1,3 @@
-// For sprockets:
-//
//= require json
//= require socket_io
@@ -137,3 +135,6 @@ Juggernaut.Message.prototype.toJSON = function(){
}
return(JSON.stringify(object));
};
+
+if (typeof module != "undefined")
+ module.exports = Juggernaut;
View
2  public/application.js
@@ -1,3 +1,3 @@
var JSON;if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
/*! Socket.IO.js build:0.8.4, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
-(function(a){var b=a;b.version="0.8.4";b.protocol=1;b.transports=[];b.j=[];b.sockets={};b.connect=function(g,e){var f=b.util.parseUri(g),h,c;if("undefined"!=typeof document){f.protocol=f.protocol||document.location.protocol.slice(0,-1);f.host=f.host||document.domain;f.port=f.port||document.location.port}h=b.util.uniqueUri(f);var d={host:f.host,secure:"https"==f.protocol,port:f.port||("https"==f.protocol?443:80),query:f.query||""};b.util.merge(d,e);if(d["force new connection"]||!b.sockets[h]){c=new b.Socket(d)}if(!d["force new connection"]&&c){b.sockets[h]=c}c=c||b.sockets[h];return c.of(f.path.length>1?f.path:"")}})("object"===typeof module?module.exports:(window.io={}));(function(b,d){var a=b.util={};var c=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];a.parseUri=function(l){var h=c.exec(l||""),k={},j=14;while(j--){k[e[j]]=h[j]||""}return k};a.uniqueUri=function(j){var k=j.protocol,i=j.host,h=j.port;if("document" in d){i=i||document.domain;h=h||(k=="https"&&document.location.protocol!=="https:"?443:document.location.port)}else{i=i||"localhost";if(!h&&k=="https"){h=443}}return(k||"http")+"://"+i+":"+(h||80)};a.query=function(l,h){var k=a.chunkQuery(l||""),j=[];a.merge(k,a.chunkQuery(h||""));for(var i in k){if(k.hasOwnProperty(i)){j.push(i+"="+k[i])}}return j.length?"?"+j.join("&"):""};a.chunkQuery=function(h){var n={},o=h.split("&"),k=0,j=o.length,m;for(;k<j;++k){m=o[k].split("=");if(m[0]){n[m[0]]=decodeURIComponent(m[1])}}return n};var f=false;a.load=function(h){if("document" in d&&document.readyState==="complete"||f){return h()}a.on(d,"load",h,false)};a.on=function(i,k,j,h){if(i.attachEvent){i.attachEvent("on"+k,j)}else{if(i.addEventListener){i.addEventListener(k,j,h)}}};a.request=function(h){if("undefined"!=typeof window){if(h&&window.XDomainRequest){return new XDomainRequest()}if(window.XMLHttpRequest&&(!h||a.ua.hasCORS)){return new XMLHttpRequest()}if(!h){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}}return null};if("undefined"!=typeof window){a.load(function(){f=true})}a.defer=function(h){if(!a.ua.webkit){return h()}a.load(function(){setTimeout(h,100)})};a.merge=function g(l,h,i,k){var j=k||[],m=typeof i=="undefined"?2:i,n;for(n in h){if(h.hasOwnProperty(n)&&a.indexOf(j,n)<0){if(typeof l[n]!=="object"||!m){l[n]=h[n];j.push(h[n])}else{a.merge(l[n],h[n],m-1,j)}}}return l};a.mixin=function(i,h){a.merge(i.prototype,h.prototype)};a.inherit=function(i,h){function j(){}j.prototype=h.prototype;i.prototype=new j};a.isArray=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"};a.intersect=function(h,k){var m=[],o=h.length>k.length?h:k,p=h.length>k.length?k:h;for(var n=0,j=p.length;n<j;n++){if(~a.indexOf(o,p[n])){m.push(p[n])}}return m};a.indexOf=function(h,m,l){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(h,m,l)}for(var k=h.length,l=l<0?l+k<0?0:l+k:l||0;l<k&&h[l]!==m;l++){}return k<=l?-1:l};a.toArray=function(m){var h=[];for(var k=0,j=m.length;k<j;k++){h.push(m[k])}return h};a.ua={};a.ua.hasCORS="undefined"!=typeof window&&window.XMLHttpRequest&&(function(){try{var h=new XMLHttpRequest()}catch(i){return false}return h.withCredentials!=undefined})();a.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent)})("undefined"!=typeof window?io:module.exports,this);(function(a,c){a.EventEmitter=b;function b(){}b.prototype.on=function(d,e){if(!this.$events){this.$events={}}if(!this.$events[d]){this.$events[d]=e}else{if(c.util.isArray(this.$events[d])){this.$events[d].push(e)}else{this.$events[d]=[this.$events[d],e]}}return this};b.prototype.addListener=b.prototype.on;b.prototype.once=function(f,g){var e=this;function d(){e.removeListener(f,d);g.apply(this,arguments)}d.listener=g;this.on(f,d);return this};b.prototype.removeListener=function(e,g){if(this.$events&&this.$events[e]){var h=this.$events[e];if(c.util.isArray(h)){var j=-1;for(var f=0,d=h.length;f<d;f++){if(h[f]===g||(h[f].listener&&h[f].listener===g)){j=f;break}}if(j<0){return this}h.splice(j,1);if(!h.length){delete this.$events[e]}}else{if(h===g||(h.listener&&h.listener===g)){delete this.$events[e]}}}return this};b.prototype.removeAllListeners=function(d){if(this.$events&&this.$events[d]){this.$events[d]=null}return this};b.prototype.listeners=function(d){if(!this.$events){this.$events={}}if(!this.$events[d]){this.$events[d]=[]}if(!c.util.isArray(this.$events[d])){this.$events[d]=[this.$events[d]]}return this.$events[d]};b.prototype.emit=function(f){if(!this.$events){return false}var j=this.$events[f];if(!j){return false}var e=Array.prototype.slice.call(arguments,1);if("function"==typeof j){j.apply(this,e)}else{if(c.util.isArray(j)){var h=j.slice();for(var g=0,d=h.length;g<d;g++){h[g].apply(this,e)}}else{return false}}return true}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,nativeJSON){if(nativeJSON&&nativeJSON.parse){return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify}}var JSON=exports.JSON={};function f(n){return n<10?"0"+n:n}function date(d,key){return isFinite(d.valueOf())?d.getUTCFullYear()+"-"+f(d.getUTCMonth()+1)+"-"+f(d.getUTCDate())+"T"+f(d.getUTCHours())+":"+f(d.getUTCMinutes())+":"+f(d.getUTCSeconds())+"Z":null}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value instanceof Date){value=date(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})};JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}})("undefined"!=typeof io?io:module.exports,typeof JSON!=="undefined"?JSON:undefined);(function(d,g){var a=d.parser={};var e=a.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"];var b=a.reasons=["transport not supported","client not handshaken","unauthorized"];var c=a.advice=["reconnect"];var i=g.JSON,h=g.util.indexOf;a.encodePacket=function(k){var p=h(e,k.type),j=k.id||"",r=k.endpoint||"",s=k.ack,n=null;switch(k.type){case"error":var o=k.reason?h(b,k.reason):"",l=k.advice?h(c,k.advice):"";if(o!==""||l!==""){n=o+(l!==""?("+"+l):"")}break;case"message":if(k.data!==""){n=k.data}break;case"event":var q={name:k.name};if(k.args&&k.args.length){q.args=k.args}n=i.stringify(q);break;case"json":n=i.stringify(k.data);break;case"connect":if(k.qs){n=k.qs}break;case"ack":n=k.ackId+(k.args&&k.args.length?"+"+i.stringify(k.args):"");break}var m=[p,j+(s=="data"?"+":""),r];if(n!==null&&n!==undefined){m.push(n)}return m.join(":")};a.encodePayload=function(o){var k="";if(o.length==1){return o[0]}for(var m=0,j=o.length;m<j;m++){var n=o[m];k+="\ufffd"+n.length+"\ufffd"+o[m]}return k};var f=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;a.decodePacket=function(l){var k=l.match(f);if(!k){return{}}var o=k[2]||"",l=k[5]||"",n={type:e[k[1]],endpoint:k[4]||""};if(o){n.id=o;if(k[3]){n.ack="data"}else{n.ack=true}}switch(n.type){case"error":var k=l.split("+");n.reason=b[k[0]]||"";n.advice=c[k[1]]||"";break;case"message":n.data=l||"";break;case"event":try{var j=i.parse(l);n.name=j.name;n.args=j.args}catch(m){}n.args=n.args||[];break;case"json":try{n.data=i.parse(l)}catch(m){}break;case"connect":n.qs=l||"";break;case"ack":var k=l.match(/^([0-9]+)(\+)?(.*)/);if(k){n.ackId=k[1];n.args=[];if(k[3]){try{n.args=k[3]?i.parse(k[3]):[]}catch(m){}}}break;case"disconnect":case"heartbeat":break}return n};a.decodePayload=function(m){if(m.charAt(0)=="\ufffd"){var j=[];for(var k=1,l="";k<m.length;k++){if(m.charAt(k)=="\ufffd"){j.push(a.decodePacket(m.substr(k+1).substr(0,l)));k+=Number(l)+1;l=""}else{l+=m.charAt(k)}}return j}else{return[a.decodePacket(m)]}}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(a,c){a.Transport=b;function b(d,e){this.socket=d;this.sessid=e}c.util.mixin(b,c.EventEmitter);b.prototype.onData=function(g){this.clearCloseTimeout();this.setCloseTimeout();if(g!==""){var f=c.parser.decodePayload(g);if(f&&f.length){for(var e=0,d=f.length;e<d;e++){this.onPacket(f[e])}}}return this};b.prototype.onPacket=function(d){if(d.type=="heartbeat"){return this.onHeartbeat()}if(d.type=="connect"&&d.endpoint==""){this.onConnect()}this.socket.onPacket(d);return this};b.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var d=this;this.closeTimeout=setTimeout(function(){d.onDisconnect()},this.socket.closeTimeout)}};b.prototype.onDisconnect=function(){if(this.close){this.close()}this.clearTimeouts();this.socket.onDisconnect();return this};b.prototype.onConnect=function(){this.socket.onConnect();return this};b.prototype.clearCloseTimeout=function(){if(this.closeTimeout){clearTimeout(this.closeTimeout);this.closeTimeout=null}};b.prototype.clearTimeouts=function(){this.clearCloseTimeout();if(this.reopenTimeout){clearTimeout(this.reopenTimeout)}};b.prototype.packet=function(d){this.send(c.parser.encodePacket(d))};b.prototype.onHeartbeat=function(d){this.packet({type:"heartbeat"})};b.prototype.onOpen=function(){this.open=true;this.clearCloseTimeout();this.socket.onOpen()};b.prototype.onClose=function(){var d=this;this.open=false;this.setCloseTimeout();this.socket.onClose()};b.prototype.prepareUrl=function(){var d=this.socket.options;return this.scheme()+"://"+d.host+":"+d.port+"/"+d.resource+"/"+c.protocol+"/"+this.name+"/"+this.sessid};b.prototype.ready=function(d,e){e.call(this)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,e,c){b.Socket=a;function a(g){this.options={port:80,secure:false,document:"document" in c?document:false,resource:"socket.io",transports:e.transports,"connect timeout":10000,"try multiple transports":true,reconnect:true,"reconnection delay":500,"reconnection limit":Infinity,"reopen delay":3000,"max reconnection attempts":10,"sync disconnect on unload":true,"auto connect":true,"flash policy port":10843};e.util.merge(this.options,g);this.connected=false;this.open=false;this.connecting=false;this.reconnecting=false;this.namespaces={};this.buffer=[];this.doBuffer=false;if(this.options["sync disconnect on unload"]&&(!this.isXDomain()||e.util.ua.hasCORS)){var f=this;e.util.on(c,"beforeunload",function(){f.disconnectSync()},false)}if(this.options["auto connect"]){this.connect()}}e.util.mixin(a,e.EventEmitter);a.prototype.of=function(f){if(!this.namespaces[f]){this.namespaces[f]=new e.SocketNamespace(this,f);if(f!==""){this.namespaces[f].packet({type:"connect"})}}return this.namespaces[f]};a.prototype.publish=function(){this.emit.apply(this,arguments);var g;for(var f in this.namespaces){if(this.namespaces.hasOwnProperty(f)){g=this.of(f);g.$emit.apply(g,arguments)}}};function d(){}a.prototype.handshake=function(l){var h=this,j=this.options;function f(n){if(n instanceof Error){h.onError(n.message)}else{l.apply(null,n.split(":"))}}var i=["http"+(j.secure?"s":"")+":/",j.host+":"+j.port,this.options.resource,e.protocol,e.util.query(this.options.query,"t="+ +new Date)].join("/");if(this.isXDomain()){var k=document.getElementsByTagName("script")[0],g=document.createElement("script");g.src=i+"&jsonp="+e.j.length;k.parentNode.insertBefore(g,k);e.j.push(function(n){f(n);g.parentNode.removeChild(g)})}else{var m=e.util.request();m.open("GET",i,true);m.onreadystatechange=function(){if(m.readyState==4){m.onreadystatechange=d;if(m.status==200){f(m.responseText)}else{!h.reconnecting&&h.onError(m.responseText)}}};m.send(null)}};a.prototype.getTransport=function(j){var f=j||this.transports,g;for(var h=0,k;k=f[h];h++){if(e.Transport[k]&&e.Transport[k].check(this)&&(!this.isXDomain()||e.Transport[k].xdomainCheck())){return new e.Transport[k](this,this.sessionid)}}return null};a.prototype.connect=function(g){if(this.connecting){return this}var f=this;this.handshake(function(h,k,l,j){f.sessionid=h;f.closeTimeout=l*1000;f.heartbeatTimeout=k*1000;f.transports=e.util.intersect(j.split(","),f.options.transports);function i(m){if(f.transport){f.transport.clearTimeouts()}f.transport=f.getTransport(m);if(!f.transport){return f.publish("connect_failed")}f.transport.ready(f,function(){f.connecting=true;f.publish("connecting",f.transport.name);f.transport.open();if(f.options["connect timeout"]){f.connectTimeoutTimer=setTimeout(function(){if(!f.connected){f.connecting=false;if(f.options["try multiple transports"]){if(!f.remainingTransports){f.remainingTransports=f.transports.slice(0)}var n=f.remainingTransports;while(n.length>0&&n.splice(0,1)[0]!=f.transport.name){}if(n.length){i(n)}else{f.publish("connect_failed")}}}},f.options["connect timeout"])}})}i();f.once("connect",function(){clearTimeout(f.connectTimeoutTimer);g&&typeof g=="function"&&g()})});return this};a.prototype.packet=function(f){if(this.connected&&!this.doBuffer){this.transport.packet(f)}else{this.buffer.push(f)}return this};a.prototype.setBuffer=function(f){this.doBuffer=f;if(!f&&this.connected&&this.buffer.length){this.transport.payload(this.buffer);this.buffer=[]}};a.prototype.disconnect=function(){if(this.connected){if(this.open){this.of("").packet({type:"disconnect"})}this.onDisconnect("booted")}return this};a.prototype.disconnectSync=function(){var g=e.util.request(),f=this.resource+"/"+e.protocol+"/"+this.sessionid;g.open("GET",f,true);this.onDisconnect("booted")};a.prototype.isXDomain=function(){var f=window.location.port||("https:"==window.location.protocol?443:80);return this.options.host!==document.domain||this.options.port!=f};a.prototype.onConnect=function(){if(!this.connected){this.connected=true;this.connecting=false;if(!this.doBuffer){this.setBuffer(false)}this.emit("connect")}};a.prototype.onOpen=function(){this.open=true};a.prototype.onClose=function(){this.open=false};a.prototype.onPacket=function(f){this.of(f.endpoint).onPacket(f)};a.prototype.onError=function(f){if(f&&f.advice){if(f.advice==="reconnect"&&this.connected){this.disconnect();this.reconnect()}}this.publish("error",f&&f.reason?f.reason:f)};a.prototype.onDisconnect=function(g){var f=this.connected;this.connected=false;this.connecting=false;this.open=false;if(f){this.transport.close();this.transport.clearTimeouts();this.publish("disconnect",g);if("booted"!=g&&this.options.reconnect&&!this.reconnecting){this.reconnect()}}};a.prototype.reconnect=function(){this.reconnecting=true;this.reconnectionAttempts=0;this.reconnectionDelay=this.options["reconnection delay"];var i=this,h=this.options["max reconnection attempts"],f=this.options["try multiple transports"],g=this.options["reconnection limit"];function j(){if(i.connected){for(var l in i.namespaces){if(i.namespaces.hasOwnProperty(l)&&""!==l){i.namespaces[l].packet({type:"connect"})}}i.publish("reconnect",i.transport.name,i.reconnectionAttempts)}i.removeListener("connect_failed",k);i.removeListener("connect",k);i.reconnecting=false;delete i.reconnectionAttempts;delete i.reconnectionDelay;delete i.reconnectionTimer;delete i.redoTransports;i.options["try multiple transports"]=f}function k(){if(!i.reconnecting){return}if(i.connected){return j()}if(i.connecting&&i.reconnecting){return i.reconnectionTimer=setTimeout(k,1000)}if(i.reconnectionAttempts++>=h){if(!i.redoTransports){i.on("connect_failed",k);i.options["try multiple transports"]=true;i.transport=i.getTransport();i.redoTransports=true;i.connect()}else{i.publish("reconnect_failed");j()}}else{if(i.reconnectionDelay<g){i.reconnectionDelay*=2}i.connect();i.publish("reconnecting",i.reconnectionDelay,i.reconnectionAttempts);i.reconnectionTimer=setTimeout(k,i.reconnectionDelay)}}this.options["try multiple transports"]=false;this.reconnectionTimer=setTimeout(k,this.reconnectionDelay);this.on("connect",k)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,d){a.SocketNamespace=b;function b(e,f){this.socket=e;this.name=f||"";this.flags={};this.json=new c(this,"json");this.ackPackets=0;this.acks={}}d.util.mixin(b,d.EventEmitter);b.prototype.$emit=d.EventEmitter.prototype.emit;b.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)};b.prototype.packet=function(e){e.endpoint=this.name;this.socket.packet(e);this.flags={};return this};b.prototype.send=function(f,e){var g={type:this.flags.json?"json":"message",data:f};if("function"==typeof e){g.id=++this.ackPackets;g.ack=true;this.acks[g.id]=e}return this.packet(g)};b.prototype.emit=function(f){var e=Array.prototype.slice.call(arguments,1),h=e[e.length-1],g={type:"event",name:f};if("function"==typeof h){g.id=++this.ackPackets;g.ack="data";this.acks[g.id]=h;e=e.slice(0,e.length-1)}g.args=e;return this.packet(g)};b.prototype.disconnect=function(){if(this.name===""){this.socket.disconnect()}else{this.packet({type:"disconnect"});this.$emit("disconnect")}return this};b.prototype.onPacket=function(f){var e=this;function h(){e.packet({type:"ack",args:d.util.toArray(arguments),ackId:f.id})}switch(f.type){case"connect":this.$emit("connect");break;case"disconnect":if(this.name===""){this.socket.onDisconnect(f.reason||"booted")}else{this.$emit("disconnect",f.reason)}break;case"message":case"json":var g=["message",f.data];if(f.ack=="data"){g.push(h)}else{if(f.ack){this.packet({type:"ack",ackId:f.id})}}this.$emit.apply(this,g);break;case"event":var g=[f.name].concat(f.args);if(f.ack=="data"){g.push(h)}this.$emit.apply(this,g);break;case"ack":if(this.acks[f.ackId]){this.acks[f.ackId].apply(this,f.args);delete this.acks[f.ackId]}break;case"error":if(f.advice){this.socket.onError(f)}else{if(f.reason=="unauthorized"){this.$emit("connect_failed",f.reason)}else{this.$emit("error",f.reason)}}break}};function c(f,e){this.namespace=f;this.name=e}c.prototype.send=function(){this.namespace.flags[this.name]=true;this.namespace.send.apply(this.namespace,arguments)};c.prototype.emit=function(){this.namespace.flags[this.name]=true;this.namespace.emit.apply(this.namespace,arguments)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,c){b.websocket=a;function a(d){c.Transport.apply(this,arguments)}c.util.inherit(a,c.Transport);a.prototype.name="websocket";a.prototype.open=function(){var f=c.util.query(this.socket.options.query),e=this,d;if(!d){d=window.MozWebSocket||window.WebSocket}this.websocket=new d(this.prepareUrl()+f);this.websocket.onopen=function(){e.onOpen();e.socket.setBuffer(false)};this.websocket.onmessage=function(g){e.onData(g.data)};this.websocket.onclose=function(){e.onClose();e.socket.setBuffer(true)};this.websocket.onerror=function(g){e.onError(g)};return this};a.prototype.send=function(d){this.websocket.send(d);return this};a.prototype.payload=function(d){for(var f=0,e=d.length;f<e;f++){this.packet(d[f])}return this};a.prototype.close=function(){this.websocket.close();return this};a.prototype.onError=function(d){this.socket.onError(d)};a.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"};a.check=function(){return("WebSocket" in window&&!("__addTask" in WebSocket))||"MozWebSocket" in window};a.xdomainCheck=function(){return true};c.transports.push("websocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,c){b.flashsocket=a;function a(){c.Transport.websocket.apply(this,arguments)}c.util.inherit(a,c.Transport.websocket);a.prototype.name="flashsocket";a.prototype.open=function(){var d=this,e=arguments;WebSocket.__addTask(function(){c.Transport.websocket.prototype.open.apply(d,e)});return this};a.prototype.send=function(){var d=this,e=arguments;WebSocket.__addTask(function(){c.Transport.websocket.prototype.send.apply(d,e)});return this};a.prototype.close=function(){WebSocket.__tasks.length=0;c.Transport.websocket.prototype.close.call(this);return this};a.prototype.ready=function(d,f){function g(){var i=d.options,h=i["flash policy port"],j=["http"+(i.secure?"s":"")+":/",i.host+":"+i.port,i.resource,"static/flashsocket","WebSocketMain"+(d.isXDomain()?"Insecure":"")+".swf"];if(!a.loaded){if(typeof WEB_SOCKET_SWF_LOCATION==="undefined"){WEB_SOCKET_SWF_LOCATION=j.join("/")}if(h!==843){WebSocket.loadFlashPolicyFile("xmlsocket://"+i.host+":"+h)}WebSocket.__initialize();a.loaded=true}f.call(e)}var e=this;if(document.body){return g()}c.util.load(g)};a.check=function(){if(typeof WebSocket=="undefined"||!("__initialize" in WebSocket)||!swfobject){return false}return swfobject.getFlashPlayerVersion().major>=10};a.xdomainCheck=function(){return true};if(typeof window!="undefined"){WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=true}c.transports.push("flashsocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);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(d,e,c,g,f){var b=this;b.__id=WebSocket.__nextId++;WebSocket.__instances[b.__id]=b;b.readyState=WebSocket.CONNECTING;b.bufferedAmount=0;b.__events={};if(!e){e=[]}else{if(typeof e=="string"){e=[e]}}setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(b.__id,d,e,c||null,g||0,f||null)})},0)};WebSocket.prototype.send=function(c){if(this.readyState==WebSocket.CONNECTING){throw"INVALID_STATE_ERR: Web Socket connection has not been established"}var b=WebSocket.__flash.send(this.__id,encodeURIComponent(c));if(b<0){return true}else{this.bufferedAmount+=b;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(c,d,b){if(!(c in this.__events)){this.__events[c]=[]}this.__events[c].push(d)};WebSocket.prototype.removeEventListener=function(e,f,b){if(!(e in this.__events)){return}var d=this.__events[e];for(var c=d.length-1;c>=0;--c){if(d[c]===f){d.splice(c,1);break}}};WebSocket.prototype.dispatchEvent=function(e){var c=this.__events[e.type]||[];for(var b=0;b<c.length;++b){c[b](e)}var d=this["on"+e.type];if(d){d(e)}};WebSocket.prototype.__handleEvent=function(d){if("readyState" in d){this.readyState=d.readyState}if("protocol" in d){this.protocol=d.protocol}var b;if(d.type=="open"||d.type=="error"){b=this.__createSimpleEvent(d.type)}else{if(d.type=="close"){b=this.__createSimpleEvent("close")}else{if(d.type=="message"){var c=decodeURIComponent(d.message);b=this.__createMessageEvent("message",c)}else{throw"unknown event type: "+d.type}}}this.dispatchEvent(b)};WebSocket.prototype.__createSimpleEvent=function(b){if(document.createEvent&&window.Event){var c=document.createEvent("Event");c.initEvent(b,false,false);return c}else{return{type:b,bubbles:false,cancelable:false}}};WebSocket.prototype.__createMessageEvent=function(b,d){if(document.createEvent&&window.MessageEvent&&!window.opera){var c=document.createEvent("MessageEvent");c.initMessageEvent("message",false,false,d,null,null,window,null);return c}else{return{type:b,data:d,bubbles:false,cancelable:false}}};WebSocket.CONNECTING=0;WebSocket.OPEN=1;WebSocket.CLOSING=2;WebSocket.CLOSED=3;WebSocket.__flash=null;WebSocket.__instances={};WebSocket.__tasks=[];WebSocket.__nextId=0;WebSocket.loadFlashPolicyFile=function(b){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(b)})};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 b=document.createElement("div");b.id="webSocketContainer";b.style.position="absolute";if(WebSocket.__isFlashLite()){b.style.left="0px";b.style.top="0px"}else{b.style.left="-100px";b.style.top="-100px"}var c=document.createElement("div");c.id="webSocketFlash";b.appendChild(c);document.body.appendChild(b);swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:true,swliveconnect:true,allowScriptAccess:"always"},null,function(d){if(!d.success){a.error("[WebSocket] swfobject.embedSWF failed")}})};WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash");WebSocket.__flash.setCallerUrl(location.href);WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var b=0;b<WebSocket.__tasks.length;++b){WebSocket.__tasks[b]()}WebSocket.__tasks=[]},0)};WebSocket.__onFlashEvent=function(){setTimeout(function(){try{var c=WebSocket.__flash.receiveEvents();for(var b=0;b<c.length;++b){WebSocket.__instances[c[b].webSocketId].__handleEvent(c[b])}}catch(d){a.error(d)}},0);return true};WebSocket.__log=function(b){a.log(decodeURIComponent(b))};WebSocket.__error=function(b){a.error(decodeURIComponent(b))};WebSocket.__addTask=function(b){if(WebSocket.__flash){b()}else{WebSocket.__tasks.push(b)}};WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes){return false}var b=window.navigator.mimeTypes["application/x-shockwave-flash"];if(!b||!b.enabledPlugin||!b.enabledPlugin.filename){return false}return b.enabledPlugin.filename.match(/flashlite/i)?true:false};if(!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION){if(window.addEventListener){window.addEventListener("load",function(){WebSocket.__initialize()},false)}else{window.attachEvent("onload",function(){WebSocket.__initialize()})}}})();(function(a,e,c){a.XHR=b;function b(f){if(!f){return}e.Transport.apply(this,arguments);this.sendBuffer=[]}e.util.inherit(b,e.Transport);b.prototype.open=function(){this.socket.setBuffer(false);this.onOpen();this.get();this.setCloseTimeout();return this};b.prototype.payload=function(j){var h=[];for(var g=0,f=j.length;g<f;g++){h.push(e.parser.encodePacket(j[g]))}this.send(e.parser.encodePayload(h))};b.prototype.send=function(f){this.post(f);return this};function d(){}b.prototype.post=function(h){var g=this;this.socket.setBuffer(true);function f(){if(this.readyState==4){this.onreadystatechange=d;g.posting=false;if(this.status==200){g.socket.setBuffer(false)}else{g.onClose()}}}function i(){this.onload=d;g.socket.setBuffer(false)}this.sendXHR=this.request("POST");if(c.XDomainRequest&&this.sendXHR instanceof XDomainRequest){this.sendXHR.onload=this.sendXHR.onerror=i}else{this.sendXHR.onreadystatechange=f}this.sendXHR.send(h)};b.prototype.close=function(){this.onClose();return this};b.prototype.request=function(i){var f=e.util.request(this.socket.isXDomain()),g=e.util.query(this.socket.options.query,"t="+ +new Date);f.open(i||"GET",this.prepareUrl()+g,true);if(i=="POST"){try{if(f.setRequestHeader){f.setRequestHeader("Content-type","text/plain;charset=UTF-8")}else{f.contentType="text/plain"}}catch(h){}}return f};b.prototype.scheme=function(){return this.socket.options.secure?"https":"http"};b.check=function(f,g){try{if(e.util.request(g)){return true}}catch(h){}return false};b.xdomainCheck=function(){return b.check(null,true)}})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,c){a.htmlfile=b;function b(d){c.Transport.XHR.apply(this,arguments)}c.util.inherit(b,c.Transport.XHR);b.prototype.name="htmlfile";b.prototype.get=function(){this.doc=new ActiveXObject("htmlfile");this.doc.open();this.doc.write("<html></html>");this.doc.close();this.doc.parentWindow.s=this;var d=this.doc.createElement("div");d.className="socketio";this.doc.body.appendChild(d);this.iframe=this.doc.createElement("iframe");d.appendChild(this.iframe);var e=this,f=c.util.query(this.socket.options.query,"t="+ +new Date);this.iframe.src=this.prepareUrl()+f;c.util.on(window,"unload",function(){e.destroy()})};b.prototype._=function(f,h){this.onData(f);try{var d=h.getElementsByTagName("script")[0];d.parentNode.removeChild(d)}catch(g){}};b.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(d){}this.doc=null;this.iframe.parentNode.removeChild(this.iframe);this.iframe=null;CollectGarbage()}};b.prototype.close=function(){this.destroy();return c.Transport.XHR.prototype.close.call(this)};b.check=function(){if("ActiveXObject" in window){try{var d=new ActiveXObject("htmlfile");return d&&c.Transport.XHR.check()}catch(f){}}return false};b.xdomainCheck=function(){return false};c.transports.push("htmlfile")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(a,e,b){a["xhr-polling"]=d;function d(){e.Transport.XHR.apply(this,arguments)}e.util.inherit(d,e.Transport.XHR);e.util.merge(d,e.Transport.XHR);d.prototype.name="xhr-polling";d.prototype.open=function(){var f=this;e.Transport.XHR.prototype.open.call(f);return false};function c(){}d.prototype.get=function(){if(!this.open){return}var g=this;function f(){if(this.readyState==4){this.onreadystatechange=c;if(this.status==200){g.onData(this.responseText);g.get()}else{g.onClose()}}}function h(){this.onload=c;g.onData(this.responseText);g.get()}this.xhr=this.request();if(b.XDomainRequest&&this.xhr instanceof XDomainRequest){this.xhr.onload=this.xhr.onerror=h}else{this.xhr.onreadystatechange=f}this.xhr.send(null)};d.prototype.onClose=function(){e.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=c;try{this.xhr.abort()}catch(f){}this.xhr=null}};d.prototype.ready=function(f,h){var g=this;e.util.defer(function(){h.call(g)})};e.transports.push("xhr-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,c){a["jsonp-polling"]=b;function b(d){c.Transport["xhr-polling"].apply(this,arguments);this.index=c.j.length;var e=this;c.j.push(function(f){e._(f)})}c.util.inherit(b,c.Transport["xhr-polling"]);b.prototype.name="jsonp-polling";b.prototype.post=function(k){var n=this,m=c.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(!this.form){var f=document.createElement("form"),g=document.createElement("textarea"),d=this.iframeId="socketio_iframe_"+this.index,j;f.className="socketio";f.style.position="absolute";f.style.top="-1000px";f.style.left="-1000px";f.target=d;f.method="POST";f.setAttribute("accept-charset","utf-8");g.name="d";f.appendChild(g);document.body.appendChild(f);this.form=f;this.area=g}this.form.action=this.prepareUrl()+m;function h(){i();n.socket.setBuffer(false)}function i(){if(n.iframe){n.form.removeChild(n.iframe)}try{j=document.createElement('<iframe name="'+n.iframeId+'">')}catch(o){j=document.createElement("iframe");j.name=n.iframeId}j.id=n.iframeId;n.form.appendChild(j);n.iframe=j}i();this.area.value=k;try{this.form.submit()}catch(l){}if(this.iframe.attachEvent){j.onreadystatechange=function(){if(n.iframe.readyState=="complete"){h()}}}else{this.iframe.onload=h}this.socket.setBuffer(true)};b.prototype.get=function(){var e=this,d=document.createElement("script"),g=c.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}d.async=true;d.src=this.prepareUrl()+g;d.onerror=function(){e.onClose()};var f=document.getElementsByTagName("script")[0];f.parentNode.insertBefore(d,f);this.script=d};b.prototype._=function(d){this.onData(d);if(this.open){this.get()}return this};b.check=function(){return true};b.xdomainCheck=function(){return true};c.transports.push("jsonp-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);var Juggernaut=function(a){this.options=a||{};this.options.host=this.options.host||window.location.hostname;this.options.port=this.options.port||8080;this.handlers={};this.meta=this.options.meta;this.io=io.connect(this.options.host,this.options);this.io.on("connect",this.proxy(this.onconnect));this.io.on("message",this.proxy(this.onmessage));this.io.on("disconnect",this.proxy(this.ondisconnect));this.on("connect",this.proxy(this.writeMeta))};Juggernaut.fn=Juggernaut.prototype;Juggernaut.fn.proxy=function(b){var a=this;return(function(){return b.apply(a,arguments)})};Juggernaut.fn.on=function(a,b){if(!a||!b){return}if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)};Juggernaut.fn.bind=Juggernaut.fn.on;Juggernaut.fn.unbind=function(a){if(!this.handlers){return}delete this.handlers[a]};Juggernaut.fn.write=function(a){if(typeof a.toJSON=="function"){a=a.toJSON()}this.io.send(a)};Juggernaut.fn.subscribe=function(b,c){if(!b){throw"Must provide a channel"}this.on(b+":data",c);var a=this.proxy(function(){var d=new Juggernaut.Message;d.type="subscribe";d.channel=b;this.write(d)});if(this.io.socket.connected){a()}else{this.on("connect",a)}};Juggernaut.fn.unsubscribe=function(b){if(!b){throw"Must provide a channel"}this.unbind(b+":data");var a=new Juggernaut.Message;a.type="unsubscribe";a.channel=b;this.write(a)};Juggernaut.fn.trigger=function(){var c=[];for(var g=0;g<arguments.length;g++){c.push(arguments[g])}var b=c.shift();var e=this.handlers[b];if(!e){return}for(var d=0,a=e.length;d<a;d++){e[d].apply(this,c)}};Juggernaut.fn.writeMeta=function(){if(!this.meta){return}var a=new Juggernaut.Message;a.type="meta";a.data=this.meta;this.write(a)};Juggernaut.fn.onconnect=function(){this.sessionID=this.io.socket.sessionid;this.trigger("connect")};Juggernaut.fn.ondisconnect=function(){this.trigger("disconnect")};Juggernaut.fn.onmessage=function(b){var a=Juggernaut.Message.fromJSON(b);this.trigger("message",a);this.trigger("data",a.channel,a.data);this.trigger(a.channel+":data",a.data)};Juggernaut.Message=function(b){for(var a in b){this[a]=b[a]}};Juggernaut.Message.fromJSON=function(a){return(new this(JSON.parse(a)))};Juggernaut.Message.prototype.toJSON=function(){var a={};for(var b in this){if(typeof this[b]!="function"){a[b]=this[b]}}return(JSON.stringify(a))};
+(function(a){var b=a;b.version="0.8.4";b.protocol=1;b.transports=[];b.j=[];b.sockets={};b.connect=function(g,e){var f=b.util.parseUri(g),h,c;if("undefined"!=typeof document){f.protocol=f.protocol||document.location.protocol.slice(0,-1);f.host=f.host||document.domain;f.port=f.port||document.location.port}h=b.util.uniqueUri(f);var d={host:f.host,secure:"https"==f.protocol,port:f.port||("https"==f.protocol?443:80),query:f.query||""};b.util.merge(d,e);if(d["force new connection"]||!b.sockets[h]){c=new b.Socket(d)}if(!d["force new connection"]&&c){b.sockets[h]=c}c=c||b.sockets[h];return c.of(f.path.length>1?f.path:"")}})("object"===typeof module?module.exports:(window.io={}));(function(b,d){var a=b.util={};var c=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];a.parseUri=function(l){var h=c.exec(l||""),k={},j=14;while(j--){k[e[j]]=h[j]||""}return k};a.uniqueUri=function(j){var k=j.protocol,i=j.host,h=j.port;if("document" in d){i=i||document.domain;h=h||(k=="https"&&document.location.protocol!=="https:"?443:document.location.port)}else{i=i||"localhost";if(!h&&k=="https"){h=443}}return(k||"http")+"://"+i+":"+(h||80)};a.query=function(l,h){var k=a.chunkQuery(l||""),j=[];a.merge(k,a.chunkQuery(h||""));for(var i in k){if(k.hasOwnProperty(i)){j.push(i+"="+k[i])}}return j.length?"?"+j.join("&"):""};a.chunkQuery=function(h){var n={},o=h.split("&"),k=0,j=o.length,m;for(;k<j;++k){m=o[k].split("=");if(m[0]){n[m[0]]=decodeURIComponent(m[1])}}return n};var f=false;a.load=function(h){if("document" in d&&document.readyState==="complete"||f){return h()}a.on(d,"load",h,false)};a.on=function(i,k,j,h){if(i.attachEvent){i.attachEvent("on"+k,j)}else{if(i.addEventListener){i.addEventListener(k,j,h)}}};a.request=function(h){if("undefined"!=typeof window){if(h&&window.XDomainRequest){return new XDomainRequest()}if(window.XMLHttpRequest&&(!h||a.ua.hasCORS)){return new XMLHttpRequest()}if(!h){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}}return null};if("undefined"!=typeof window){a.load(function(){f=true})}a.defer=function(h){if(!a.ua.webkit){return h()}a.load(function(){setTimeout(h,100)})};a.merge=function g(l,h,i,k){var j=k||[],m=typeof i=="undefined"?2:i,n;for(n in h){if(h.hasOwnProperty(n)&&a.indexOf(j,n)<0){if(typeof l[n]!=="object"||!m){l[n]=h[n];j.push(h[n])}else{a.merge(l[n],h[n],m-1,j)}}}return l};a.mixin=function(i,h){a.merge(i.prototype,h.prototype)};a.inherit=function(i,h){function j(){}j.prototype=h.prototype;i.prototype=new j};a.isArray=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"};a.intersect=function(h,k){var m=[],o=h.length>k.length?h:k,p=h.length>k.length?k:h;for(var n=0,j=p.length;n<j;n++){if(~a.indexOf(o,p[n])){m.push(p[n])}}return m};a.indexOf=function(h,m,l){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(h,m,l)}for(var k=h.length,l=l<0?l+k<0?0:l+k:l||0;l<k&&h[l]!==m;l++){}return k<=l?-1:l};a.toArray=function(m){var h=[];for(var k=0,j=m.length;k<j;k++){h.push(m[k])}return h};a.ua={};a.ua.hasCORS="undefined"!=typeof window&&window.XMLHttpRequest&&(function(){try{var h=new XMLHttpRequest()}catch(i){return false}return h.withCredentials!=undefined})();a.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent)})("undefined"!=typeof window?io:module.exports,this);(function(a,c){a.EventEmitter=b;function b(){}b.prototype.on=function(d,e){if(!this.$events){this.$events={}}if(!this.$events[d]){this.$events[d]=e}else{if(c.util.isArray(this.$events[d])){this.$events[d].push(e)}else{this.$events[d]=[this.$events[d],e]}}return this};b.prototype.addListener=b.prototype.on;b.prototype.once=function(f,g){var e=this;function d(){e.removeListener(f,d);g.apply(this,arguments)}d.listener=g;this.on(f,d);return this};b.prototype.removeListener=function(e,g){if(this.$events&&this.$events[e]){var h=this.$events[e];if(c.util.isArray(h)){var j=-1;for(var f=0,d=h.length;f<d;f++){if(h[f]===g||(h[f].listener&&h[f].listener===g)){j=f;break}}if(j<0){return this}h.splice(j,1);if(!h.length){delete this.$events[e]}}else{if(h===g||(h.listener&&h.listener===g)){delete this.$events[e]}}}return this};b.prototype.removeAllListeners=function(d){if(this.$events&&this.$events[d]){this.$events[d]=null}return this};b.prototype.listeners=function(d){if(!this.$events){this.$events={}}if(!this.$events[d]){this.$events[d]=[]}if(!c.util.isArray(this.$events[d])){this.$events[d]=[this.$events[d]]}return this.$events[d]};b.prototype.emit=function(f){if(!this.$events){return false}var j=this.$events[f];if(!j){return false}var e=Array.prototype.slice.call(arguments,1);if("function"==typeof j){j.apply(this,e)}else{if(c.util.isArray(j)){var h=j.slice();for(var g=0,d=h.length;g<d;g++){h[g].apply(this,e)}}else{return false}}return true}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(exports,nativeJSON){if(nativeJSON&&nativeJSON.parse){return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify}}var JSON=exports.JSON={};function f(n){return n<10?"0"+n:n}function date(d,key){return isFinite(d.valueOf())?d.getUTCFullYear()+"-"+f(d.getUTCMonth()+1)+"-"+f(d.getUTCDate())+"T"+f(d.getUTCHours())+":"+f(d.getUTCMinutes())+":"+f(d.getUTCSeconds())+"Z":null}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value instanceof Date){value=date(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})};JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}})("undefined"!=typeof io?io:module.exports,typeof JSON!=="undefined"?JSON:undefined);(function(d,g){var a=d.parser={};var e=a.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"];var b=a.reasons=["transport not supported","client not handshaken","unauthorized"];var c=a.advice=["reconnect"];var i=g.JSON,h=g.util.indexOf;a.encodePacket=function(k){var p=h(e,k.type),j=k.id||"",r=k.endpoint||"",s=k.ack,n=null;switch(k.type){case"error":var o=k.reason?h(b,k.reason):"",l=k.advice?h(c,k.advice):"";if(o!==""||l!==""){n=o+(l!==""?("+"+l):"")}break;case"message":if(k.data!==""){n=k.data}break;case"event":var q={name:k.name};if(k.args&&k.args.length){q.args=k.args}n=i.stringify(q);break;case"json":n=i.stringify(k.data);break;case"connect":if(k.qs){n=k.qs}break;case"ack":n=k.ackId+(k.args&&k.args.length?"+"+i.stringify(k.args):"");break}var m=[p,j+(s=="data"?"+":""),r];if(n!==null&&n!==undefined){m.push(n)}return m.join(":")};a.encodePayload=function(o){var k="";if(o.length==1){return o[0]}for(var m=0,j=o.length;m<j;m++){var n=o[m];k+="\ufffd"+n.length+"\ufffd"+o[m]}return k};var f=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;a.decodePacket=function(l){var k=l.match(f);if(!k){return{}}var o=k[2]||"",l=k[5]||"",n={type:e[k[1]],endpoint:k[4]||""};if(o){n.id=o;if(k[3]){n.ack="data"}else{n.ack=true}}switch(n.type){case"error":var k=l.split("+");n.reason=b[k[0]]||"";n.advice=c[k[1]]||"";break;case"message":n.data=l||"";break;case"event":try{var j=i.parse(l);n.name=j.name;n.args=j.args}catch(m){}n.args=n.args||[];break;case"json":try{n.data=i.parse(l)}catch(m){}break;case"connect":n.qs=l||"";break;case"ack":var k=l.match(/^([0-9]+)(\+)?(.*)/);if(k){n.ackId=k[1];n.args=[];if(k[3]){try{n.args=k[3]?i.parse(k[3]):[]}catch(m){}}}break;case"disconnect":case"heartbeat":break}return n};a.decodePayload=function(m){if(m.charAt(0)=="\ufffd"){var j=[];for(var k=1,l="";k<m.length;k++){if(m.charAt(k)=="\ufffd"){j.push(a.decodePacket(m.substr(k+1).substr(0,l)));k+=Number(l)+1;l=""}else{l+=m.charAt(k)}}return j}else{return[a.decodePacket(m)]}}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(a,c){a.Transport=b;function b(d,e){this.socket=d;this.sessid=e}c.util.mixin(b,c.EventEmitter);b.prototype.onData=function(g){this.clearCloseTimeout();this.setCloseTimeout();if(g!==""){var f=c.parser.decodePayload(g);if(f&&f.length){for(var e=0,d=f.length;e<d;e++){this.onPacket(f[e])}}}return this};b.prototype.onPacket=function(d){if(d.type=="heartbeat"){return this.onHeartbeat()}if(d.type=="connect"&&d.endpoint==""){this.onConnect()}this.socket.onPacket(d);return this};b.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var d=this;this.closeTimeout=setTimeout(function(){d.onDisconnect()},this.socket.closeTimeout)}};b.prototype.onDisconnect=function(){if(this.close){this.close()}this.clearTimeouts();this.socket.onDisconnect();return this};b.prototype.onConnect=function(){this.socket.onConnect();return this};b.prototype.clearCloseTimeout=function(){if(this.closeTimeout){clearTimeout(this.closeTimeout);this.closeTimeout=null}};b.prototype.clearTimeouts=function(){this.clearCloseTimeout();if(this.reopenTimeout){clearTimeout(this.reopenTimeout)}};b.prototype.packet=function(d){this.send(c.parser.encodePacket(d))};b.prototype.onHeartbeat=function(d){this.packet({type:"heartbeat"})};b.prototype.onOpen=function(){this.open=true;this.clearCloseTimeout();this.socket.onOpen()};b.prototype.onClose=function(){var d=this;this.open=false;this.setCloseTimeout();this.socket.onClose()};b.prototype.prepareUrl=function(){var d=this.socket.options;return this.scheme()+"://"+d.host+":"+d.port+"/"+d.resource+"/"+c.protocol+"/"+this.name+"/"+this.sessid};b.prototype.ready=function(d,e){e.call(this)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,e,c){b.Socket=a;function a(g){this.options={port:80,secure:false,document:"document" in c?document:false,resource:"socket.io",transports:e.transports,"connect timeout":10000,"try multiple transports":true,reconnect:true,"reconnection delay":500,"reconnection limit":Infinity,"reopen delay":3000,"max reconnection attempts":10,"sync disconnect on unload":true,"auto connect":true,"flash policy port":10843};e.util.merge(this.options,g);this.connected=false;this.open=false;this.connecting=false;this.reconnecting=false;this.namespaces={};this.buffer=[];this.doBuffer=false;if(this.options["sync disconnect on unload"]&&(!this.isXDomain()||e.util.ua.hasCORS)){var f=this;e.util.on(c,"beforeunload",function(){f.disconnectSync()},false)}if(this.options["auto connect"]){this.connect()}}e.util.mixin(a,e.EventEmitter);a.prototype.of=function(f){if(!this.namespaces[f]){this.namespaces[f]=new e.SocketNamespace(this,f);if(f!==""){this.namespaces[f].packet({type:"connect"})}}return this.namespaces[f]};a.prototype.publish=function(){this.emit.apply(this,arguments);var g;for(var f in this.namespaces){if(this.namespaces.hasOwnProperty(f)){g=this.of(f);g.$emit.apply(g,arguments)}}};function d(){}a.prototype.handshake=function(l){var h=this,j=this.options;function f(n){if(n instanceof Error){h.onError(n.message)}else{l.apply(null,n.split(":"))}}var i=["http"+(j.secure?"s":"")+":/",j.host+":"+j.port,this.options.resource,e.protocol,e.util.query(this.options.query,"t="+ +new Date)].join("/");if(this.isXDomain()){var k=document.getElementsByTagName("script")[0],g=document.createElement("script");g.src=i+"&jsonp="+e.j.length;k.parentNode.insertBefore(g,k);e.j.push(function(n){f(n);g.parentNode.removeChild(g)})}else{var m=e.util.request();m.open("GET",i,true);m.onreadystatechange=function(){if(m.readyState==4){m.onreadystatechange=d;if(m.status==200){f(m.responseText)}else{!h.reconnecting&&h.onError(m.responseText)}}};m.send(null)}};a.prototype.getTransport=function(j){var f=j||this.transports,g;for(var h=0,k;k=f[h];h++){if(e.Transport[k]&&e.Transport[k].check(this)&&(!this.isXDomain()||e.Transport[k].xdomainCheck())){return new e.Transport[k](this,this.sessionid)}}return null};a.prototype.connect=function(g){if(this.connecting){return this}var f=this;this.handshake(function(h,k,l,j){f.sessionid=h;f.closeTimeout=l*1000;f.heartbeatTimeout=k*1000;f.transports=e.util.intersect(j.split(","),f.options.transports);function i(m){if(f.transport){f.transport.clearTimeouts()}f.transport=f.getTransport(m);if(!f.transport){return f.publish("connect_failed")}f.transport.ready(f,function(){f.connecting=true;f.publish("connecting",f.transport.name);f.transport.open();if(f.options["connect timeout"]){f.connectTimeoutTimer=setTimeout(function(){if(!f.connected){f.connecting=false;if(f.options["try multiple transports"]){if(!f.remainingTransports){f.remainingTransports=f.transports.slice(0)}var n=f.remainingTransports;while(n.length>0&&n.splice(0,1)[0]!=f.transport.name){}if(n.length){i(n)}else{f.publish("connect_failed")}}}},f.options["connect timeout"])}})}i();f.once("connect",function(){clearTimeout(f.connectTimeoutTimer);g&&typeof g=="function"&&g()})});return this};a.prototype.packet=function(f){if(this.connected&&!this.doBuffer){this.transport.packet(f)}else{this.buffer.push(f)}return this};a.prototype.setBuffer=function(f){this.doBuffer=f;if(!f&&this.connected&&this.buffer.length){this.transport.payload(this.buffer);this.buffer=[]}};a.prototype.disconnect=function(){if(this.connected){if(this.open){this.of("").packet({type:"disconnect"})}this.onDisconnect("booted")}return this};a.prototype.disconnectSync=function(){var g=e.util.request(),f=this.resource+"/"+e.protocol+"/"+this.sessionid;g.open("GET",f,true);this.onDisconnect("booted")};a.prototype.isXDomain=function(){var f=window.location.port||("https:"==window.location.protocol?443:80);return this.options.host!==document.domain||this.options.port!=f};a.prototype.onConnect=function(){if(!this.connected){this.connected=true;this.connecting=false;if(!this.doBuffer){this.setBuffer(false)}this.emit("connect")}};a.prototype.onOpen=function(){this.open=true};a.prototype.onClose=function(){this.open=false};a.prototype.onPacket=function(f){this.of(f.endpoint).onPacket(f)};a.prototype.onError=function(f){if(f&&f.advice){if(f.advice==="reconnect"&&this.connected){this.disconnect();this.reconnect()}}this.publish("error",f&&f.reason?f.reason:f)};a.prototype.onDisconnect=function(g){var f=this.connected;this.connected=false;this.connecting=false;this.open=false;if(f){this.transport.close();this.transport.clearTimeouts();this.publish("disconnect",g);if("booted"!=g&&this.options.reconnect&&!this.reconnecting){this.reconnect()}}};a.prototype.reconnect=function(){this.reconnecting=true;this.reconnectionAttempts=0;this.reconnectionDelay=this.options["reconnection delay"];var i=this,h=this.options["max reconnection attempts"],f=this.options["try multiple transports"],g=this.options["reconnection limit"];function j(){if(i.connected){for(var l in i.namespaces){if(i.namespaces.hasOwnProperty(l)&&""!==l){i.namespaces[l].packet({type:"connect"})}}i.publish("reconnect",i.transport.name,i.reconnectionAttempts)}i.removeListener("connect_failed",k);i.removeListener("connect",k);i.reconnecting=false;delete i.reconnectionAttempts;delete i.reconnectionDelay;delete i.reconnectionTimer;delete i.redoTransports;i.options["try multiple transports"]=f}function k(){if(!i.reconnecting){return}if(i.connected){return j()}if(i.connecting&&i.reconnecting){return i.reconnectionTimer=setTimeout(k,1000)}if(i.reconnectionAttempts++>=h){if(!i.redoTransports){i.on("connect_failed",k);i.options["try multiple transports"]=true;i.transport=i.getTransport();i.redoTransports=true;i.connect()}else{i.publish("reconnect_failed");j()}}else{if(i.reconnectionDelay<g){i.reconnectionDelay*=2}i.connect();i.publish("reconnecting",i.reconnectionDelay,i.reconnectionAttempts);i.reconnectionTimer=setTimeout(k,i.reconnectionDelay)}}this.options["try multiple transports"]=false;this.reconnectionTimer=setTimeout(k,this.reconnectionDelay);this.on("connect",k)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,d){a.SocketNamespace=b;function b(e,f){this.socket=e;this.name=f||"";this.flags={};this.json=new c(this,"json");this.ackPackets=0;this.acks={}}d.util.mixin(b,d.EventEmitter);b.prototype.$emit=d.EventEmitter.prototype.emit;b.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)};b.prototype.packet=function(e){e.endpoint=this.name;this.socket.packet(e);this.flags={};return this};b.prototype.send=function(f,e){var g={type:this.flags.json?"json":"message",data:f};if("function"==typeof e){g.id=++this.ackPackets;g.ack=true;this.acks[g.id]=e}return this.packet(g)};b.prototype.emit=function(f){var e=Array.prototype.slice.call(arguments,1),h=e[e.length-1],g={type:"event",name:f};if("function"==typeof h){g.id=++this.ackPackets;g.ack="data";this.acks[g.id]=h;e=e.slice(0,e.length-1)}g.args=e;return this.packet(g)};b.prototype.disconnect=function(){if(this.name===""){this.socket.disconnect()}else{this.packet({type:"disconnect"});this.$emit("disconnect")}return this};b.prototype.onPacket=function(f){var e=this;function h(){e.packet({type:"ack",args:d.util.toArray(arguments),ackId:f.id})}switch(f.type){case"connect":this.$emit("connect");break;case"disconnect":if(this.name===""){this.socket.onDisconnect(f.reason||"booted")}else{this.$emit("disconnect",f.reason)}break;case"message":case"json":var g=["message",f.data];if(f.ack=="data"){g.push(h)}else{if(f.ack){this.packet({type:"ack",ackId:f.id})}}this.$emit.apply(this,g);break;case"event":var g=[f.name].concat(f.args);if(f.ack=="data"){g.push(h)}this.$emit.apply(this,g);break;case"ack":if(this.acks[f.ackId]){this.acks[f.ackId].apply(this,f.args);delete this.acks[f.ackId]}break;case"error":if(f.advice){this.socket.onError(f)}else{if(f.reason=="unauthorized"){this.$emit("connect_failed",f.reason)}else{this.$emit("error",f.reason)}}break}};function c(f,e){this.namespace=f;this.name=e}c.prototype.send=function(){this.namespace.flags[this.name]=true;this.namespace.send.apply(this.namespace,arguments)};c.prototype.emit=function(){this.namespace.flags[this.name]=true;this.namespace.emit.apply(this.namespace,arguments)}})("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,c){b.websocket=a;function a(d){c.Transport.apply(this,arguments)}c.util.inherit(a,c.Transport);a.prototype.name="websocket";a.prototype.open=function(){var f=c.util.query(this.socket.options.query),e=this,d;if(!d){d=window.MozWebSocket||window.WebSocket}this.websocket=new d(this.prepareUrl()+f);this.websocket.onopen=function(){e.onOpen();e.socket.setBuffer(false)};this.websocket.onmessage=function(g){e.onData(g.data)};this.websocket.onclose=function(){e.onClose();e.socket.setBuffer(true)};this.websocket.onerror=function(g){e.onError(g)};return this};a.prototype.send=function(d){this.websocket.send(d);return this};a.prototype.payload=function(d){for(var f=0,e=d.length;f<e;f++){this.packet(d[f])}return this};a.prototype.close=function(){this.websocket.close();return this};a.prototype.onError=function(d){this.socket.onError(d)};a.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"};a.check=function(){return("WebSocket" in window&&!("__addTask" in WebSocket))||"MozWebSocket" in window};a.xdomainCheck=function(){return true};c.transports.push("websocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(b,c){b.flashsocket=a;function a(){c.Transport.websocket.apply(this,arguments)}c.util.inherit(a,c.Transport.websocket);a.prototype.name="flashsocket";a.prototype.open=function(){var d=this,e=arguments;WebSocket.__addTask(function(){c.Transport.websocket.prototype.open.apply(d,e)});return this};a.prototype.send=function(){var d=this,e=arguments;WebSocket.__addTask(function(){c.Transport.websocket.prototype.send.apply(d,e)});return this};a.prototype.close=function(){WebSocket.__tasks.length=0;c.Transport.websocket.prototype.close.call(this);return this};a.prototype.ready=function(d,f){function g(){var i=d.options,h=i["flash policy port"],j=["http"+(i.secure?"s":"")+":/",i.host+":"+i.port,i.resource,"static/flashsocket","WebSocketMain"+(d.isXDomain()?"Insecure":"")+".swf"];if(!a.loaded){if(typeof WEB_SOCKET_SWF_LOCATION==="undefined"){WEB_SOCKET_SWF_LOCATION=j.join("/")}if(h!==843){WebSocket.loadFlashPolicyFile("xmlsocket://"+i.host+":"+h)}WebSocket.__initialize();a.loaded=true}f.call(e)}var e=this;if(document.body){return g()}c.util.load(g)};a.check=function(){if(typeof WebSocket=="undefined"||!("__initialize" in WebSocket)||!swfobject){return false}return swfobject.getFlashPlayerVersion().major>=10};a.xdomainCheck=function(){return true};if(typeof window!="undefined"){WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=true}c.transports.push("flashsocket")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);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(d,e,c,g,f){var b=this;b.__id=WebSocket.__nextId++;WebSocket.__instances[b.__id]=b;b.readyState=WebSocket.CONNECTING;b.bufferedAmount=0;b.__events={};if(!e){e=[]}else{if(typeof e=="string"){e=[e]}}setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(b.__id,d,e,c||null,g||0,f||null)})},0)};WebSocket.prototype.send=function(c){if(this.readyState==WebSocket.CONNECTING){throw"INVALID_STATE_ERR: Web Socket connection has not been established"}var b=WebSocket.__flash.send(this.__id,encodeURIComponent(c));if(b<0){return true}else{this.bufferedAmount+=b;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(c,d,b){if(!(c in this.__events)){this.__events[c]=[]}this.__events[c].push(d)};WebSocket.prototype.removeEventListener=function(e,f,b){if(!(e in this.__events)){return}var d=this.__events[e];for(var c=d.length-1;c>=0;--c){if(d[c]===f){d.splice(c,1);break}}};WebSocket.prototype.dispatchEvent=function(e){var c=this.__events[e.type]||[];for(var b=0;b<c.length;++b){c[b](e)}var d=this["on"+e.type];if(d){d(e)}};WebSocket.prototype.__handleEvent=function(d){if("readyState" in d){this.readyState=d.readyState}if("protocol" in d){this.protocol=d.protocol}var b;if(d.type=="open"||d.type=="error"){b=this.__createSimpleEvent(d.type)}else{if(d.type=="close"){b=this.__createSimpleEvent("close")}else{if(d.type=="message"){var c=decodeURIComponent(d.message);b=this.__createMessageEvent("message",c)}else{throw"unknown event type: "+d.type}}}this.dispatchEvent(b)};WebSocket.prototype.__createSimpleEvent=function(b){if(document.createEvent&&window.Event){var c=document.createEvent("Event");c.initEvent(b,false,false);return c}else{return{type:b,bubbles:false,cancelable:false}}};WebSocket.prototype.__createMessageEvent=function(b,d){if(document.createEvent&&window.MessageEvent&&!window.opera){var c=document.createEvent("MessageEvent");c.initMessageEvent("message",false,false,d,null,null,window,null);return c}else{return{type:b,data:d,bubbles:false,cancelable:false}}};WebSocket.CONNECTING=0;WebSocket.OPEN=1;WebSocket.CLOSING=2;WebSocket.CLOSED=3;WebSocket.__flash=null;WebSocket.__instances={};WebSocket.__tasks=[];WebSocket.__nextId=0;WebSocket.loadFlashPolicyFile=function(b){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(b)})};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 b=document.createElement("div");b.id="webSocketContainer";b.style.position="absolute";if(WebSocket.__isFlashLite()){b.style.left="0px";b.style.top="0px"}else{b.style.left="-100px";b.style.top="-100px"}var c=document.createElement("div");c.id="webSocketFlash";b.appendChild(c);document.body.appendChild(b);swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:true,swliveconnect:true,allowScriptAccess:"always"},null,function(d){if(!d.success){a.error("[WebSocket] swfobject.embedSWF failed")}})};WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash");WebSocket.__flash.setCallerUrl(location.href);WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var b=0;b<WebSocket.__tasks.length;++b){WebSocket.__tasks[b]()}WebSocket.__tasks=[]},0)};WebSocket.__onFlashEvent=function(){setTimeout(function(){try{var c=WebSocket.__flash.receiveEvents();for(var b=0;b<c.length;++b){WebSocket.__instances[c[b].webSocketId].__handleEvent(c[b])}}catch(d){a.error(d)}},0);return true};WebSocket.__log=function(b){a.log(decodeURIComponent(b))};WebSocket.__error=function(b){a.error(decodeURIComponent(b))};WebSocket.__addTask=function(b){if(WebSocket.__flash){b()}else{WebSocket.__tasks.push(b)}};WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes){return false}var b=window.navigator.mimeTypes["application/x-shockwave-flash"];if(!b||!b.enabledPlugin||!b.enabledPlugin.filename){return false}return b.enabledPlugin.filename.match(/flashlite/i)?true:false};if(!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION){if(window.addEventListener){window.addEventListener("load",function(){WebSocket.__initialize()},false)}else{window.attachEvent("onload",function(){WebSocket.__initialize()})}}})();(function(a,e,c){a.XHR=b;function b(f){if(!f){return}e.Transport.apply(this,arguments);this.sendBuffer=[]}e.util.inherit(b,e.Transport);b.prototype.open=function(){this.socket.setBuffer(false);this.onOpen();this.get();this.setCloseTimeout();return this};b.prototype.payload=function(j){var h=[];for(var g=0,f=j.length;g<f;g++){h.push(e.parser.encodePacket(j[g]))}this.send(e.parser.encodePayload(h))};b.prototype.send=function(f){this.post(f);return this};function d(){}b.prototype.post=function(h){var g=this;this.socket.setBuffer(true);function f(){if(this.readyState==4){this.onreadystatechange=d;g.posting=false;if(this.status==200){g.socket.setBuffer(false)}else{g.onClose()}}}function i(){this.onload=d;g.socket.setBuffer(false)}this.sendXHR=this.request("POST");if(c.XDomainRequest&&this.sendXHR instanceof XDomainRequest){this.sendXHR.onload=this.sendXHR.onerror=i}else{this.sendXHR.onreadystatechange=f}this.sendXHR.send(h)};b.prototype.close=function(){this.onClose();return this};b.prototype.request=function(i){var f=e.util.request(this.socket.isXDomain()),g=e.util.query(this.socket.options.query,"t="+ +new Date);f.open(i||"GET",this.prepareUrl()+g,true);if(i=="POST"){try{if(f.setRequestHeader){f.setRequestHeader("Content-type","text/plain;charset=UTF-8")}else{f.contentType="text/plain"}}catch(h){}}return f};b.prototype.scheme=function(){return this.socket.options.secure?"https":"http"};b.check=function(f,g){try{if(e.util.request(g)){return true}}catch(h){}return false};b.xdomainCheck=function(){return b.check(null,true)}})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,c){a.htmlfile=b;function b(d){c.Transport.XHR.apply(this,arguments)}c.util.inherit(b,c.Transport.XHR);b.prototype.name="htmlfile";b.prototype.get=function(){this.doc=new ActiveXObject("htmlfile");this.doc.open();this.doc.write("<html></html>");this.doc.close();this.doc.parentWindow.s=this;var d=this.doc.createElement("div");d.className="socketio";this.doc.body.appendChild(d);this.iframe=this.doc.createElement("iframe");d.appendChild(this.iframe);var e=this,f=c.util.query(this.socket.options.query,"t="+ +new Date);this.iframe.src=this.prepareUrl()+f;c.util.on(window,"unload",function(){e.destroy()})};b.prototype._=function(f,h){this.onData(f);try{var d=h.getElementsByTagName("script")[0];d.parentNode.removeChild(d)}catch(g){}};b.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(d){}this.doc=null;this.iframe.parentNode.removeChild(this.iframe);this.iframe=null;CollectGarbage()}};b.prototype.close=function(){this.destroy();return c.Transport.XHR.prototype.close.call(this)};b.check=function(){if("ActiveXObject" in window){try{var d=new ActiveXObject("htmlfile");return d&&c.Transport.XHR.check()}catch(f){}}return false};b.xdomainCheck=function(){return false};c.transports.push("htmlfile")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);(function(a,e,b){a["xhr-polling"]=d;function d(){e.Transport.XHR.apply(this,arguments)}e.util.inherit(d,e.Transport.XHR);e.util.merge(d,e.Transport.XHR);d.prototype.name="xhr-polling";d.prototype.open=function(){var f=this;e.Transport.XHR.prototype.open.call(f);return false};function c(){}d.prototype.get=function(){if(!this.open){return}var g=this;function f(){if(this.readyState==4){this.onreadystatechange=c;if(this.status==200){g.onData(this.responseText);g.get()}else{g.onClose()}}}function h(){this.onload=c;g.onData(this.responseText);g.get()}this.xhr=this.request();if(b.XDomainRequest&&this.xhr instanceof XDomainRequest){this.xhr.onload=this.xhr.onerror=h}else{this.xhr.onreadystatechange=f}this.xhr.send(null)};d.prototype.onClose=function(){e.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=c;try{this.xhr.abort()}catch(f){}this.xhr=null}};d.prototype.ready=function(f,h){var g=this;e.util.defer(function(){h.call(g)})};e.transports.push("xhr-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this);(function(a,c){a["jsonp-polling"]=b;function b(d){c.Transport["xhr-polling"].apply(this,arguments);this.index=c.j.length;var e=this;c.j.push(function(f){e._(f)})}c.util.inherit(b,c.Transport["xhr-polling"]);b.prototype.name="jsonp-polling";b.prototype.post=function(k){var n=this,m=c.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(!this.form){var f=document.createElement("form"),g=document.createElement("textarea"),d=this.iframeId="socketio_iframe_"+this.index,j;f.className="socketio";f.style.position="absolute";f.style.top="-1000px";f.style.left="-1000px";f.target=d;f.method="POST";f.setAttribute("accept-charset","utf-8");g.name="d";f.appendChild(g);document.body.appendChild(f);this.form=f;this.area=g}this.form.action=this.prepareUrl()+m;function h(){i();n.socket.setBuffer(false)}function i(){if(n.iframe){n.form.removeChild(n.iframe)}try{j=document.createElement('<iframe name="'+n.iframeId+'">')}catch(o){j=document.createElement("iframe");j.name=n.iframeId}j.id=n.iframeId;n.form.appendChild(j);n.iframe=j}i();this.area.value=k;try{this.form.submit()}catch(l){}if(this.iframe.attachEvent){j.onreadystatechange=function(){if(n.iframe.readyState=="complete"){h()}}}else{this.iframe.onload=h}this.socket.setBuffer(true)};b.prototype.get=function(){var e=this,d=document.createElement("script"),g=c.util.query(this.socket.options.query,"t="+(+new Date)+"&i="+this.index);if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}d.async=true;d.src=this.prepareUrl()+g;d.onerror=function(){e.onClose()};var f=document.getElementsByTagName("script")[0];f.parentNode.insertBefore(d,f);this.script=d};b.prototype._=function(d){this.onData(d);if(this.open){this.get()}return this};b.check=function(){return true};b.xdomainCheck=function(){return true};c.transports.push("jsonp-polling")})("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);var Juggernaut=function(a){this.options=a||{};this.options.host=this.options.host||window.location.hostname;this.options.port=this.options.port||8080;this.handlers={};this.meta=this.options.meta;this.io=io.connect(this.options.host,this.options);this.io.on("connect",this.proxy(this.onconnect));this.io.on("message",this.proxy(this.onmessage));this.io.on("disconnect",this.proxy(this.ondisconnect));this.on("connect",this.proxy(this.writeMeta))};Juggernaut.fn=Juggernaut.prototype;Juggernaut.fn.proxy=function(b){var a=this;return(function(){return b.apply(a,arguments)})};Juggernaut.fn.on=function(a,b){if(!a||!b){return}if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)};Juggernaut.fn.bind=Juggernaut.fn.on;Juggernaut.fn.unbind=function(a){if(!this.handlers){return}delete this.handlers[a]};Juggernaut.fn.write=function(a){if(typeof a.toJSON=="function"){a=a.toJSON()}this.io.send(a)};Juggernaut.fn.subscribe=function(b,c){if(!b){throw"Must provide a channel"}this.on(b+":data",c);var a=this.proxy(function(){var d=new Juggernaut.Message;d.type="subscribe";d.channel=b;this.write(d)});if(this.io.socket.connected){a()}else{this.on("connect",a)}};Juggernaut.fn.unsubscribe=function(b){if(!b){throw"Must provide a channel"}this.unbind(b+":data");var a=new Juggernaut.Message;a.type="unsubscribe";a.channel=b;this.write(a)};Juggernaut.fn.trigger=function(){var c=[];for(var g=0;g<arguments.length;g++){c.push(arguments[g])}var b=c.shift();var e=this.handlers[b];if(!e){return}for(var d=0,a=e.length;d<a;d++){e[d].apply(this,c)}};Juggernaut.fn.writeMeta=function(){if(!this.meta){return}var a=new Juggernaut.Message;a.type="meta";a.data=this.meta;this.write(a)};Juggernaut.fn.onconnect=function(){this.sessionID=this.io.socket.sessionid;this.trigger("connect")};Juggernaut.fn.ondisconnect=function(){this.trigger("disconnect")};Juggernaut.fn.onmessage=function(b){var a=Juggernaut.Message.fromJSON(b);this.trigger("message",a);this.trigger("data",a.channel,a.data);this.trigger(a.channel+":data",a.data)};Juggernaut.Message=function(b){for(var a in b){this[a]=b[a]}};Juggernaut.Message.fromJSON=function(a){return(new this(JSON.parse(a)))};Juggernaut.Message.prototype.toJSON=function(){var a={};for(var b in this){if(typeof this[b]!="function"){a[b]=this[b]}}return(JSON.stringify(a))};if(typeof module!="undefined"){module.exports=Juggernaut};
Please sign in to comment.
Something went wrong with that request. Please try again.