function FABridge(b,a){this.target=b;this.remoteTypeCache={};this.remoteInstanceCache={};this.remoteFunctionCache={};this.localFunctionCache={};this.bridgeID=FABridge.nextBridgeID++;this.name=a;this.nextLocalFuncID=0;FABridge.instances[this.name]=this;FABridge.idMap[this.bridgeID]=this;return this}FABridge.TYPE_ASINSTANCE=1;FABridge.TYPE_ASFUNCTION=2;FABridge.TYPE_JSFUNCTION=3;FABridge.TYPE_ANONYMOUS=4;FABridge.initCallbacks={};FABridge.userTypes={};FABridge.addToUserTypes=function(){for(var a=0;a<arguments.length;a++){FABridge.userTypes[arguments[a]]={typeName:arguments[a],enriched:false}}};FABridge.argsToArray=function(b){var a=[];for(var c=0;c<b.length;c++){a[c]=b[c]}return a};function instanceFactory(a){this.fb_instance_id=a;return this}function FABridge__invokeJSFunction(a){var c=a[0];var b=a.concat();b.shift();var d=FABridge.extractBridgeFromID(c);return d.invokeLocalFunction(c,b)}FABridge.addInitializationCallback=function(b,d){var c=FABridge.instances[b];if(c!=undefined){d.call(c);return}var a=FABridge.initCallbacks[b];if(a==null){FABridge.initCallbacks[b]=a=[]}a.push(d)};function FABridge__bridgeInitialized(d){var a="bridgeName="+d;if(/Explorer/.test(navigator.appName)||/Opera/.test(navigator.appName)||/Netscape/.test(navigator.appName)||/Konqueror|Safari|KHTML/.test(navigator.appVersion)){var m=document.getElementsByTagName("object");if(m.length==1){FABridge.attachBridge(m[0],d)}else{for(var f=0;f<m.length;f++){var h=m[f];var c=h.childNodes;var g=false;for(var e=0;e<c.length;e++){var b=c[e];if(b.nodeType==1&&b.tagName.toLowerCase()=="param"){if(b.name.toLowerCase()=="flashvars"&&b.value.indexOf(a)>=0){FABridge.attachBridge(h,d);g=true;break}}}if(g){break}}}}else{var m=document.getElementsByTagName("embed");if(m.length==1){FABridge.attachBridge(m[0],d)}else{for(var f=0;f<m.length;f++){var h=m[f];var l=h.attributes.getNamedItem("flashVars").nodeValue;if(l.indexOf(a)>=0){FABridge.attachBridge(h,d)}}}}return true}FABridge.nextBridgeID=0;FABridge.instances={};FABridge.idMap={};FABridge.refCount=0;FABridge.extractBridgeFromID=function(b){var a=(b>>16);return FABridge.idMap[a]};FABridge.attachBridge=function(a,c){var b=new FABridge(a,c);FABridge[c]=b;var e=FABridge.initCallbacks[c];if(e==null){return}for(var d=0;d<e.length;d++){e[d].call(b)}delete FABridge.initCallbacks[c]};FABridge.blockedMethods={toString:true,get:true,set:true,call:true};FABridge.prototype={root:function(){return this.deserialize(this.target.getRoot())},releaseASObjects:function(){return this.target.releaseASObjects()},releaseNamedASObject:function(b){if(typeof(b)!="object"){return false}else{var a=this.target.releaseNamedASObject(b.fb_instance_id);return a}},create:function(a){return this.deserialize(this.target.create(a))},makeID:function(a){return(this.bridgeID<<16)+a},getPropertyFromAS:function(b,a){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.getPropFromAS(b,a);retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},setPropertyInAS:function(c,b,a){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.setPropInAS(c,b,this.serialize(a));retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},callASFunction:function(b,a){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;retVal=this.target.invokeASFunction(b,this.serialize(a));retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},callASMethod:function(b,c,a){if(FABridge.refCount>0){throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.")}else{FABridge.refCount++;a=this.serialize(a);retVal=this.target.invokeASMethod(b,c,a);retVal=this.handleError(retVal);FABridge.refCount--;return retVal}},invokeLocalFunction:function(d,b){var a;var c=this.localFunctionCache[d];if(c!=undefined){a=this.serialize(c.apply(null,this.deserialize(b)))}return a},getUserTypeDescriptor:function(b){var c=b.replace(/^([^:]*)\:\:([^:]*)$/,"$2");var e=((typeof window[c]=="function")&&(typeof FABridge.userTypes[c]!="undefined"));var d=false;if(e){d=FABridge.userTypes[c].enriched}var a={simpleType:c,isUserProto:e,protoEnriched:d};return a},getTypeFromName:function(b){var c=this.getUserTypeDescriptor(b);var a=this.remoteTypeCache[b];if(c.isUserProto){if(!c.protoEnriched){for(i in window[c.simpleType].prototype){a[i]=window[c.simpleType].prototype[i]}window[c.simpleType].prototype=a;this.remoteTypeCache[b]=a;FABridge.userTypes[c.simpleType].enriched=true}}return a},createProxy:function(c,b){var d=this.getUserTypeDescriptor(b);var f=this.getTypeFromName(b);if(d.isUserProto){var e=window[d.simpleType];var a=new e(this.name,c);a.fb_instance_id=c}else{instanceFactory.prototype=f;var a=new instanceFactory(c)}this.remoteInstanceCache[c]=a;return a},getProxy:function(a){return this.remoteInstanceCache[a]},addTypeDataToCache:function(d){newType=new ASProxy(this,d.name);var b=d.accessors;for(var c=0;c<b.length;c++){this.addPropertyToType(newType,b[c])}var a=d.methods;for(var c=0;c<a.length;c++){if(FABridge.blockedMethods[a[c]]==undefined){this.addMethodToType(newType,a[c])}}this.remoteTypeCache[newType.typeName]=newType;return newType},addPropertyToType:function(a,e){var f=e.charAt(0);var b;var d;if(f>="a"&&f<="z"){d="get"+f.toUpperCase()+e.substr(1);b="set"+f.toUpperCase()+e.substr(1)}else{d="get"+e;b="set"+e}a[b]=function(c){this.bridge.setPropertyInAS(this.fb_instance_id,e,c)};a[d]=function(){return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,e))}},addMethodToType:function(a,b){a[b]=function(){return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id,b,FABridge.argsToArray(arguments)))}},getFunctionProxy:function(a){var b=this;if(this.remoteFunctionCache[a]==null){this.remoteFunctionCache[a]=function(){b.callASFunction(a,FABridge.argsToArray(arguments))}}return this.remoteFunctionCache[a]},getFunctionID:function(a){if(a.__bridge_id__==undefined){a.__bridge_id__=this.makeID(this.nextLocalFuncID++);this.localFunctionCache[a.__bridge_id__]=a}return a.__bridge_id__},serialize:function(d){var a={};var c=typeof(d);if(c=="number"||c=="string"||c=="boolean"||c==null||c==undefined){a=d}else{if(d instanceof Array){a=[];for(var b=0;b<d.length;b++){a[b]=this.serialize(d[b])}}else{if(c=="function"){a.type=FABridge.TYPE_JSFUNCTION;a.value=this.getFunctionID(d)}else{if(d instanceof ASProxy){a.type=FABridge.TYPE_ASINSTANCE;a.value=d.fb_instance_id}else{a.type=FABridge.TYPE_ANONYMOUS;a.value=d}}}}return a},deserialize:function(e){var a;var c=typeof(e);if(c=="number"||c=="string"||c=="boolean"||e==null||e==undefined){a=this.handleError(e)}else{if(e instanceof Array){a=[];for(var b=0;b<e.length;b++){a[b]=this.deserialize(e[b])}}else{if(c=="object"){for(var b=0;b<e.newTypes.length;b++){this.addTypeDataToCache(e.newTypes[b])}for(var d in e.newRefs){this.createProxy(d,e.newRefs[d])}if(e.type==FABridge.TYPE_PRIMITIVE){a=e.value}else{if(e.type==FABridge.TYPE_ASFUNCTION){a=this.getFunctionProxy(e.value)}else{if(e.type==FABridge.TYPE_ASINSTANCE){a=this.getProxy(e.value)}else{if(e.type==FABridge.TYPE_ANONYMOUS){a=e.value}}}}}}}return a},addRef:function(a){this.target.incRef(a.fb_instance_id)},release:function(a){this.target.releaseRef(a.fb_instance_id)},handleError:function(b){if(typeof(b)=="string"&&b.indexOf("__FLASHERROR")==0){var a=b.split("||");if(FABridge.refCount>0){FABridge.refCount--}throw new Error(a[1]);return b}else{return b}}};ASProxy=function(b,a){this.bridge=b;this.typeName=a;return this};ASProxy.prototype={get:function(a){return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id,a))},set:function(b,a){this.bridge.setPropertyInAS(this.fb_instance_id,b,a)},call:function(b,a){this.bridge.callASMethod(this.fb_instance_id,b,a)},addRef:function(){this.bridge.addRef(this)},release:function(){this.bridge.release(this)}};var flensed={base_path:"http://s.phono.com/deps/flensed/1.0/"};function Phono(a){this.config=Phono.util.extend({gateway:"gw.phono.com",connectionUrl:"http://app.phono.com/http-bind"},a);Phono.events.bind(this,a);if(!a.apiKey){this.config.apiKey=prompt("Please enter your Phono API Key.\n\nTo get a new one sign up for a free account at: http://www.phono.com");if(!this.config.apiKey){var b="A Phono API Key is required. Please get one at http://www.phono.com";Phono.events.trigger(this,"error",{reason:b});throw b}}this.sessionId=null;this.connection=new Strophe.Connection(this.config.connectionUrl);this.connect()}(function(){var d=(function(){var n;function j(){return function(){}}function h(s,r){for(var f in r){s[f]=r[f]}}var p=j();var l=j();h(l.prototype,{addChild:p,getEffectiveAppenders:p,invalidateAppenderCache:p,getAdditivity:p,setAdditivity:p,addAppender:p,removeAppender:p,removeAllAppenders:p,log:p,setLevel:p,getLevel:p,getEffectiveLevel:p,trace:p,debug:p,info:p,warn:p,error:p,fatal:p,isEnabledFor:p,isTraceEnabled:p,isDebugEnabled:p,isInfoEnabled:p,isWarnEnabled:p,isErrorEnabled:p,isFatalEnabled:p,callAppenders:p,group:p,groupEnd:p,time:p,timeEnd:p,assert:p,parent:new l()});var o=function(){return new l()};function q(){}h(q.prototype,{setEventTypes:p,addEventListener:p,removeEventListener:p,dispatchEvent:p,eventTypes:[],eventListeners:{}});function m(){}m.prototype=new q();n=new m();n={isStub:true,version:"1.4.1",edition:"log4javascript_production",setEventTypes:p,addEventListener:p,removeEventListener:p,dispatchEvent:p,eventTypes:[],eventListeners:{},logLog:{setQuietMode:p,setAlertAllErrors:p,debug:p,displayDebug:p,warn:p,error:p},handleError:p,setEnabled:p,isEnabled:p,setTimeStampsInMilliseconds:p,isTimeStampsInMilliseconds:p,evalInScope:p,setShowStackTraces:p,getLogger:o,getDefaultLogger:o,getNullLogger:o,getRootLogger:o,resetConfiguration:p,Level:j(),LoggingEvent:j(),Layout:j(),Appender:j()};n.LoggingEvent.prototype={getThrowableStrRep:p,getCombinedMessages:p};n.Level.prototype={toString:p,equals:p,isGreaterOrEqual:p};var g=new n.Level();h(n.Level,{ALL:g,TRACE:g,DEBUG:g,INFO:g,WARN:g,ERROR:g,FATAL:g,OFF:g});n.Layout.prototype={defaults:{},format:p,ignoresThrowable:p,getContentType:p,allowBatching:p,getDataValues:p,setKeys:p,setCustomField:p,hasCustomFields:p,setTimeStampsInMilliseconds:p,isTimeStampsInMilliseconds:p,getTimeStampValue:p,toString:p};n.SimpleDateFormat=j();n.SimpleDateFormat.prototype={setMinimalDaysInFirstWeek:p,getMinimalDaysInFirstWeek:p,format:p};n.PatternLayout=j();n.PatternLayout.prototype=new n.Layout();n.Appender=j();n.Appender.prototype=new q();h(n.Appender.prototype,{layout:new n.PatternLayout(),threshold:n.Level.ALL,loggers:[],doAppend:p,append:p,setLayout:p,getLayout:p,setThreshold:p,getThreshold:p,setAddedToLogger:p,setRemovedFromLogger:p,group:p,groupEnd:p,toString:p});n.SimpleLayout=j();n.SimpleLayout.prototype=new n.Layout();n.NullLayout=j();n.NullLayout.prototype=new n.Layout();n.XmlLayout=j();n.XmlLayout.prototype=new n.Layout();h(n.XmlLayout.prototype,{escapeCdata:p,isCombinedMessages:p});n.JsonLayout=j();n.JsonLayout.prototype=new n.Layout();h(n.JsonLayout.prototype,{isReadable:p,isCombinedMessages:p});n.HttpPostDataLayout=j();n.HttpPostDataLayout.prototype=new n.Layout();n.PatternLayout=j();n.PatternLayout.prototype=new n.Layout();n.AjaxAppender=j();n.AjaxAppender.prototype=new n.Appender();h(n.AjaxAppender.prototype,{getSessionId:p,setSessionId:p,isTimed:p,setTimed:p,getTimerInterval:p,setTimerInterval:p,isWaitForResponse:p,setWaitForResponse:p,getBatchSize:p,setBatchSize:p,isSendAllOnUnload:p,setSendAllOnUnload:p,setRequestSuccessCallback:p,setFailCallback:p,getPostVarName:p,setPostVarName:p,sendAll:p,defaults:{requestSuccessCallback:null,failCallback:null}});return n})();var c=d;Phono.version="0.2";Phono.log=c.getDefaultLogger();Phono.registerPlugin=function(g,f){if(!Phono.plugins){Phono.plugins={}}Phono.plugins[g]=f};Phono.prototype.connect=function(){if(this.connection.connected){return}var f=this;this.connection.connect(f.config.gateway,null,function(g){if(g===Strophe.Status.CONNECTED){f.connection.send($iq({type:"set"}).c("apikey",{xmlns:"http://phono.com/apikey"}).t(f.config.apiKey));f.handleConnect()}else{if(g===Strophe.Status.DISCONNECTED){f.handleDisconnect()}else{if(g===Strophe.Status.ERROR||g===Strophe.Status.CONNFAIL||g===Strophe.Status.CONNFAIL||g===Strophe.Status.AUTHFAIL){f.handleError()}}}})};Phono.prototype.disconnect=function(){this.connection.disconnect()};Phono.prototype.connected=function(){return this.connection.connected};Phono.prototype.handleConnect=function(){this.sessionId=Strophe.getBareJidFromJid(this.connection.jid);new a(this,this.config,function(f){Phono.events.trigger(this,"ready")}).init()};Phono.prototype.handleError=function(){Phono.events.trigger(this,"error",{reason:"Error connecting to XMPP server"})};Phono.prototype.handleDisconnect=function(){Phono.events.trigger(this,"unready")};(function(aE){var ab=aE,az=aE.document,ag="undefined",aG=true,U=false,aA="",ar="object",aw="function",S="string",av="div",aC="onunload",Y=null,ah=null,V=null,ap=null,ai=0,ay=[],au=null,ao=null,Z="flXHR.js",at="flensed.js",Q="flXHR.vbs",ax="checkplayer.js",af="flXHR.swf",al=aE.parseInt,aj=aE.setTimeout,aB=aE.clearTimeout,an=aE.setInterval,ak=aE.clearInterval,R="instanceId",W="readyState",ac="onreadystatechange",T="ontimeout",ad="onerror",aD="binaryResponseBody",aa="xmlResponseText",X="loadPolicyURL",aF="noCacheHeader",aq="sendTimeout",ae="appendToId",am="swfIdPrefix";if(typeof aE.flensed===ag){aE.flensed={}}if(typeof aE.flensed.flXHR!==ag){return}ah=aE.flensed;aj(function(){var r=U,v=az.getElementsByTagName("script"),m=v.length;try{ah.base_path.toLowerCase();r=aG}catch(o){ah.base_path=aA}function g(w,x,A){for(var y=0;y<m;y++){if(typeof v[y].src!==ag){if(v[y].src.indexOf(w)>=0){break}}}var z=az.createElement("script");z.setAttribute("src",ah.base_path+w);if(typeof x!==ag){z.setAttribute("type",x)}if(typeof A!==ag){z.setAttribute("language",A)}az.getElementsByTagName("head")[0].appendChild(z)}if((typeof v!==ag)&&(v!==null)){if(!r){var u=0;for(var n=0;n<m;n++){if(typeof v[n].src!==ag){if(((u=v[n].src.indexOf(at))>=0)||((u=v[n].src.indexOf(Z))>=0)){ah.base_path=v[n].src.substr(0,u);break}}}}}try{ah.checkplayer.module_ready()}catch(f){g(ax,"text/javascript")}var t=null;(function s(){try{ah.ua.pv.join(".")}catch(w){t=aj(arguments.callee,25);return}if(ah.ua.win&&ah.ua.ie){g(Q,"text/vbscript","vbscript")}ah.binaryToString=function(D,x){x=(((ah.ua.win&&ah.ua.ie)&&typeof x!==ag)?(!(!x)):!(ah.ua.win&&ah.ua.ie));if(!x){try{return flXHR_vb_BinaryToString(D)}catch(B){}}var A=aA,y=[];try{for(var C=0;C<D.length;C++){y[y.length]=String.fromCharCode(D[C])}A=y.join(aA)}catch(z){}return A};ah.bindEvent(ab,aC,function(){try{aE.flensed.unbindEvent(ab,aC,arguments.callee);for(var x in ao){if(ao[x]!==Object.prototype[x]){try{ao[x]=null}catch(y){}}}ah.flXHR=null;ao=null;ah=null;ap=null;V=null}catch(z){}})})();function h(){aB(t);try{ab.detachEvent(aC,h)}catch(w){}}if(t!==null){try{ab.attachEvent(aC,h)}catch(j){}}var p=null;function q(){aB(p);try{ab.detachEvent(aC,q)}catch(w){}}try{ab.attachEvent(aC,q)}catch(l){}p=aj(function(){q();try{ah.checkplayer.module_ready()}catch(w){throw new aE.Error("flXHR dependencies failed to load.")}},20000)},0);ah.flXHR=function(a8){var O=U;if(a8!==null&&typeof a8===ar){if(typeof a8.instancePooling!==ag){O=!(!a8.instancePooling);if(O){var bj=function(){for(var aI=0;aI<ay.length;aI++){var aH=ay[aI];if(aH[W]===4){aH.Reset();aH.Configure(a8);return aH}}return null}();if(bj!==null){return bj}}}}var a3=++ai,H=[],K=null,I=null,l=null,h=null,bd=-1,bk=0,P=null,N=null,B=null,bl=null,o=null,a4=null,F=null,y=null,be=null,f=aG,bo=U,a1="flXHR_"+a3,s=aG,bn=U,bp=aG,bg=U,v="flXHR_swf",L="flXHRhideSwf",p=null,bi=-1,t=aA,bf=null,bm=null,bb=null;var r=function(){if(typeof a8===ar&&a8!==null){if((typeof a8[R]!==ag)&&(a8[R]!==null)&&(a8[R]!==aA)){a1=a8[R]}if((typeof a8[am]!==ag)&&(a8[am]!==null)&&(a8[am]!==aA)){v=a8[am]}if((typeof a8[ae]!==ag)&&(a8[ae]!==null)&&(a8[ae]!==aA)){p=a8[ae]}if((typeof a8[X]!==ag)&&(a8[X]!==null)&&(a8[X]!==aA)){t=a8[X]}if(typeof a8[aF]!==ag){s=!(!a8[aF])}if(typeof a8[aD]!==ag){bn=!(!a8[aD])}if(typeof a8[aa]!==ag){bp=!(!a8[aa])}if(typeof a8.autoUpdatePlayer!==ag){bg=!(!a8.autoUpdatePlayer)}if((typeof a8[aq]!==ag)&&((Y=al(a8[aq],10))>0)){bi=Y}if((typeof a8[ac]!==ag)&&(a8[ac]!==null)){bf=a8[ac]}if((typeof a8[ad]!==ag)&&(a8[ad]!==null)){bm=a8[ad]}if((typeof a8[T]!==ag)&&(a8[T]!==null)){bb=a8[T]}}h=v+"_"+a3;function aJ(){aB(K);try{ab.detachEvent(aC,aJ)}catch(aK){}}try{ab.attachEvent(aC,aJ)}catch(aI){}(function aH(){try{ah.bindEvent(ab,aC,bh)}catch(aK){K=aj(arguments.callee,25);return}aJ();K=aj(a6,1)})()}();function a6(){if(p===null){y=az.getElementsByTagName("body")[0]}else{y=ah.getObjectById(p)}try{y.nodeName.toLowerCase();ah.checkplayer.module_ready();V=ah.checkplayer}catch(aH){K=aj(a6,25);return}if((ap===null)&&(typeof V._ins===ag)){try{ap=new V(ao.MIN_PLAYER_VERSION,a5,U,z)}catch(aI){ba(ao.DEPENDENCY_ERROR,"flXHR: checkplayer Init Failed","The initialization of the 'checkplayer' library failed to complete.");return}}else{ap=V._ins;J()}}function J(){if(ap===null||!ap.checkPassed){K=aj(J,25);return}if(au===null&&p===null){ah.createCSS("."+L,"left:-1px;top:0px;width:1px;height:1px;position:absolute;");au=aG}var aL=az.createElement(av);aL.id=h;aL.className=L;y.appendChild(aL);y=null;var aI={},aK={allowScriptAccess:"always"},aH={id:h,name:h,styleclass:L},aM={swfCB:a7,swfEICheck:"reset"};try{ap.DoSWF(ah.base_path+af,h,"1","1",aI,aK,aH,aM)}catch(aJ){ba(ao.DEPENDENCY_ERROR,"flXHR: checkplayer Call Failed","A call to the 'checkplayer' library failed to complete.");return}}function a7(aI){if(aI.status!==V.SWF_EI_READY){return}w();a4=ah.getObjectById(h);a4.setId(h);if(t!==aA){a4.loadPolicy(t)}a4.autoNoCacheHeader(s);a4.returnBinaryResponseBody(bn);a4.doOnReadyStateChange=E;a4.doOnError=ba;a4.sendProcessed=A;a4.chunkResponse=j;bd=0;m();a2();if(typeof bf===aw){try{bf(F)}catch(aH){ba(ao.HANDLER_ERROR,"flXHR::onreadystatechange(): Error","An error occurred in the handler function. ("+aH.message+")");return}}u()}function bh(){try{aE.flensed.unbindEvent(ab,aC,bh)}catch(aH){}try{for(var aS=0;aS<ay.length;aS++){if(ay[aS]===F){ay[aS]=U}}}catch(aL){}try{for(var aQ in F){if(F[aQ]!==Object.prototype[aQ]){try{F[aQ]=null}catch(aM){}}}}catch(aN){}F=null;w();if((typeof a4!==ag)&&(a4!==null)){try{a4.abort()}catch(aO){}try{a4.doOnReadyStateChange=null;E=null}catch(aP){}try{a4.doOnError=null;doOnError=null}catch(aR){}try{a4.sendProcessed=null;A=null}catch(aI){}try{a4.chunkResponse=null;j=null}catch(aJ){}a4=null;try{aE.swfobject.removeSWF(h)}catch(aK){}}a9();bf=null;bm=null;bb=null;B=null;P=null;be=null;y=null}function j(){if(bn&&typeof arguments[0]!==ag){be=((be!==null)?be:[]);be=be.concat(arguments[0])}else{if(typeof arguments[0]===S){be=((be!==null)?be:aA);be+=arguments[0]}}}function E(){if(typeof arguments[0]!==ag){bd=arguments[0]}if(bd===4){w();if(bn&&be!==null){try{N=ah.binaryToString(be,aG);try{P=flXHR_vb_StringToBinary(N)}catch(aH){P=be}}catch(aI){}}else{N=be}be=null;if(N!==aA){if(bp){try{B=ah.parseXMLString(N)}catch(aJ){B={}}}}}if(typeof arguments[1]!==ag){bl=arguments[1]}if(typeof arguments[2]!==ag){o=arguments[2]}M(bd)}function M(aI){bk=aI;m();a2();F[W]=Math.max(0,aI);if(typeof bf===aw){try{bf(F)}catch(aH){ba(ao.HANDLER_ERROR,"flXHR::onreadystatechange(): Error","An error occurred in the handler function. ("+aH.message+")");return}}}function ba(){w();a9();bo=aG;var aN;try{aN=new ah.error(arguments[0],arguments[1],arguments[2],F)}catch(aM){function aI(){this.number=0;this.name="flXHR Error: Unknown";this.description="Unknown error from 'flXHR' library.";this.message=this.description;this.srcElement=F;var aP=this.number,aQ=this.name,aR=this.description;function aO(){return aP+", "+aQ+", "+aR}this.toString=aO}aN=new aI()}var aL=U;try{if(typeof bm===aw){bm(aN);aL=aG}}catch(aJ){var aH=aN.toString();function aK(){this.number=ao.HANDLER_ERROR;this.name="flXHR::onerror(): Error";this.description="An error occured in the handler function. ("+aJ.message+")\nPrevious:["+aH+"]";this.message=this.description;this.srcElement=F;var aP=this.number,aQ=this.name,aR=this.description;function aO(){return aP+", "+aQ+", "+aR}this.toString=aO}aN=new aK()}if(!aL){aj(function(){ah.throwUnhandledError(aN.toString())},1)}}function n(){D();bo=aG;if(typeof bb===aw){try{bb(F)}catch(aH){ba(ao.HANDLER_ERROR,"flXHR::ontimeout(): Error","An error occurred in the handler function. ("+aH.message+")");return}}else{ba(ao.TIMEOUT_ERROR,"flXHR: Operation Timed out","The requested operation timed out.")}}function w(){aB(K);K=null;aB(l);l=null;aB(I);I=null}function a0(aI,aH,aJ){H[H.length]={func:aI,funcName:aH,args:aJ};f=U}function a9(){if(!f){f=aG;var aI=H.length;for(var aJ=0;aJ<aI;aJ++){try{H[aJ]=U}catch(aH){}}H=[]}}function u(){if(bd<0){I=aj(u,25);return}if(!f){for(var aI=0;aI<H.length;aI++){try{if(H[aI]!==U){H[aI].func.apply(F,H[aI].args);H[aI]=U}}catch(aH){ba(ao.HANDLER_ERROR,"flXHR::"+H[aI].funcName+"(): Error","An error occurred in the "+H[aI].funcName+"() function.");return}}f=aG}}function a2(){try{F[R]=a1;F[W]=bk;F.status=bl;F.statusText=o;F.responseText=N;F.responseXML=B;F.responseBody=P;F[ac]=bf;F[ad]=bm;F[T]=bb;F[X]=t;F[aF]=s;F[aD]=bn;F[aa]=bp}catch(aH){}}function m(){try{a1=F[R];if(F.timeout!==null&&(Y=al(F.timeout,10))>0){bi=Y}bf=F[ac];bm=F[ad];bb=F[T];if(F[X]!==null){if((F[X]!==t)&&(bd>=0)){a4.loadPolicy(F[X])}t=F[X]}if(F[aF]!==null){if((F[aF]!==s)&&(bd>=0)){a4.autoNoCacheHeader(F[aF])}s=F[aF]}if(F[aD]!==null){if((F[aD]!==bn)&&(bd>=0)){a4.returnBinaryResponseBody(F[aD])}bn=F[aD]}if(bp!==null){bp=!(!F[aa])}}catch(aH){}}function bc(){D();try{a4.reset()}catch(aH){}bl=null;o=null;N=null;B=null;P=null;be=null;bo=U;a2();t=aA;m()}function a5(aH){if(aH.checkPassed){J()}else{if(!bg){ba(ao.PLAYER_VERSION_ERROR,"flXHR: Insufficient Flash Player Version","The Flash Player was either not detected, or the detected version ("+aH.playerVersionDetected+") was not at least the minimum version ("+ao.MIN_PLAYER_VERSION+") needed by the 'flXHR' library.")}else{ap.UpdatePlayer()}}}function z(aH){if(aH.updateStatus===V.UPDATE_CANCELED){ba(ao.PLAYER_VERSION_ERROR,"flXHR: Flash Player Update Canceled","The Flash Player was not updated.")}else{if(aH.updateStatus===V.UPDATE_FAILED){ba(ao.PLAYER_VERSION_ERROR,"flXHR: Flash Player Update Failed","The Flash Player was either not detected or could not be updated.")}}}function A(){if(bi!==null&&bi>0){l=aj(n,bi)}}function D(){w();a9();m();bd=0;bk=0;try{a4.abort()}catch(aH){ba(ao.CALL_ERROR,"flXHR::abort(): Failed","The abort() call failed to complete.")}a2()}function q(){m();if(typeof arguments[0]===ag||typeof arguments[1]===ag){ba(ao.CALL_ERROR,"flXHR::open(): Failed","The open() call requires 'method' and 'url' parameters.")}else{if(bd>0||bo){bc()}if(bk===0){E(1)}else{bd=1}var aJ=arguments[0],aK=arguments[1],aL=(typeof arguments[2]!==ag)?arguments[2]:aG,aM=(typeof arguments[3]!==ag)?arguments[3]:aA,aH=(typeof arguments[4]!==ag)?arguments[4]:aA;try{a4.autoNoCacheHeader(s);a4.open(aJ,aK,aL,aM,aH)}catch(aI){ba(ao.CALL_ERROR,"flXHR::open(): Failed","The open() call failed to complete.")}}}function g(){m();if(bd<=1&&!bo){var aI=(typeof arguments[0]!==ag)?arguments[0]:aA;if(bk===1){E(2)}else{bd=2}try{a4.autoNoCacheHeader(s);a4.send(aI)}catch(aH){ba(ao.CALL_ERROR,"flXHR::send(): Failed","The send() call failed to complete.")}}else{ba(ao.CALL_ERROR,"flXHR::send(): Failed","The send() call cannot be made at this time.")}}function G(){m();if(typeof arguments[0]===ag||typeof arguments[1]===ag){ba(ao.CALL_ERROR,"flXHR::setRequestHeader(): Failed","The setRequestHeader() call requires 'name' and 'value' parameters.")}else{if(!bo){var aJ=(typeof arguments[0]!==ag)?arguments[0]:aA,aH=(typeof arguments[1]!==ag)?arguments[1]:aA;try{a4.setRequestHeader(aJ,aH)}catch(aI){ba(ao.CALL_ERROR,"flXHR::setRequestHeader(): Failed","The setRequestHeader() call failed to complete.")}}}}function C(){m();return aA}function x(){m();return[]}F={readyState:bk,responseBody:P,responseText:N,responseXML:B,status:bl,statusText:o,timeout:bi,open:function(){m();if(F[W]===0){M(1)}if(!f||bd<0){a0(q,"open",arguments);return}q.apply({},arguments)},send:function(){m();if(F[W]===1){M(2)}if(!f||bd<0){a0(g,"send",arguments);return}g.apply({},arguments)},abort:D,setRequestHeader:function(){m();if(!f||bd<0){a0(G,"setRequestHeader",arguments);return}G.apply({},arguments)},getResponseHeader:C,getAllResponseHeaders:x,onreadystatechange:bf,ontimeout:bb,instanceId:a1,loadPolicyURL:t,noCacheHeader:s,binaryResponseBody:bn,xmlResponseText:bp,onerror:bm,Configure:function(aH){if(typeof aH===ar&&aH!==null){if((typeof aH[R]!==ag)&&(aH[R]!==null)&&(aH[R]!==aA)){a1=aH[R]}if(typeof aH[aF]!==ag){s=!(!aH[aF]);if(bd>=0){a4.autoNoCacheHeader(s)}}if(typeof aH[aD]!==ag){bn=!(!aH[aD]);if(bd>=0){a4.returnBinaryResponseBody(bn)}}if(typeof aH[aa]!==ag){bp=!(!aH[aa])}if((typeof aH[ac]!==ag)&&(aH[ac]!==null)){bf=aH[ac]}if((typeof aH[ad]!==ag)&&(aH[ad]!==null)){bm=aH[ad]}if((typeof aH[T]!==ag)&&(aH[T]!==null)){bb=aH[T]}if((typeof aH[aq]!==ag)&&((Y=al(aH[aq],10))>0)){bi=Y}if((typeof aH[X]!==ag)&&(aH[X]!==null)&&(aH[X]!==aA)&&(aH[X]!==t)){t=aH[X];if(bd>=0){a4.loadPolicy(t)}}a2()}},Reset:bc,Destroy:bh};if(O){ay[ay.length]=F}return F};ao=ah.flXHR;ao.HANDLER_ERROR=10;ao.CALL_ERROR=11;ao.TIMEOUT_ERROR=12;ao.DEPENDENCY_ERROR=13;ao.PLAYER_VERSION_ERROR=14;ao.SECURITY_ERROR=15;ao.COMMUNICATION_ERROR=16;ao.MIN_PLAYER_VERSION="9.0.124";ao.module_ready=function(){}})(window);var e=(function(){var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var g={encode:function(l){var h="";var s,q,o;var r,p,n,m;var j=0;do{s=l.charCodeAt(j++);q=l.charCodeAt(j++);o=l.charCodeAt(j++);r=s>>2;p=((s&3)<<4)|(q>>4);n=((q&15)<<2)|(o>>6);m=o&63;if(isNaN(q)){n=m=64}else{if(isNaN(o)){m=64}}h=h+f.charAt(r)+f.charAt(p)+f.charAt(n)+f.charAt(m)}while(j<l.length);return h},decode:function(l){var h="";var s,q,o;var r,p,n,m;var j=0;l=l.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{r=f.indexOf(l.charAt(j++));p=f.indexOf(l.charAt(j++));n=f.indexOf(l.charAt(j++));m=f.indexOf(l.charAt(j++));s=(r<<2)|(p>>4);q=((p&15)<<4)|(n>>2);o=((n&3)<<6)|m;h=h+String.fromCharCode(s);if(n!=64){h=h+String.fromCharCode(q)}if(m!=64){h=h+String.fromCharCode(o)}}while(j<l.length);return h}};return g})();var b=(function(){var v=0;var f="";var s=8;var q=function(z,C){var B=(z&65535)+(C&65535);var A=(z>>16)+(C>>16)+(B>>16);return(A<<16)|(B&65535)};var u=function(y,z){return(y<<z)|(y>>>(32-z))};var g=function(B){var A=[];var y=(1<<s)-1;for(var z=0;z<B.length*s;z+=s){A[z>>5]|=(B.charCodeAt(z/s)&y)<<(z%32)}return A};var n=function(A){var B="";var y=(1<<s)-1;for(var z=0;z<A.length*32;z+=s){B+=String.fromCharCode((A[z>>5]>>>(z%32))&y)}return B};var x=function(A){var z=v?"0123456789ABCDEF":"0123456789abcdef";var B="";for(var y=0;y<A.length*4;y++){B+=z.charAt((A[y>>2]>>((y%4)*8+4))&15)+z.charAt((A[y>>2]>>((y%4)*8))&15)}return B};var w=function(B){var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var D="";var C,y;for(var z=0;z<B.length*4;z+=3){C=(((B[z>>2]>>8*(z%4))&255)<<16)|(((B[z+1>>2]>>8*((z+1)%4))&255)<<8)|((B[z+2>>2]>>8*((z+2)%4))&255);for(y=0;y<4;y++){if(z*8+y*6>B.length*32){D+=f}else{D+=A.charAt((C>>6*(3-y))&63)}}}return D};var j=function(D,A,z,y,C,B){return q(u(q(q(A,D),q(y,B)),C),z)};var r=function(A,z,E,D,y,C,B){return j((z&E)|((~z)&D),A,z,y,C,B)};var h=function(A,z,E,D,y,C,B){return j((z&D)|(E&(~D)),A,z,y,C,B)};var t=function(A,z,E,D,y,C,B){return j(z^E^D,A,z,y,C,B)};var p=function(A,z,E,D,y,C,B){return j(E^(z|(~D)),A,z,y,C,B)};var m=function(I,D){I[D>>5]|=128<<((D)%32);I[(((D+64)>>>9)<<4)+14]=D;var H=1732584193;var G=-271733879;var F=-1732584194;var E=271733878;var C,B,A,y;for(var z=0;z<I.length;z+=16){C=H;B=G;A=F;y=E;H=r(H,G,F,E,I[z+0],7,-680876936);E=r(E,H,G,F,I[z+1],12,-389564586);F=r(F,E,H,G,I[z+2],17,606105819);G=r(G,F,E,H,I[z+3],22,-1044525330);H=r(H,G,F,E,I[z+4],7,-176418897);E=r(E,H,G,F,I[z+5],12,1200080426);F=r(F,E,H,G,I[z+6],17,-1473231341);G=r(G,F,E,H,I[z+7],22,-45705983);H=r(H,G,F,E,I[z+8],7,1770035416);E=r(E,H,G,F,I[z+9],12,-1958414417);F=r(F,E,H,G,I[z+10],17,-42063);G=r(G,F,E,H,I[z+11],22,-1990404162);H=r(H,G,F,E,I[z+12],7,1804603682);E=r(E,H,G,F,I[z+13],12,-40341101);F=r(F,E,H,G,I[z+14],17,-1502002290);G=r(G,F,E,H,I[z+15],22,1236535329);H=h(H,G,F,E,I[z+1],5,-165796510);E=h(E,H,G,F,I[z+6],9,-1069501632);F=h(F,E,H,G,I[z+11],14,643717713);G=h(G,F,E,H,I[z+0],20,-373897302);H=h(H,G,F,E,I[z+5],5,-701558691);E=h(E,H,G,F,I[z+10],9,38016083);F=h(F,E,H,G,I[z+15],14,-660478335);G=h(G,F,E,H,I[z+4],20,-405537848);H=h(H,G,F,E,I[z+9],5,568446438);E=h(E,H,G,F,I[z+14],9,-1019803690);F=h(F,E,H,G,I[z+3],14,-187363961);G=h(G,F,E,H,I[z+8],20,1163531501);H=h(H,G,F,E,I[z+13],5,-1444681467);E=h(E,H,G,F,I[z+2],9,-51403784);F=h(F,E,H,G,I[z+7],14,1735328473);G=h(G,F,E,H,I[z+12],20,-1926607734);H=t(H,G,F,E,I[z+5],4,-378558);E=t(E,H,G,F,I[z+8],11,-2022574463);F=t(F,E,H,G,I[z+11],16,1839030562);G=t(G,F,E,H,I[z+14],23,-35309556);H=t(H,G,F,E,I[z+1],4,-1530992060);E=t(E,H,G,F,I[z+4],11,1272893353);F=t(F,E,H,G,I[z+7],16,-155497632);G=t(G,F,E,H,I[z+10],23,-1094730640);H=t(H,G,F,E,I[z+13],4,681279174);E=t(E,H,G,F,I[z+0],11,-358537222);F=t(F,E,H,G,I[z+3],16,-722521979);G=t(G,F,E,H,I[z+6],23,76029189);H=t(H,G,F,E,I[z+9],4,-640364487);E=t(E,H,G,F,I[z+12],11,-421815835);F=t(F,E,H,G,I[z+15],16,530742520);G=t(G,F,E,H,I[z+2],23,-995338651);H=p(H,G,F,E,I[z+0],6,-198630844);E=p(E,H,G,F,I[z+7],10,1126891415);F=p(F,E,H,G,I[z+14],15,-1416354905);G=p(G,F,E,H,I[z+5],21,-57434055);H=p(H,G,F,E,I[z+12],6,1700485571);E=p(E,H,G,F,I[z+3],10,-1894986606);F=p(F,E,H,G,I[z+10],15,-1051523);G=p(G,F,E,H,I[z+1],21,-2054922799);H=p(H,G,F,E,I[z+8],6,1873313359);E=p(E,H,G,F,I[z+15],10,-30611744);F=p(F,E,H,G,I[z+6],15,-1560198380);G=p(G,F,E,H,I[z+13],21,1309151649);H=p(H,G,F,E,I[z+4],6,-145523070);E=p(E,H,G,F,I[z+11],10,-1120210379);F=p(F,E,H,G,I[z+2],15,718787259);G=p(G,F,E,H,I[z+9],21,-343485551);H=q(H,C);G=q(G,B);F=q(F,A);E=q(E,y)}return[H,G,F,E]};var l=function(A,D){var C=g(A);if(C.length>16){C=m(C,A.length*s)}var y=new Array(16),B=new Array(16);for(var z=0;z<16;z++){y[z]=C[z]^909522486;B[z]=C[z]^1549556828}var E=m(y.concat(g(D)),512+D.length*s);return m(B.concat(E),512+128)};var o={hexdigest:function(y){return x(m(g(y),y.length*s))},b64digest:function(y){return w(m(g(y),y.length*s))},hash:function(y){return n(m(g(y),y.length*s))},hmac_hexdigest:function(y,z){return x(l(y,z))},hmac_b64digest:function(y,z){return w(l(y,z))},hmac_hash:function(y,z){return n(l(y,z))},test:function(){return b.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72"}};return o})();if(!Function.prototype.bind){Function.prototype.bind=function(g){var f=this;return function(){return f.apply(g,arguments)}}}if(!Function.prototype.prependArg){Function.prototype.prependArg=function(f){var g=this;return function(){var j=[f];for(var h=0;h<arguments.length;h++){j.push(arguments[h])}return g.apply(this,j)}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(g){var f=this.length;var h=Number(arguments[1])||0;h=(h<0)?Math.ceil(h):Math.floor(h);if(h<0){h+=f}for(;h<f;h++){if(h in this&&this[h]===g){return h}}return -1}}(function(m){var l;function h(o,n){return new l.Builder(o,n)}function f(n){return new l.Builder("message",n)}function j(n){return new l.Builder("iq",n)}function g(n){return new l.Builder("presence",n)}l={VERSION:"1.0.1",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(n,o){l.NS[n]=o},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(q,r,p){var o,n;for(o=0;o<q.childNodes.length;o++){n=q.childNodes[o];if(n.nodeType==l.ElementType.NORMAL&&(!r||this.isTagEqual(n,r))){p(n)}}},isTagEqual:function(o,n){return o.tagName.toLowerCase()==n.toLowerCase()},_xmlGenerator:null,_makeGenerator:function(){var n;if(window.ActiveXObject){n=new ActiveXObject("Microsoft.XMLDOM");n.appendChild(n.createElement("strophe"))}else{n=document.implementation.createDocument("jabber:client","strophe",null)}return n},xmlElement:function(p){if(!p){return null}var r=null;if(!l._xmlGenerator){l._xmlGenerator=l._makeGenerator()}r=l._xmlGenerator.createElement(p);var n,q,o;for(n=1;n<arguments.length;n++){if(!arguments[n]){continue}if(typeof(arguments[n])=="string"||typeof(arguments[n])=="number"){r.appendChild(l.xmlTextNode(arguments[n]))}else{if(typeof(arguments[n])=="object"&&typeof(arguments[n].sort)=="function"){for(q=0;q<arguments[n].length;q++){if(typeof(arguments[n][q])=="object"&&typeof(arguments[n][q].sort)=="function"){r.setAttribute(arguments[n][q][0],arguments[n][q][1])}}}else{if(typeof(arguments[n])=="object"){for(o in arguments[n]){if(arguments[n].hasOwnProperty(o)){r.setAttribute(o,arguments[n][o])}}}}}}return r},xmlescape:function(n){n=n.replace(/\&/g,"&amp;");n=n.replace(/</g,"&lt;");n=n.replace(/>/g,"&gt;");return n},xmlTextNode:function(n){n=l.xmlescape(n);if(!l._xmlGenerator){l._xmlGenerator=l._makeGenerator()}return l._xmlGenerator.createTextNode(n)},getText:function(o){if(!o){return null}var p="";if(o.childNodes.length===0&&o.nodeType==l.ElementType.TEXT){p+=o.nodeValue}for(var n=0;n<o.childNodes.length;n++){if(o.childNodes[n].nodeType==l.ElementType.TEXT){p+=o.childNodes[n].nodeValue}}return p},copyElement:function(p){var n,o;if(p.nodeType==l.ElementType.NORMAL){o=l.xmlElement(p.tagName);for(n=0;n<p.attributes.length;n++){o.setAttribute(p.attributes[n].nodeName.toLowerCase(),p.attributes[n].value)}for(n=0;n<p.childNodes.length;n++){o.appendChild(l.copyElement(p.childNodes[n]))}}else{if(p.nodeType==l.ElementType.TEXT){o=l.xmlTextNode(p.nodeValue)}}return o},escapeNode:function(n){return n.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(n){return n.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(n){if(n.indexOf("@")<0){return null}return n.split("@")[0]},getDomainFromJid:function(n){var o=l.getBareJidFromJid(n);if(o.indexOf("@")<0){return o}else{var p=o.split("@");p.splice(0,1);return p.join("@")}},getResourceFromJid:function(n){var o=n.split("/");if(o.length<2){return null}o.splice(0,1);return o.join("/")},getBareJidFromJid:function(n){return n.split("/")[0]},log:function(o,n){return},debug:function(n){this.log(this.LogLevel.DEBUG,n)},info:function(n){this.log(this.LogLevel.INFO,n)},warn:function(n){this.log(this.LogLevel.WARN,n)},error:function(n){this.log(this.LogLevel.ERROR,n)},fatal:function(n){this.log(this.LogLevel.FATAL,n)},serialize:function(p){var n;if(!p){return null}if(typeof(p.tree)==="function"){p=p.tree()}var r=p.nodeName;var o,q;if(p.getAttribute("_realname")){r=p.getAttribute("_realname")}n="<"+r;for(o=0;o<p.attributes.length;o++){if(p.attributes[o].nodeName!="_realname"){n+=" "+p.attributes[o].nodeName.toLowerCase()+"='"+p.attributes[o].value.replace("&","&amp;").replace("'","&apos;").replace("<","&lt;")+"'"}}if(p.childNodes.length>0){n+=">";for(o=0;o<p.childNodes.length;o++){q=p.childNodes[o];if(q.nodeType==l.ElementType.NORMAL){n+=l.serialize(q)}else{if(q.nodeType==l.ElementType.TEXT){n+=q.nodeValue}}}n+="</"+r+">"}else{n+="/>"}return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(n,o){l._connectionPlugins[n]=o}};l.Builder=function(o,n){if(o=="presence"||o=="message"||o=="iq"){if(n&&!n.xmlns){n.xmlns=l.NS.CLIENT}else{if(!n){n={xmlns:l.NS.CLIENT}}}}this.nodeTree=l.xmlElement(o,n);this.node=this.nodeTree};l.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return l.serialize(this.nodeTree)},up:function(){this.node=this.node.parentNode;return this},attrs:function(o){for(var n in o){if(o.hasOwnProperty(n)){this.node.setAttribute(n,o[n])}}return this},c:function(o,n){var p=l.xmlElement(o,n);this.node.appendChild(p);this.node=p;return this},cnode:function(n){this.node.appendChild(n);this.node=n;return this},t:function(n){var o=l.xmlTextNode(n);this.node.appendChild(o);return this}};l.Handler=function(r,q,o,p,t,s,n){this.handler=r;this.ns=q;this.name=o;this.type=p;this.id=t;this.options=n||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false}if(this.options.matchBare){this.from=l.getBareJidFromJid(s)}else{this.from=s}this.user=true};l.Handler.prototype={isMatch:function(o){var q;var p=null;if(this.options.matchBare){p=l.getBareJidFromJid(o.getAttribute("from"))}else{p=o.getAttribute("from")}q=false;if(!this.ns){q=true}else{var n=this;l.forEachChild(o,null,function(r){if(r.getAttribute("xmlns")==n.ns){q=true}});q=q||o.getAttribute("xmlns")==this.ns}if(q&&(!this.name||l.isTagEqual(o,this.name))&&(!this.type||o.getAttribute("type")===this.type)&&(!this.id||o.getAttribute("id")===this.id)&&(!this.from||p===this.from)){return true}return false},run:function(o){var n=null;try{n=this.handler(o)}catch(p){if(p.sourceURL){l.fatal("error: "+this.handler+" "+p.sourceURL+":"+p.line+" - "+p.name+": "+p.message)}else{if(p.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",p,p.message)}l.fatal("error: "+this.handler+" "+p.fileName+":"+p.lineNumber+" - "+p.name+": "+p.message)}else{l.fatal("error: "+this.handler)}}throw p}return n},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}};l.TimedHandler=function(o,n){this.period=o;this.handler=n;this.lastCalled=new Date().getTime();this.user=true};l.TimedHandler.prototype={run:function(){this.lastCalled=new Date().getTime();return this.handler()},reset:function(){this.lastCalled=new Date().getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}};l.Request=function(p,o,n,q){this.id=++l._requestId;this.xmlData=p;this.data=l.serialize(p);this.origFunc=o;this.func=o;this.rid=n;this.date=NaN;this.sends=q||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0}var r=new Date();return(r-this.date)/1000};this.timeDead=function(){if(!this.dead){return 0}var r=new Date();return(r-this.dead)/1000};this.xhr=this._newXHR()};l.Request.prototype={getResponse:function(){var n=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){n=this.xhr.responseXML.documentElement;if(n.tagName=="parsererror"){l.error("invalid response received");l.error("responseText: "+this.xhr.responseText);l.error("responseXML: "+l.serialize(this.xhr.responseXML));throw"parsererror"}}else{if(this.xhr.responseText){l.error("invalid response received");l.error("responseText: "+this.xhr.responseText);l.error("responseXML: "+l.serialize(this.xhr.responseXML))}}return n},_newXHR:function(){var n=null;if(window.XMLHttpRequest){n=new XMLHttpRequest();if(n.overrideMimeType){n.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){n=new ActiveXObject("Microsoft.XMLHTTP")}}n.onreadystatechange=this.func.prependArg(this);return n}};l.Connection=function(n){this.service=n;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var o in l._connectionPlugins){if(l._connectionPlugins.hasOwnProperty(o)){var q=l._connectionPlugins[o];var p=function(){};p.prototype=q;this[o]=new p();this[o].init(this)}}};l.Connection.prototype={reset:function(){this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000)},pause:function(){this.paused=true},resume:function(){this.paused=false},getUniqueId:function(n){if(typeof(n)=="string"||typeof(n)=="number"){return ++this._uniqueId+":"+n}else{return ++this._uniqueId+""}},connect:function(o,p,s,r,q){this.jid=o;this.pass=p;this.connect_callback=s;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=r||this.wait;this.hold=q||this.hold;this.domain=l.getDomainFromJid(this.jid);var n=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":l.NS.BOSH});this._changeConnectStatus(l.Status.CONNECTING,null);this._requests.push(new l.Request(n.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),n.tree().getAttribute("rid")));this._throttledRequestHandler()},attach:function(p,n,q,t,s,r,o){this.jid=p;this.sid=n;this.rid=q;this.connect_callback=t;this.domain=l.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=s||this.wait;this.hold=r||this.hold;this.window=o||this.window;this._changeConnectStatus(l.Status.ATTACHED,null)},xmlInput:function(n){return},xmlOutput:function(n){return},rawInput:function(n){return},rawOutput:function(n){return},send:function(o){if(o===null){return}if(typeof(o.sort)==="function"){for(var n=0;n<o.length;n++){this._queueData(o[n])}}else{if(typeof(o.tree)==="function"){this._queueData(o.tree())}else{this._queueData(o)}}this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},flush:function(){clearTimeout(this._idleTimeout);this._onIdle()},sendIQ:function(q,u,n,r){var s=null;var p=this;if(typeof(q.tree)==="function"){q=q.tree()}var t=q.getAttribute("id");if(!t){t=this.getUniqueId("sendIQ");q.setAttribute("id",t)}var o=this.addHandler(function(w){if(s){p.deleteTimedHandler(s)}var v=w.getAttribute("type");if(v==="result"){if(u){u(w)}}else{if(v==="error"){if(n){n(w)}}else{throw {name:"StropheError",message:"Got bad IQ type of "+v}}}},null,"iq",null,t);if(r){s=this.addTimedHandler(r,function(){p.deleteHandler(o);if(n){n(null)}return false})}this.send(q);return t},_queueData:function(n){if(n===null||!n.tagName||!n.childNodes){throw {name:"StropheError",message:"Cannot queue non-DOMElement."}}this._data.push(n)},_sendRestart:function(){this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(p,o){var n=new l.TimedHandler(p,o);this.addTimeds.push(n);return n},deleteTimedHandler:function(n){this.removeTimeds.push(n)},addHandler:function(s,r,p,q,u,t,o){var n=new l.Handler(s,r,p,q,u,t,o);this.addHandlers.push(n);return n},deleteHandler:function(n){this.removeHandlers.push(n)},disconnect:function(n){this._changeConnectStatus(l.Status.DISCONNECTING,n);l.info("Disconnect was called because: "+n);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(30000,this._onDisconnectTimeout.bind(this));this._sendTerminate()}},_changeConnectStatus:function(n,s){for(var o in l._connectionPlugins){if(l._connectionPlugins.hasOwnProperty(o)){var q=this[o];if(q.statusChanged){try{q.statusChanged(n,s)}catch(p){l.error(""+o+" plugin caused an exception changing status: "+p)}}}}if(this.connect_callback){try{this.connect_callback(n,s)}catch(r){l.error("User connection callback caused an exception: "+r)}}},_buildBody:function(){var n=h("body",{rid:this.rid++,xmlns:l.NS.HTTPBIND});if(this.sid!==null){n.attrs({sid:this.sid})}return n},_removeRequest:function(o){l.debug("removing request");var n;for(n=this._requests.length-1;n>=0;n--){if(o==this._requests[n]){this._requests.splice(n,1)}}o.xhr.onreadystatechange=function(){};this._throttledRequestHandler()},_restartRequest:function(n){var o=this._requests[n];if(o.dead===null){o.dead=new Date()}this._processRequest(n)},_processRequest:function(p){var u=this._requests[p];var x=-1;try{if(u.xhr.readyState==4){x=u.xhr.status}}catch(s){l.error("caught an error in _requests["+p+"], reqStatus: "+x)}if(typeof(x)=="undefined"){x=-1}var o=u.age();var n=(!isNaN(o)&&o>Math.floor(l.TIMEOUT*this.wait));var q=(u.dead!==null&&u.timeDead()>Math.floor(l.SECONDARY_TIMEOUT*this.wait));var w=(u.xhr.readyState==4&&(x<1||x>=500));if(n||q||w){if(q){l.error("Request "+this._requests[p].id+" timed out (secondary), restarting")}u.abort=true;u.xhr.abort();u.xhr.onreadystatechange=function(){};this._requests[p]=new l.Request(u.xmlData,u.origFunc,u.rid,u.sends);u=this._requests[p]}if(u.xhr.readyState===0){l.debug("request id "+u.id+"."+u.sends+" posting");u.date=new Date();try{u.xhr.open("POST",this.service,true)}catch(t){l.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(l.Status.CONNFAIL,"bad-service")}this.disconnect();return}var v=function(){u.xhr.send(u.data)};if(u.sends>1){var r=Math.pow(u.sends,3)*1000;setTimeout(v,r)}else{v()}u.sends++;this.xmlOutput(u.xmlData);this.rawOutput(u.data)}else{l.debug("_processRequest: "+(p===0?"first":"second")+" request has readyState of "+u.xhr.readyState)}},_throttledRequestHandler:function(){if(!this._requests){l.debug("_throttledRequestHandler called with undefined requests")}else{l.debug("_throttledRequestHandler called with "+this._requests.length+" requests")}if(!this._requests||this._requests.length===0){return}if(this._requests.length>0){this._processRequest(0)}if(this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window-1){this._processRequest(1)}},_onRequestStateChange:function(q,p){l.debug("request id "+p.id+"."+p.sends+" state changed to "+p.xhr.readyState);if(p.abort){p.abort=false;return}var o;if(p.xhr.readyState==4){o=0;try{o=p.xhr.status}catch(r){}if(typeof(o)=="undefined"){o=0}if(this.disconnecting){if(o>=400){this._hitError(o);return}}var n=(this._requests[0]==p);var s=(this._requests[1]==p);if((o>0&&o<500)||p.sends>5){this._removeRequest(p);l.debug("request id "+p.id+" should now be removed")}if(o==200){if(s||(n&&this._requests.length>0&&this._requests[0].age()>Math.floor(l.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0)}l.debug("request id "+p.id+"."+p.sends+" got 200");q(p);this.errors=0}else{l.error("request id "+p.id+"."+p.sends+" error "+o+" happened");if(o===0||(o>=400&&o<600)||o>=12000){this._hitError(o);if(o>=400&&o<500){this._changeConnectStatus(l.Status.DISCONNECTING,null);this._doDisconnect()}}}if(!((o>0&&o<10000)||p.sends>5)){this._throttledRequestHandler()}}},_hitError:function(n){this.errors++;l.warn("request errored, status: "+n+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout()}},_doDisconnect:function(){l.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(l.Status.DISCONNECTED,null);this.connected=false}this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[]},_dataRecv:function(v){try{var n=v.getResponse()}catch(t){if(t!="parsererror"){throw t}this.disconnect("strophe-parsererror")}if(n===null){return}this.xmlInput(n);this.rawInput(l.serialize(n));var r,p;while(this.removeHandlers.length>0){p=this.removeHandlers.pop();r=this.handlers.indexOf(p);if(r>=0){this.handlers.splice(r,1)}}while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop())}if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return}var o=n.getAttribute("type");var u,q;if(o!==null&&o=="terminate"){u=n.getAttribute("condition");q=n.getElementsByTagName("conflict");if(u!==null){if(u=="remote-stream-error"&&q.length>0){u="conflict"}this._changeConnectStatus(l.Status.CONNFAIL,u)}else{this._changeConnectStatus(l.Status.CONNFAIL,"unknown")}this.disconnect();return}var s=this;l.forEachChild(n,null,function(z){var x,y;y=s.handlers;s.handlers=[];for(x=0;x<y.length;x++){var w=y[x];if(w.isMatch(z)&&(s.authenticated||!w.user)){if(w.run(z)){s.handlers.push(w)}}else{s.handlers.push(w)}}})},_sendTerminate:function(){l.info("_sendTerminate was called");var n=this._buildBody().attrs({type:"terminate"});if(this.authenticated){n.c("presence",{xmlns:l.NS.CLIENT,type:"unavailable"})}this.disconnecting=true;var o=new l.Request(n.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),n.tree().getAttribute("rid"));this._requests.push(o);this._throttledRequestHandler()},_connect_cb:function(B){l.info("_connect_cb was called");this.connected=true;var o=B.getResponse();if(!o){return}this.xmlInput(o);this.rawInput(l.serialize(o));var s=o.getAttribute("type");var A,u;if(s!==null&&s=="terminate"){A=o.getAttribute("condition");u=o.getElementsByTagName("conflict");if(A!==null){if(A=="remote-stream-error"&&u.length>0){A="conflict"}this._changeConnectStatus(l.Status.CONNFAIL,A)}else{this._changeConnectStatus(l.Status.CONNFAIL,"unknown")}return}if(!this.sid){this.sid=o.getAttribute("sid")}if(!this.stream_id){this.stream_id=o.getAttribute("authid")}var p=o.getAttribute("requests");if(p){this.window=parseInt(p,10)}var n=o.getAttribute("hold");if(n){this.hold=parseInt(n,10)}var w=o.getAttribute("wait");if(w){this.wait=parseInt(w,10)}var C=false;var r=false;var z=false;var D=o.getElementsByTagName("mechanism");var t,y,v,q;if(D.length>0){for(t=0;t<D.length;t++){y=l.getText(D[t]);if(y=="DIGEST-MD5"){r=true}else{if(y=="PLAIN"){C=true}else{if(y=="ANONYMOUS"){z=true}}}}}else{var x=this._buildBody();this._requests.push(new l.Request(x.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),x.tree().getAttribute("rid")));this._throttledRequestHandler();return}if(l.getNodeFromJid(this.jid)===null&&z){this._changeConnectStatus(l.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(h("auth",{xmlns:l.NS.SASL,mechanism:"ANONYMOUS"}).tree())}else{if(l.getNodeFromJid(this.jid)===null){this._changeConnectStatus(l.Status.CONNFAIL,"x-strophe-bad-non-anon-jid");this.disconnect()}else{if(r){this._changeConnectStatus(l.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(h("auth",{xmlns:l.NS.SASL,mechanism:"DIGEST-MD5"}).tree())}else{if(C){v=l.getBareJidFromJid(this.jid);v=v+"\u0000";v=v+l.getNodeFromJid(this.jid);v=v+"\u0000";v=v+this.pass;this._changeConnectStatus(l.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);q=e.encode(v);this.send(h("auth",{xmlns:l.NS.SASL,mechanism:"PLAIN"}).t(q).tree())}else{this._changeConnectStatus(l.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send(j({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:l.NS.AUTH}).c("username",{}).t(l.getNodeFromJid(this.jid)).tree())}}}}},_sasl_challenge1_cb:function(r){var o=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var x=e.decode(l.getText(r));var y=b.hexdigest(Math.random()*1234567890);var u="";var z=null;var v="";var n="";var t;this.deleteHandler(this._sasl_failure_handler);while(x.match(o)){t=x.match(o);x=x.replace(t[0],"");t[2]=t[2].replace(/^"(.+)"$/,"$1");switch(t[1]){case"realm":u=t[2];break;case"nonce":v=t[2];break;case"qop":n=t[2];break;case"host":z=t[2];break}}var s="xmpp/"+this.domain;if(z!==null){s=s+"/"+z}var q=b.hash(l.getNodeFromJid(this.jid)+":"+u+":"+this.pass)+":"+v+":"+y;var p="AUTHENTICATE:"+s;var w="";w+="username="+this._quote(l.getNodeFromJid(this.jid))+",";w+="realm="+this._quote(u)+",";w+="nonce="+this._quote(v)+",";w+="cnonce="+this._quote(y)+",";w+='nc="00000001",';w+='qop="auth",';w+="digest-uri="+this._quote(s)+",";w+="response="+this._quote(b.hexdigest(b.hexdigest(q)+":"+v+":00000001:"+y+":auth:"+b.hexdigest(p)))+",";w+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(h("response",{xmlns:l.NS.SASL}).t(e.encode(w)).tree());return false},_quote:function(n){return'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},_sasl_challenge2_cb:function(n){this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(h("response",{xmlns:l.NS.SASL}).tree());return false},_auth1_cb:function(n){var o=j({type:"set",id:"_auth_2"}).c("query",{xmlns:l.NS.AUTH}).c("username",{}).t(l.getNodeFromJid(this.jid)).up().c("password").t(this.pass);if(!l.getResourceFromJid(this.jid)){this.jid=l.getBareJidFromJid(this.jid)+"/strophe"}o.up().c("resource",{}).t(l.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(o.tree());return false},_sasl_success_cb:function(n){l.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false},_sasl_auth1_cb:function(o){var n,q;for(n=0;n<o.childNodes.length;n++){q=o.childNodes[n];if(q.nodeName=="bind"){this.do_bind=true}if(q.nodeName=="session"){this.do_session=true}}if(!this.do_bind){this._changeConnectStatus(l.Status.AUTHFAIL,null);return false}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var p=l.getResourceFromJid(this.jid);if(p){this.send(j({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:l.NS.BIND}).c("resource",{}).t(p).tree())}else{this.send(j({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:l.NS.BIND}).tree())}}return false},_sasl_bind_cb:function(n){if(n.getAttribute("type")=="error"){l.info("SASL binding failed.");this._changeConnectStatus(l.Status.AUTHFAIL,null);return false}var p=n.getElementsByTagName("bind");var o;if(p.length>0){o=p[0].getElementsByTagName("jid");if(o.length>0){this.jid=l.getText(o[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send(j({type:"set",id:"_session_auth_2"}).c("session",{xmlns:l.NS.SESSION}).tree())}else{this.authenticated=true;this._changeConnectStatus(l.Status.CONNECTED,null)}}}else{l.info("SASL binding failed.");this._changeConnectStatus(l.Status.AUTHFAIL,null);return false}},_sasl_session_cb:function(n){if(n.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(l.Status.CONNECTED,null)}else{if(n.getAttribute("type")=="error"){l.info("Session creation failed.");this._changeConnectStatus(l.Status.AUTHFAIL,null);return false}}return false},_sasl_failure_cb:function(n){if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null}if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._changeConnectStatus(l.Status.AUTHFAIL,null);return false},_auth2_cb:function(n){if(n.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(l.Status.CONNECTED,null)}else{if(n.getAttribute("type")=="error"){this._changeConnectStatus(l.Status.AUTHFAIL,null);this.disconnect()}}return false},_addSysTimedHandler:function(p,o){var n=new l.TimedHandler(p,o);n.user=false;this.addTimeds.push(n);return n},_addSysHandler:function(r,q,o,p,s){var n=new l.Handler(r,q,o,p,s);n.user=false;this.addHandlers.push(n);return n},_onDisconnectTimeout:function(){l.info("_onDisconnectTimeout was called");var n;while(this._requests.length>0){n=this._requests.pop();n.abort=true;n.xhr.abort();n.xhr.onreadystatechange=function(){}}this._doDisconnect();return false},_onIdle:function(){var p,r,t,q;while(this.removeTimeds.length>0){r=this.removeTimeds.pop();p=this.timedHandlers.indexOf(r);if(p>=0){this.timedHandlers.splice(p,1)}}while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop())}var o=new Date().getTime();q=[];for(p=0;p<this.timedHandlers.length;p++){r=this.timedHandlers[p];if(this.authenticated||!r.user){t=r.lastCalled+r.period;if(t-o<=0){if(r.run()){q.push(r)}}else{q.push(r)}}}this.timedHandlers=q;var n,s;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){l.info("no requests during idle cycle, sending blank request");this._data.push(null)}if(this._requests.length<2&&this._data.length>0&&!this.paused){n=this._buildBody();for(p=0;p<this._data.length;p++){if(this._data[p]!==null){if(this._data[p]==="restart"){n.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":l.NS.BOSH})}else{n.cnode(this._data[p]).up()}}}delete this._data;this._data=[];this._requests.push(new l.Request(n.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),n.tree().getAttribute("rid")));this._processRequest(this._requests.length-1)}if(this._requests.length>0){s=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(l.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler()}}if(s>Math.floor(l.TIMEOUT*this.wait)){l.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(l.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler()}}clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)}};if(m){m(l,h,f,j,g)}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4]});Strophe.addConnectionPlugin("cors",{init:function(){if(window.XDomainRequest){Strophe.debug("CORS with IE");Strophe.Request.prototype._newXHR=function(){var g=function(n,m){n.status=m;n.readyState=4;try{n.onreadystatechange()}catch(l){}n.readyState=0;try{n.onreadystatechange()}catch(l){}};var j=new XDomainRequest();j.readyState=0;j.onreadystatechange=this.func.prependArg(this);j.onload=function(){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(j.responseText);j.responseXML=xmlDoc;g(j,200)};j.onerror=function(){g(j,500)};j.ontimeout=function(){g(j,500)};var h=j.send;j.send=function(l){j.readyState=2;return h(l)};return j}}else{if((window.XMLHttpRequest||window.XMLHttpRequest!==undefined)&&(new XMLHttpRequest().withCredentials!==undefined)){Strophe.debug("CORS with Firefox/Safari/Chome")}else{if(flensed&&flensed.flXHR){Strophe.debug("CORS not supported, using flXHR");var f=true;if(navigator.userAgent.indexOf("MSIE")!=-1){f=false}Strophe.Request.prototype._newXHR=function(){var g=new flensed.flXHR({autoUpdatePlayer:true,instancePooling:f,noCacheHeader:false});g.onreadystatechange=this.func.prependArg(this);return g}}else{Strophe.error("No CORS and no flXHR. You may experience cross domain turbulence.")}}}}});Phono.util={guid:function(){return b.hexdigest(new String((new Date()).getTime()))},escapeXmppNode:function(f){var g=f;g=g.replace(/\\/g,"\\5c");g=g.replace(/ /g,"\\20");g=g.replace(/\"/,"\\22");g=g.replace(/&/g,"\\26");g=g.replace(/\'/,"\\27");g=g.replace(/\//g,"\\2f");g=g.replace(/:/g,"\\3a");g=g.replace(/</g,"\\3c");g=g.replace(/>/g,"\\3e");g=g.replace(/@/g,"\\40");return g},each:function(j,o,h){var g,l=0,m=j.length,f=m===undefined||jQuery.isFunction(j);if(h){if(f){for(g in j){if(o.apply(j[g],h)===false){break}}}else{for(;l<m;){if(o.apply(j[l++],h)===false){break}}}}else{if(f){for(g in j){if(o.call(j[g],g,j[g])===false){break}}}else{for(var n=j[0];l<m&&o.call(n,l,n)!==false;n=j[++l]){}}}return j},isFunction:function(f){return toString.call(f)==="[object Function]"},isArray:function(f){return toString.call(f)==="[object Array]"},isPlainObject:function(g){if(!g||toString.call(g)!=="[object Object]"||g.nodeType||g.setInterval){return false}if(g.constructor&&!hasOwnProperty.call(g,"constructor")&&!hasOwnProperty.call(g.constructor.prototype,"isPrototypeOf")){return false}var f;for(f in g){}return f===undefined||hasOwnProperty.call(g,f)},extend:function(){var m=arguments[0]||{},l=1,j=arguments.length,o=false,p,h,f,g;if(typeof m==="boolean"){o=m;m=arguments[1]||{};l=2}if(typeof m!=="object"&&!jQuery.isFunction(m)){m={}}if(j===l){m=this;--l}for(;l<j;l++){if((p=arguments[l])!=null){for(h in p){f=m[h];g=p[h];if(m===g){continue}if(o&&g&&(jQuery.isPlainObject(g)||jQuery.isArray(g))){var n=f&&(jQuery.isPlainObject(f)||jQuery.isArray(f))?f:jQuery.isArray(g)?[]:{};m[h]=jQuery.extend(o,n,g)}else{if(g!==undefined){m[h]=g}}}}}return m},eventCounter:1,addEvent:function(j,h,g){if(!g.$$guid){g.$$guid=this.eventCounter++}if(!j.events){j.events={}}var f=j.events[h];if(!f){f=j.events[h]={};if(j["on"+h]){f[0]=j["on"+h]}}f[g.$$guid]=g;j["on"+h]=handleEvent},removeEvent:function(h,g,f){if(h.events&&h.events[g]){delete h.events[g][f.$$guid]}},handleEvent:function(j){var h=true;var f=this.events[j.type];for(var g in f){this.$$handleEvent=f[g];if(this.$$handleEvent(j)===false){h=false}}return h}};Phono.events={handlerCount:1,add:function(j,h,g){h=h.toLowerCase();if(!g.$$guid){g.$$guid=this.handlerCount++}if(!j.events){j.events={}}var f=j.events[h];if(!f){f=j.events[h]={};if(j["on"+h]){f[0]=j["on"+h]}}f[g.$$guid]=g;j["on"+h]=this.handle},bind:function(h,g){var f;for(k in g){if(k.match("^on")){this.add(h,k.substr(2).toLowerCase(),g[k])}}},remove:function(h,g,f){g=g.toLowerCase();if(h.events&&h.events[g]){delete h.events[g][f.$$guid]}},trigger:function(l,g,h,j){h=h||{};h.type=g;var f=l["on"+g.toLowerCase()];if(f){f.call(l,h,j)}},handle:function(j,l){var f=this.events[j.type.toLowerCase()];j.source=this;var g=new Array();g.push(j);if(l){var h;for(h=0;h<l.length;h++){g.push(l[h])}}var m=this;Phono.util.each(f,function(){this.apply(m,g)})}};(function(){function w(g,f){if(f){for(key in f){if(f.hasOwnProperty(key)){g[key]=f[key]}}}return g}function r(g,f){var l=[];for(var h in g){if(g.hasOwnProperty(h)){l[h]=f(g[h])}}return l}function q(g,f,l){if(x.isSupported(f.version)){g.innerHTML=x.getHTML(f,l)}else{if(f.expressInstall&&x.isSupported([6,65])){g.innerHTML=x.getHTML(w(f,{src:f.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!g.innerHTML.replace(/\s/g,"")){g.innerHTML="<h2>Flash version "+f.version+" or greater is required</h2><h3>"+(v[0]>0?"Your version is "+v:"You have no flash plugin installed")+"</h3>"+(g.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+s+"'>here</a></p>");if(g.tagName=="A"){g.onclick=function(){location.href=s}}}if(f.onFail){var h=f.onFail.call(this);if(typeof h=="string"){g.innerHTML=h}}}}if(u){window[f.id]=document.getElementById(f.id)}w(this,{getRoot:function(){return g},getOptions:function(){return f},getConf:function(){return l},getApi:function(){return g.firstChild}})}var u=document.all,s="http://www.adobe.com/go/getflashplayer",p=typeof jQuery=="function",j=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,t={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}});window.flashembed=function(g,f,h){if(typeof g=="string"){g=document.getElementById(g.replace("#",""))}if(g){if(typeof f=="string"){f={src:f}}return new q(g,w(w({},t),f),h)}};var x=w(window.flashembed,{conf:t,getVersion:function(){var g;try{g=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(f){try{var l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");g=l&&l.GetVariable("$version")}catch(h){}}return(g=j.exec(g))?[g[1],g[3]]:[0,0]},asString:function(g){if(g===null||g===undefined){return null}var f=typeof g;if(f=="object"&&g.push){f="array"}switch(f){case"string":g=g.replace(new RegExp('(["\\\\])',"g"),"\\$1");g=g.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+g+'"';case"array":return"["+r(g,function(l){return x.asString(l)}).join(",")+"]";case"function":return'"function()"';case"object":f=[];for(var h in g){g.hasOwnProperty(h)&&f.push('"'+h+'":'+x.asString(g[h]))}return"{"+f.join(",")+"}"}return String(g).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(g,f){g=w({},g);var m='<object width="'+g.width+'" height="'+g.height+'" id="'+g.id+'" name="'+g.id+'"';if(g.cachebusting){g.src+=(g.src.indexOf("?")!=-1?"&":"?")+Math.random()}m+=g.w3c||!u?' data="'+g.src+'" type="application/x-shockwave-flash"':' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';m+=">";if(g.w3c||u){m+='<param name="movie" value="'+g.src+'" />'}g.width=g.height=g.id=g.w3c=g.src=null;g.onFail=g.version=g.expressInstall=null;for(var l in g){if(g[l]){m+='<param name="'+l+'" value="'+g[l]+'" />'}}g="";if(f){for(var h in f){if(f[h]){l=f[h];g+=h+"="+(/function|object/.test(typeof l)?x.asString(l):l)+"&"}}g=g.slice(0,-1);m+='<param name="flashvars" value=\''+g+"' />"}m+="</object>";return m},isSupported:function(f){return v[0]>f[0]||v[0]==f[0]&&v[1]>=f[1]}}),v=x.getVersion();if(p){jQuery.tools=jQuery.tools||{version:"1.2.2"};jQuery.tools.flashembed={conf:t};jQuery.fn.flashembed=function(g,f){return this.each(function(){$(this).data("flashembed",flashembed(this,g,f))})}}})();(function(){function f(h,j,m){this.config=Phono.util.extend({swf:"http://s.phono.com/releases/"+Phono.version+"/plugins/audio/phono.audio.swf"},j);Phono.events.bind(this,j);var g=this.config.containerId;if(!g){this.config.containerId=g=this.createContainer()}Phono.events.bind(this,{onPermissionBoxShow:function(){var n=$("#"+g).position();$("#"+g).css("left",parseInt(n.left));$("#"+g).css("top",parseInt(n.top))}});var l=this;FABridge.addInitializationCallback(g,function(){Phono.log.info("FlashAudio Ready");l.$flash=this.create("Wrapper").getAudio();l.$flash.addEventListener(null,function(o){var n=(o.getType()+"");Phono.events.trigger(l,n)});m(l)});wmodeSetting="opaque";if((navigator.appVersion.indexOf("X11")!=-1)||(navigator.appVersion.indexOf("Linux")!=-1)||(jQuery.browser.opera)){wmodeSetting="window"}flashembed(g,{id:g+"id",src:this.config.swf,wmode:wmodeSetting},{bridgeName:g})}f.count=0;f.prototype.showPermissionBox=function(){this.$flash.showPermissionBox()};f.prototype.permission=function(){return this.$flash.getHasPermission()};f.prototype.play=function(g,j){var h=this.$flash.play(g,j);return{url:function(){return h.getUrl()},start:function(){h.start()},stop:function(){h.stop()},volume:function(l){if(arguments.length===0){return h.getVolume()}else{h.setVolume(l)}}}};f.prototype.share=function(g,h,l){var j=this.$flash.share(g,h,l.id,l.name,l.rate);return{url:function(){return j.getUrl()},codec:function(){var m=j.getCodec();return{id:m.getId(),name:m.getName(),rate:m.getRate()}},start:function(){j.start()},stop:function(){j.stop()},digit:function(n,o,m){j.digit(n,o,m)},gain:function(m){if(arguments.length===0){return j.getGain()}else{j.setGain(m)}},mute:function(m){if(arguments.length===0){return j.getMute()}else{j.setMute(m)}},suppress:function(m){if(arguments.length===0){return j.getSuppress()}else{j.setSuppress(m)}}}};f.prototype.transport=function(){return{name:this.$flash.getTransport(),description:this.$flash.getDescription()}};f.prototype.codecs=function(){var g=new Array();var h=this.$flash.getCodecs();Phono.util.each(h,function(){g.push({id:this.getId(),name:this.getName(),rate:this.getRate()})});return g};f.prototype.createContainer=function(){var h=$("<div>").attr("id","_phono-audio-flash"+(f.count++)).addClass("phono_FlashHolder").appendTo("body");h.css({width:"1px",height:"1px",position:"absolute",top:"50%",left:"50%","margin-top":"-69px","margin-left":"-107px","z-index":"10001",visibility:"visible"});var g=$(h).attr("id");Phono.events.bind(this,{onPermissionBoxShow:function(){$("#"+g).css({width:"215px",height:"138px"})},onPermissionBoxHide:function(){$("#"+g).css({width:"1px",height:"1px"})}});return g};Phono.registerPlugin("audio",{create:function(g,h,j){return new f(g,h,j)}})})();(function(){function g(h){this.from=null;this.body=null;this.connection=h}g.prototype.reply=function(h){this.connection.send($msg({to:this.from,type:"chat"}).c("body").t(h))};function f(h,j,l){this.connection=h.connection;this.connection.addHandler(this.handleMessage.bind(this),null,"message","chat");Phono.events.bind(this,j);l(this)}f.prototype.send=function(j,h){this.connection.send($msg({to:j,type:"chat"}).c("body").t(h))};f.prototype.handleMessage=function(j){var h=new g(this.connection);h.from=Strophe.getBareJidFromJid($(j).attr("from"));h.body=$(j).find("body").text();Phono.events.trigger(this,"message",{message:h},[h]);return true};Phono.registerPlugin("messaging",{create:function(h,j,l){return new f(h,j,l)}})})();(function(){Strophe.addNamespace("JINGLE","urn:xmpp:jingle:1");Strophe.addNamespace("JINGLE_SESSION_INFO","urn:xmpp:jingle:apps:rtp:1:info");var j={CONNECTED:0,RINGING:1,DISCONNECTED:2,PROGRESS:3,INITIAL:4};var h={OUTBOUND:0,INBOUND:1};function f(l,p,o,m){var n=this;this.phone=l;this.phono=l.phono;this.audioLayer=this.phono.audio;this.connection=this.phono.connection;this.config=Phono.util.extend({pushToTalk:false,mute:false,talking:false,hold:false,volume:50,gain:50,tones:false},m);Phono.util.each(this.config,function(r,q){if(typeof n[r]=="function"){n[r](q)}});this.id=p;this.direction=o;this.state=j.INITIAL;this.remoteJid=null;this.initiator=null;this.headers=[];if(this.config.headers){this.headers=this.config.headers}Phono.events.bind(this,m);this.ringer=this.audioLayer.play(l.ringTone());this.ringback=this.audioLayer.play(l.ringbackTone())}f.prototype.startAudio=function(l){if(this.input){this.input.start()}if(this.output){if(!this.audioLayer.permission()){Phono.events.trigger(this.audioLayer,"permissionBoxShow")}this.output.start()}};f.prototype.stopAudio=function(l){if(this.input){this.input.stop()}if(this.output){this.output.stop()}};f.prototype.start=function(){var m=this;if(m.state!=j.INITIAL){return}var l=$iq({type:"set",to:m.remoteJid});var o=l.c("jingle",{xmlns:Strophe.NS.JINGLE,action:"session-initiate",initiator:m.initiator,sid:m.id});$(m.headers).each(function(){o.c("custom-header",{name:this.name,data:this.value}).up()});var n=this.audioLayer.codecs()[0];o.c("content",{creator:"initiator"}).c("description",{xmlns:this.audioLayer.transport().description}).c("payload-type",{id:n.id,name:n.name,clockrate:n.rate}).up().up().c("transport",{xmlns:this.audioLayer.transport().description});this.connection.sendIQ(l,function(p){m.state=j.PROGRESS})};f.prototype.accept=function(){var m=this;if(m.state!=j.PROGRESS){return}var l=$iq({type:"set",to:m.remoteJid}).c("jingle",{xmlns:Strophe.NS.JINGLE,action:"session-info",initiator:m.initiator,sid:m.id}).c("ringing",{xmlns:Strophe.NS.JINGLE_SESSION_INFO});this.connection.sendIQ(l,function(n){m.state=j.RINGING;Phono.events.trigger(m,"ring")})};f.prototype.answer=function(){var m=this;if(m.state!=j.RINGING&&m.state!=j.PROGRESS){return}var l=$iq({type:"set",to:m.remoteJid}).c("jingle",{xmlns:Strophe.NS.JINGLE,action:"session-accept",initiator:m.initiator,sid:m.id});this.connection.sendIQ(l,function(n){m.state=j.CONNECTED;Phono.events.trigger(m,"answer");if(m.ringer!=null){m.ringer.stop()}m.startAudio()})};f.prototype.bindAudio=function(l){this.input=l.input;this.output=l.output;this.volume(this.volume());this.gain(this.gain());this.mute(this.mute());this.hold(this.hold());this.headset(this.headset());this.pushToTalkStateChanged()};f.prototype.hangup=function(){var m=this;if(m.state!=j.CONNECTED&&m.state!=j.RINGING&&m.state!=j.PROGRESS){return}var l=$iq({type:"set",to:m.remoteJid}).c("jingle",{xmlns:Strophe.NS.JINGLE,action:"session-terminate",initiator:m.initiator,sid:m.id});this.connection.sendIQ(l,function(n){m.state=j.DISCONNECTED;Phono.events.trigger(m,"hangup");m.stopAudio();if(m.ringer!=null){m.ringer.stop()}if(m.ringback!=null){m.ringback.stop()}})};f.prototype.digit=function(l,m){if(!m){m=250}this.output.digit(l,m,this._tones)};f.prototype.pushToTalk=function(l){if(arguments.length===0){return this._pushToTalk}this._pushToTalk=l;this.pushToTalkStateChanged()};f.prototype.talking=function(l){if(arguments.length===0){return this._talking}this._talking=l;this.pushToTalkStateChanged()};f.prototype.mute=function(l){if(arguments.length===0){return this._mute}this._mute=l;if(this.output){this.output.mute(l)}};f.prototype.hold=function(l){};f.prototype.volume=function(l){if(arguments.length===0){return this._volume}this._volume=l;if(this.input){this.input.volume(l)}};f.prototype.tones=function(l){if(arguments.length===0){return this._tones}this._tones=l};f.prototype.gain=function(l){if(arguments.length===0){return this._gain}this._gain=l;if(this.output){this.output.gain(l)}};f.prototype.headset=function(l){if(arguments.length===0){return this._headset}this._headset=l;if(this.output){this.output.suppress(!l)}};f.prototype.pushToTalkStateChanged=function(){if(this.input&&this.output){if(this._pushToTalk){if(this._talking){this.input.volume(20);this.output.mute(false)}else{this.input.volume(this._volume);this.output.mute(true)}}else{this.input.volume(this._volume);this.output.mute(false)}}};f.prototype.negotiate=function(p){var m=this;var n=$(p).find("description");var o=null;n.find("payload-type").each(function(){var r=$(this).attr("name");var s=$(this).attr("clockrate");$.each(m.audioLayer.codecs(),function(){if(this.name==r&&this.rate==s){o=this;return false}})});if(!o){return false}var q=$(p).find("transport");var l=false;if(this.audioLayer.transport().name==q.attr("xmlns")){q.find("candidate").each(function(){var r=$(this).attr("rtmpUri")+"/"+$(this).attr("playName");m.bindAudio({input:m.audioLayer.play(r,false),output:m.audioLayer.share(r,false,o)});l=true;return false})}if(!l){return false}return true};function g(m,n,o){var l=this;this.phono=m;this.connection=m.connection;this.calls={};this.config=Phono.util.extend({ringTone:"http://s.phono.com/ringtones/Diggztone_Marimba.mp3",ringbackTone:"http://s.phono.com/ringtones/ringback-us.mp3",headset:false},n);Phono.util.each(this.config,function(q,p){if(typeof l[q]=="function"){l[q](p)}});Phono.events.bind(this,n);this.connection.addHandler(this.doJingle.bind(this),Strophe.NS.JINGLE,"iq","set");o(this)}g.prototype.doJingle=function(q){var l=this;var n=this.phono.audio;var p=$(q).find("jingle");var o=p.attr("action")||"";var r=p.attr("sid")||"";var m=this.calls[r]||null;switch(o){case"session-initiate":m=new f(l,r,h.INBOUND);m.phone=l;m.remoteJid=$(q).attr("from");m.initiator=p.attr("initiator");l.calls[m.id]=m;if(!m.negotiate(q)){Phono.log.warn("Failed to negotiate incoming call",q);return true}m.headers=new Array();p.find("custom-header").each(function(){m.headers.push({name:$(this).attr("name"),value:$(this).attr("data")})});if(m.ringer!=null){m.ringer.start()}m.state=j.PROGRESS;m.accept();Phono.events.trigger(this,"incomingCall",{call:m});break;case"session-accept":if(!m.negotiate(q)){Phono.log.warn("Failed to negotiate outbound call",q);return true}m.state=j.CONNECTED;if(m.ringback!=null){m.ringback.stop()}m.startAudio();Phono.events.trigger(m,"answer");break;case"session-terminate":m.state=j.DISCONNECTED;m.stopAudio();if(m.ringer!=null){m.ringer.stop()}if(m.ringback!=null){m.ringback.stop()}Phono.events.trigger(m,"hangup");break;case"session-info":if($(q).find("ringing")){m.state=j.RINGING;if(m.ringback!=null){m.ringback.start()}Phono.events.trigger(m,"ring")}break}this.connection.send($iq({type:"result",id:$(q).attr("id")}));return true};g.prototype.dial=function(o,l){var n=Phono.util.guid();l=Phono.util.extend({headset:this.headset()},(l||{}));var m=new f(this,n,h.OUTBOUND,l);m.phone=this;m.remoteJid=o;m.initiator=this.connection.jid;this.beforeDial(m);this.calls[m.id]=m;m.start();return m};g.prototype.beforeDial=function(l){var n=l.remoteJid;if(n.match("^sip:")||n.match("^sips:")){l.remoteJid=Phono.util.escapeXmppNode(n.substr(4))+"@sip"}else{if(n.match("^app:")){l.remoteJid=Phono.util.escapeXmppNode(n.substr(4))+"@app"}else{if(n.match("^tel:")){l.remoteJid="9991475834@app";l.headers.push({name:"x-numbertodial",value:n.substr(4)})}else{var m=n.replace(/[\(\)\-\.\ ]/g,"");if(m.match(/^\+?\d+$/)){l.remoteJid="9991475834@app";l.headers.push({name:"x-numbertodial",value:m})}else{if(n.indexOf("@")>0){l.remoteJid=Phono.util.escapeXmppNode(n)+"@sip"}}}}}};g.prototype.ringTone=function(l){if(arguments.length==0){return this._ringTone}this._ringTone=l};g.prototype.ringbackTone=function(l){if(arguments.length==0){return this._ringbackTone}this._ringbackTone=l};g.prototype.headset=function(l){if(arguments.length==0){return this._headset}this._headset=l;Phono.util.each(this.calls,function(){this.headset(l)})};Phono.registerPlugin("phone",{create:function(l,m,n){return new g(l,m,n)}})})();function a(f,h,g){this.index=0;this.readyHandler=g;this.config=h;this.phono=f;this.pluginNames=new Array();for(pluginName in Phono.plugins){this.pluginNames.push(pluginName)}}a.prototype.init=function(f,h,g){this.chain()};a.prototype.chain=function(){var f=this;var g=f.pluginNames[this.index];Phono.plugins[g].create(f.phono,f.config[g],function(h){f.phono[g]=h;f.index++;if(f.index===f.pluginNames.length){f.readyHandler.apply(f.phono)}else{f.chain()}})}})();(function(a){a.phono=function(b){return new Phono(b)}})(jQuery);
