var APE={Config:{identifier:'ape',init:true,frequency:0,scripts:[]},Client:function(core){if(core)this.core=core;}} APE.Client.prototype.eventProxy=[];APE.Client.prototype.fireEvent=function(type,args,delay){this.core.fireEvent(type,args,delay);} APE.Client.prototype.addEvent=function(type,fn,internal){var newFn=fn.bind(this),ret=this;if(this.core==undefined){this.eventProxy.push([type,fn,internal]);}else{var ret=this.core.addEvent(type,newFn,internal);this.core.$originalEvents[type]=this.core.$originalEvents[type]||[];this.core.$originalEvents[type][fn]=newFn;} return ret;} APE.Client.prototype.removeEvent=function(type,fn){return this.core.removeEvent(type,fn);} APE.Client.prototype.onRaw=function(type,fn,internal){this.addEvent('raw_'+type.toLowerCase(),fn,internal);} APE.Client.prototype.onCmd=function(type,fn,internal){this.addEvent('cmd_'+type.toLowerCase(),fn,internal);} APE.Client.prototype.onError=function(type,fn,internal){this.addEvent('error_'+type,fn,internal);} APE.Client.prototype.cookie={};APE.Client.prototype.cookie.write=function(name,value){document.cookie=name+"="+encodeURIComponent(value)+"; domain="+document.domain;} APE.Client.prototype.cookie.read=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i';} theHtml+='';doc.write(theHtml);doc.close();}else{iframe.setAttribute('src','http://'+config.frequency+'.'+config.server+'/?[{"cmd":"script","params":{"domain":"'+document.domain+'","scripts":["'+config.scripts.join('","')+'"]}}]');if(navigator.product=='Gecko'){iframe.contentWindow.location.href=iframe.getAttribute('src');}} iframe.onload=function(){if(!iframe.contentWindow.APE)setTimeout(iframe.onload,100);else iframe.contentWindow.APE.init(config);}} if(Function.prototype.bind==null){Function.prototype.bind=function(bind,args){return this.create({'bind':bind,'arguments':args});}} if(Function.prototype.create==null){Function.prototype.create=function(options){var self=this;options=options||{};return function(){var args=options.arguments||arguments;if(args&&!args.length){args=[args];} var returns=function(){return self.apply(options.bind||null,args);};return returns();};}} APE.Config.baseUrl = ''; APE.Config.domain = ''; APE.Config.server = ''; APE.Config.transport = 2; (function(){ for (var i = 0; i < arguments.length; i++) APE.Config.scripts.push(APE.Config.baseUrl + '/Source/' + arguments[i] + '.js'); })('mootools-core', 'Core/APE', 'Core/Events', 'Core/Core', 'Pipe/Pipe', 'Pipe/PipeProxy', 'Pipe/PipeMulti', 'Pipe/PipeSingle', 'Request/Request','Request/Request.Stack', 'Request/Request.CycledStack', 'Transport/Transport.longPolling','Transport/Transport.SSE', 'Transport/Transport.XHRStreaming', 'Transport/Transport.JSONP', 'Core/Utility', 'Core/JSON'); var apeServer = null; jqcc(document).ready(function () { var client = new APE.Client; client.load({ 'domain': APE.Config.domain, 'server': APE.Config.server, 'identifier': 'jquery', 'complete': function(ape){ apeServer = ape; ape.start({'name': String((new Date()).getTime()).replace(/\D/gi,'')}); cometready(); }, 'scripts': APE.Config.scripts }); }); function cometcall_function(id,td,callbackfn) { apeServer.join(id); apeServer.addEvent('onRaw', function(args) { if (args.raw == 'postmsg') { var incoming = args.data.message; incoming.message = unescape(incoming.message); if (callbackfn != '') { jqcc[callbackfn].newMessage(incoming); } var ts = Math.round(new Date().getTime() / 1000)+''+Math.floor(Math.random()*1000000) jqcc.cometchat.addMessage(incoming.from, incoming.message, incoming.self, 0, ts, 0, incoming.sent+td); } }); }