/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.cometd.callbackPollTransport"],["require","dojox.cometd._base"],["require","dojox.cometd.longPollTransport"],["require","dojo.io.script"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.cometd.callbackPollTransport"]){_4._hasResource["dojox.cometd.callbackPollTransport"]=true;_4.provide("dojox.cometd.callbackPollTransport");_4.require("dojox.cometd._base");_4.require("dojox.cometd.longPollTransport");_4.require("dojo.io.script");_6.cometd.callbackPollTransport=new function(){this._connectionType="callback-polling";this._cometd=null;this.check=function(_7,_8,_9){return (_4.indexOf(_7,"callback-polling")>=0);};this.tunnelInit=function(){var _a={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};_a=this._cometd._extendOut(_a);this.openTunnelWith([_a]);};this.tunnelCollapse=_6.cometd.longPollTransport.tunnelCollapse;this._connect=_6.cometd.longPollTransport._connect;this.deliver=_6.cometd.longPollTransport.deliver;this.openTunnelWith=function(_b,_c){this._cometd._polling=true;var _d={load:_4.hitch(this,function(_e){this._cometd._polling=false;this._cometd.deliver(_e);this._cometd._backon();this.tunnelCollapse();}),error:_4.hitch(this,function(_f){this._cometd._polling=false;this._cometd._publishMeta("connect",false);this._cometd._backoff();this.tunnelCollapse();}),url:(_c||this._cometd.url),content:{message:_4.toJson(_b)},callbackParamName:"jsonp"};var _10=this._cometd._connectTimeout();if(_10>0){_d.timeout=_10;}_4.io.script.get(_d);};this.sendMessages=function(_11){for(var i=0;i<_11.length;i++){_11[i].clientId=this._cometd.clientId;_11[i].id=""+this._cometd.messageId++;_11[i]=this._cometd._extendOut(_11[i]);}var _12={url:this._cometd.url||_4.config["cometdRoot"],load:_4.hitch(this._cometd,"deliver"),callbackParamName:"jsonp",content:{message:_4.toJson(_11)},error:_4.hitch(this,function(err){this._cometd._publishMeta("publish",false,{messages:_11});}),timeout:this._cometd.expectedNetworkDelay};return _4.io.script.get(_12);};this.startup=function(_13){if(this._cometd._connected){return;}this.tunnelInit();};this.disconnect=_6.cometd.longPollTransport.disconnect;this.disconnect=function(){var _14={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_14=this._cometd._extendOut(_14);_4.io.script.get({url:this._cometd.url||_4.config["cometdRoot"],callbackParamName:"jsonp",content:{message:_4.toJson([_14])}});};this.cancelConnect=function(){};};_6.cometd.connectionTypes.register("callback-polling",_6.cometd.callbackPollTransport.check,_6.cometd.callbackPollTransport);}}};});