if(typeof dojo=="undefined"){(function(){if((!this["console"])||(!console["firebug"])){this.console={}}if(!console["debug"]){console["debug"]=function(){}}if(typeof this["dojo"]=="undefined"){this.dojo={}}var _d=dojo;dojo.global=this;dojo._unloaders=[];dojo.unloaded=function(){var mll=this._unloaders;while(mll.length){(mll.pop())()}};dojo.addOnUnload=function(obj,functionName){if(arguments.length==1){_d._unloaders.push(obj)}else{if(arguments.length>1){_d._unloaders.push(function(){obj[functionName]()})}}};dojo._blockAsync=false;dojo._contentHandlers={"text":function(xhr){return xhr.responseText},"json":function(xhr){return Wtf.decode(xhr.responseText)},"json-comment-filtered":function(xhr){var value=xhr.responseText;var cStartIdx=value.indexOf("/*");var cEndIdx=value.lastIndexOf("*/");if(cStartIdx==-1||cEndIdx==-1){throw new Error("JSON was not comment filtered")}return Wtf.decode(value.substring(cStartIdx+2,cEndIdx))},"javascript":function(xhr){if(_d.global.eval){return _d.global.eval(xhr.responseText)}else{return eval(xhr.responseText)}},"xml":function(xhr){if(Wtf.isIE&&!xhr.responseXML){Wtf.each(["MSXML2","Microsoft","MSXML","MSXML3"],function(i){try{var doc=new ActiveXObject(prefixes[i]+".XMLDOM");doc.async=false;doc.loadXML(xhr.responseText);return doc}catch(e){}})}else{return xhr.responseXML}}};dojo._contentHandlers["json-comment-optional"]=function(xhr){var handlers=_d._contentHandlers;try{return handlers["json-comment-filtered"](xhr)}catch(e){return handlers["json"](xhr)}};dojo._ioSetArgs=function(args,canceller,okHandler,errHandler){var ioArgs={args:args,url:args.url};var miArgs=[{}];if(args.content){miArgs.push(args.content)}if(args.preventCache){miArgs.push({"dojo.preventCache":new Date().valueOf()})}ioArgs.query=Wtf.urlEncode(Wtf.apply.apply(null,miArgs));ioArgs.handleAs=args.handleAs||"text";var d=new _d.Deferred(canceller);d.addCallbacks(okHandler,function(error){return errHandler(error,d)});var ld=args.load;if(ld&&_d.isFunction(ld)){d.addCallback(function(value){return ld.call(args,value,ioArgs)})}var err=args.error;if(err&&_d.isFunction(err)){d.addErrback(function(value){return err.call(args,value,ioArgs)})}var handle=args.handle;if(handle&&_d.isFunction(handle)){d.addBoth(function(value){return handle.call(args,value,ioArgs)})}d.ioArgs=ioArgs;return d};var _deferredCancel=function(dfd){dfd.canceled=true;var xhr=dfd.ioArgs.xhr;var _at=(typeof xhr.abort);if(_at=="function"||_at=="object"||_at=="unknown"){xhr.abort()}var err=new Error("xhr cancelled");err.dojoType="cancel";return err};var _deferredOk=function(dfd){return _d._contentHandlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr)};var _deferError=function(error,dfd){console.debug(error);return error};var _makeXhrDeferred=function(args){var dfd=_d._ioSetArgs(args,_deferredCancel,_deferredOk,_deferError);dfd.ioArgs.xhr=_d._xhrObj(dfd.ioArgs.args);return dfd};var _inFlightIntvl=null;var _inFlight=[];var _watchInFlight=function(){var now=(new Date()).getTime();if(!_d._blockAsync){for(var i=0,tif;(i<_inFlight.length)&&(tif=_inFlight[i]);i++){var dfd=tif.dfd;try{if(!dfd||dfd.canceled||!tif.validCheck(dfd)){_inFlight.splice(i--,1)}else{if(tif.ioCheck(dfd)){_inFlight.splice(i--,1);tif.resHandle(dfd)}else{if(dfd.startTime){if(dfd.startTime+(dfd.ioArgs.args.timeout||0)<now){_inFlight.splice(i--,1);var err=new Error("timeout exceeded");err.dojoType="timeout";dfd.errback(err);dfd.cancel()}}}}}catch(e){console.debug(e);dfd.errback(new Error("_watchInFlightError!"))}}}if(!_inFlight.length){clearInterval(_inFlightIntvl);_inFlightIntvl=null;return }};dojo._ioCancelAll=function(){try{Wtf.each(_inFlight,function(i){i.dfd.cancel()})}catch(e){}};if(Wtf.isIE){_d.addOnUnload(_d._ioCancelAll)}_d._ioWatch=function(dfd,validCheck,ioCheck,resHandle){if(dfd.ioArgs.args.timeout){dfd.startTime=(new Date()).getTime()}_inFlight.push({dfd:dfd,validCheck:validCheck,ioCheck:ioCheck,resHandle:resHandle});if(!_inFlightIntvl){_inFlightIntvl=setInterval(_watchInFlight,50)}_watchInFlight()};var _defaultContentType="application/x-www-form-urlencoded";var _validCheck=function(dfd){return dfd.ioArgs.xhr.readyState};var _ioCheck=function(dfd){return 4==dfd.ioArgs.xhr.readyState};var _resHandle=function(dfd){if(_d._isDocumentOk(dfd.ioArgs.xhr)){dfd.callback(dfd)}else{dfd.errback(new Error("bad http response code:"+dfd.ioArgs.xhr.status))}};var _doIt=function(type,dfd){var ioArgs=dfd.ioArgs;var args=ioArgs.args;ioArgs.xhr.open(type,ioArgs.url,args.sync!==true,args.user||undefined,args.password||undefined);if(args.headers){for(var hdr in args.headers){if(hdr.toLowerCase()==="content-type"&&!args.contentType){args.contentType=args.headers[hdr]}else{ioArgs.xhr.setRequestHeader(hdr,args.headers[hdr])}}}ioArgs.xhr.setRequestHeader("Content-Type",(args.contentType||_defaultContentType));try{ioArgs.xhr.send(ioArgs.query)}catch(e){dfd.cancel()}_d._ioWatch(dfd,_validCheck,_ioCheck,_resHandle);return dfd};dojo._ioAddQueryToUrl=function(ioArgs){if(ioArgs.query.length){ioArgs.url+=(ioArgs.url.indexOf("?")==-1?"?":"&")+ioArgs.query;ioArgs.query=null}};dojo.xhrGet=function(args){var dfd=_makeXhrDeferred(args);_d._ioAddQueryToUrl(dfd.ioArgs);return _doIt("GET",dfd)};dojo.xhrPost=function(args){return _doIt("POST",_makeXhrDeferred(args))}})();if(typeof window!="undefined"){(function(){var A=dojo;if(Wtf.isIE){if(window.location.protocol==="file:"){Wtf.ieForceActiveXXhr=true}var B=true;Wtf.EventManager.on(window,"beforeunload",function(){window.setTimeout(function(){B=false},0)});Wtf.EventManager.on(window,"unload",function(){if(B){dojo.unloaded()}})}else{Wtf.EventManager.on(window,"beforeunload",function(){dojo.unloaded()})}A._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];A._xhrObj=function(){var D=null;var G=null;if(!Wtf.isIE||!Wtf.ieForceActiveXXhr){try{D=new XMLHttpRequest()}catch(F){}}if(!D){for(var E=0;E<3;++E){var C=dojo._XMLHTTP_PROGIDS[E];try{D=new ActiveXObject(C)}catch(F){G=F}if(D){dojo._XMLHTTP_PROGIDS=[C];break}}}if(!D){throw new Error("XMLHTTP not available: "+G)}return D};A._isDocumentOk=function(C){var D=C.status||0;return((D>=200)&&(D<300))||(D==304)||(D==1223)||(!D&&(location.protocol=="file:"||location.protocol=="chrome:"))}})();dojo.doc=window["document"]||null}}dojo.isString=function(A){return(Wtf.type(A)=="string")};dojo.isArray=function(A){return(Wtf.type(A)=="array")};dojo.isFunction=function(A){return(Wtf.type(A)=="function")};dojo._hitchArgs=function(B,D){var C=dojo._toArray(arguments,2);var A=dojo.isString(D);return function(){var E=dojo._toArray(arguments);var F=A?(B||dojo.global)[D]:D;return F&&F.apply(B||this,C.concat(E))}};dojo.hitch=function(A,B){if(arguments.length>2){return dojo._hitchArgs.apply(dojo,arguments)}if(!B){B=A;A=null}if(dojo.isString(B)){A=A||dojo.global;if(!A[B]){throw (['dojo.hitch: scope["',B,'"] is null (scope="',A,'")'].join(""))}return function(){return A[B].apply(A,arguments||[])}}return !A?B:function(){return B.apply(A,arguments||[])}};dojo._toArray=function(C,D){var B=[];for(var A=D||0;A<C.length;A++){B.push(C[A])}return B};dojo._listener={getDispatcher:function(){return function(){var D=Array.prototype,F=arguments.callee,A=F._listeners,C=F.target;var E=C&&C.apply(this,arguments);for(var B in A){if(!(B in D)){A[B].apply(this,arguments)}}return E}},add:function(A,D,C){A=A||dojo.global;var B=A[D];if(!B||!B._listeners){var E=dojo._listener.getDispatcher();E.target=B;E._listeners=[];B=A[D]=E}return B._listeners.push(C)},remove:function(B,D,A){var C=(B||dojo.global)[D];if(C&&C._listeners&&A--){delete C._listeners[A]}}};dojo._topics={};dojo.subscribe=function(A,B,C){return[A,dojo._listener.add(dojo._topics,A,dojo.hitch(B,C))]};dojo.unsubscribe=function(A){if(A){dojo._listener.remove(dojo._topics,A[0],A[1])}};dojo.publish=function(B,A){var C=dojo._topics[B];if(C){C.apply(this,A||[])}};dojo.AdapterRegistry=function(A){this.pairs=[];this.returnWrappers=A||false};dojo.AdapterRegistry.prototype={register:function(C,B,E,A,D){this.pairs[((D)?"unshift":"push")]([C,B,E,A])},match:function(){for(var A=0;A<this.pairs.length;A++){var B=this.pairs[A];if(B[1].apply(this,arguments)){if((B[3])||(this.returnWrappers)){return B[2]}else{return B[2].apply(this,arguments)}}}throw new Error("No match found")},unregister:function(A){for(var B=0;B<this.pairs.length;B++){var C=this.pairs[B];if(C[0]==A){this.pairs.splice(B,1);return true}}return false}};dojo.script={get:function(B){var A=this._makeScriptDeferred(B);var C=A.ioArgs;dojo._ioAddQueryToUrl(C);this.attach(C.id,C.url);dojo._ioWatch(A,this._validCheck,this._ioCheck,this._resHandle);return A},attach:function(C,B){var A=dojo.doc.createElement("script");A.type="text/javascript";A.src=B;A.id=C;dojo.doc.getElementsByTagName("head")[0].appendChild(A)},remove:function(A){Wtf.destroy(Wtf.get(A));if(this["jsonp_"+A]){delete this["jsonp_"+A]}},_makeScriptDeferred:function(B){var A=dojo._ioSetArgs(B,this._deferredCancel,this._deferredOk,this._deferredError);var C=A.ioArgs;C.id="dojoIoScript"+(this._counter++);C.canDelete=false;if(B.callbackParamName){C.query=C.query||"";if(C.query.length>0){C.query+="&"}C.query+=B.callbackParamName+"=dojo.script.jsonp_"+C.id+"._jsonpCallback";C.canDelete=true;A._jsonpCallback=this._jsonpCallback;this["jsonp_"+C.id]=A}return A},_deferredCancel:function(A){A.canceled=true;if(A.ioArgs.canDelete){dojo.script._deadScripts.push(A.ioArgs.id)}},_deferredOk:function(A){if(A.ioArgs.canDelete){dojo.script._deadScripts.push(A.ioArgs.id)}if(A.ioArgs.json){return A.ioArgs.json}else{return A.ioArgs}},_deferredError:function(B,A){if(A.ioArgs.canDelete){if(B.dojoType=="timeout"){dojo.script.remove(A.ioArgs.id)}else{dojo.script._deadScripts.push(A.ioArgs.id)}}console.debug("dojo.script error",B);return B},_deadScripts:[],_counter:1,_validCheck:function(B){var A=dojo.script;var C=A._deadScripts;if(C&&C.length>0){for(var D=0;D<C.length;D++){A.remove(C[D])}dojo.script._deadScripts=[]}return true},_ioCheck:function(dfd){if(dfd.ioArgs.json){return true}var checkString=dfd.ioArgs.args.checkString;if(checkString&&eval("typeof("+checkString+") != 'undefined'")){return true}return false},_resHandle:function(A){if(dojo.script._ioCheck(A)){A.callback(A)}else{A.errback(new Error("inconceivable dojo.script._resHandle error"))}},_jsonpCallback:function(A){this.ioArgs.json=A}};dojo.Deferred=function(A){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=A;this.silentlyCancelled=false};dojo.Deferred.prototype={_nextId:(function(){var A=1;return function(){return A++}})(),cancel:function(){var B;if(this.fired==-1){if(this.canceller){B=this.canceller(this)}else{this.silentlyCancelled=true}if(this.fired==-1){if(!(B instanceof Error)){var A=B;B=new Error("Deferred Cancelled");B.dojoType="cancel";B.cancelResult=A}this.errback(B)}}else{if((this.fired==0)&&(this.results[0] instanceof dojo.Deferred)){this.results[0].cancel()}}},_resback:function(A){this.fired=((A instanceof Error)?1:0);this.results[this.fired]=A;this._fire()},_check:function(){if(this.fired!=-1){if(!this.silentlyCancelled){throw new Error("already called!")}this.silentlyCancelled=false;return }},callback:function(A){this._check();this._resback(A)},errback:function(A){this._check();if(!(A instanceof Error)){A=new Error(A)}this._resback(A)},addBoth:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(C,C)},addCallback:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(C,null)},addErrback:function(A,B){var C=dojo.hitch(A,B);if(arguments.length>2){C=dojo.partial(C,arguments,2)}return this.addCallbacks(null,C)},addCallbacks:function(A,B){this.chain.push([A,B]);if(this.fired>=0){this._fire()}return this},_fire:function(){var D=this.chain;var G=this.fired;var C=this.results[G];var B=this;var A=null;while((D.length>0)&&(this.paused==0)){var F=D.shift()[G];if(!F){continue}try{C=F(C);G=((C instanceof Error)?1:0);if(C instanceof dojo.Deferred){A=function(H){B._resback(H);B.paused--;if((B.paused==0)&&(B.fired>=0)){B._fire()}};this.paused++}}catch(E){console.debug(E);G=1;C=E}}this.fired=G;this.results[G]=C;if((A)&&(this.paused)){C.addBoth(A)}}}