CBSi.namespace("io.Connect");(function(){var a=0;function d(h,g,f){if(h=="forceJSI"){return"JS"}else{if(h=="forceGET"){return"GET"}else{if(h=="forcePOST"){return"POST"}else{if(h=="JSI"||h=="YGet"||h=="JS"||!YAHOO||!YAHOO.util.Connect){return(YAHOO&&YAHOO.util.Get)?"YGet":"JS"}else{if(h==""){h="GET"}var e="^http://"+location.host;if(g.match(/^\/.+/)&&f&&!f.match(e)){return(YAHOO.util.Get?"YGet":"JS")}else{if(g.match(/^\/.+/)||g.match(e)){return h}}return(YAHOO.util.Get?"YGet":"JS")}}}}}function c(g,f,e){if(g=="YGet"||g=="JS"){if(!f.match(/^http:\/\/.+/i)&&typeof(e)!="undefined"&&e!=""){return(e+f)}}return f}CBSi.io.Connect={request:function(i,g,h,e,f){i=d(i,g,f);g=c(i,g,f);if(i=="JS"){return this.jsRequest(g,h,e)}else{if(i=="YGet"){return this.YGetRequest(g,h,e)}else{return this.asyncRequest(i,g,h,e)}}},YGetRequest:function(i,k,e){var f=k.JSInjectionID||"CBSi_io"+a++;var g=k.timeout||60000;var h="cb"+f;this[h]=new b;this[h].setID(f);this[h].setCallback(k);this[h].setURL(i,e,"CBSi.io.Connect."+h);var j=YAHOO.util.Get.script(this[h].url,{onSuccess:this[h].YGetSuccess,onFailure:this[h].callback.failure,scope:this[h]});current=j.tId;this[h].YTIDs={};this[h].YTIDs[current]=true;this[h].setTimeout("CBSi.io.Connect."+h+".timeout()",g)},jsRequest:function(i,j,e){var f=j.JSInjectionID||"CBSi_io"+a++;var g=j.timeout||60000;var h="cb"+f;this[h]=new b;this[h].setID(f);this[h].setCallback(j);this[h].setURL(i,e,"CBSi.io.Connect."+h);this[h].injectJS();this[h].setTimeout("CBSi.io.Connect."+h+".timeout()",g)}};function b(){var f;var j;var e;var i;var h;var g;var k}b.prototype.setID=function(e){this.JSInjectionID=e};b.prototype.setYTID=function(e){this.YTID=e};b.prototype.setCallback=function(e){this.Callback=e};b.prototype.setTimeout=function(f,e){this.timeoutCounter=setTimeout(f,e)};b.prototype.setURL=function(f,e,g){if(!f.match(/.+?.*callback\=/)){f+=(f.match(/.+\?.+/)?"&":"?")+"callback="+g+".callback"}if(typeof(e)!="undefined"&&e!=""){f+="&"+e}this.url=f};b.prototype.callback=function(f){var e={responseText:unescape(f)};this.done();this.Callback.success(e)};b.prototype.done=function(){if(this.timeoutCounter){clearTimeout(this.timeoutCounter)}if(this.Script){var e=document.getElementsByTagName("head")[0];e.removeChild(this.Script);delete this.Script}};b.prototype.timeout=function(){this.done();this.Callback.failure("timeout")};b.prototype.YGetSuccess=function(e){this.done();if(!e.tId in this.YTIDs){this.Callback.failure("YGet failed")}};b.prototype.injectJS=function(){var e=document.getElementsByTagName("head")[0];if(this.Script){e.removeChild(this.Script)}this.Script=document.createElement("script");this.Script.id="S_"+this.JSInjectionID;this.Script.type="text/javascript";this.Script.src=this.url;e.appendChild(this.Script)};if(YAHOO){if(YAHOO.util.Connect){YAHOO.lang.augmentObject(CBSi.io.Connect,YAHOO.util.Connect)}}})();