var calls=[],pendingResponseCount=0,shouldDebugAjax=false;function createXMLHttpRequest(){var a;return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):void 0}function onResponseStateChange(a){call=calls[a];xmlHttpRequest=call.xmlHttpRequest;if(xmlHttpRequest.readyState<4)return;if(xmlHttpRequest.readyState==4){callbackFunction=call.callbackFunction;if(!callbackFunction){eval("f = function() { onResponseStateChange("+a+"); }");setTimeout(f,100)}if(call.isPlainTextResponse)callbackFunction(xmlHttpRequest.responseText,call.callingContext);else callbackFunction(xmlHttpRequest.responseXML,call.callingContext)}call=null;delete calls[a];pendingResponseCount--}function createHTTPVarSpec(b){var a="";for(key in b){value=b[key];escapePlusRE=new RegExp("\\+");value=value.replace(escapePlusRE,"%2B");a+="&amp;"+key+"="+value}if(a.length<0)a=a.substring(1);return a}function loopBack(){}function setDefaults(a){var b="undefined";if(typeof a.callbackFunction!="function")a.callbackFunction=loopBack;if(typeof a.isPlainTextResponse==b)a.isPlainTextResponse=true;if(typeof a.shouldGET==b)a.shouldGET=true;if(typeof a.includeViewState==b)a.includeViewState=false;if(typeof a.callingContext==b)a.callingContext="";if(typeof a.vars==b)a.vars=null}function getCallServerParameterObject(c){var b=c.getAttribute("CallServerParameter"),a;eval("tmpObj = "+b.toString());setDefaults(a);return a}function callServer(a){var e="__VIEWSTATE",b="]\n";setDefaults(a);debugAlert("callServer() called. About to request URL\ncall key: ["+calls.length+b+"url: ["+a.url+b+"callback function: ["+a.callbackFunction+b+"returns plaintext?: ["+a.isPlainTextResponse+b+"use GET protocol?: ["+a.shouldGET+b+"calling context: ["+a.callingContext+b+"vars: ["+a.vars+"]");var c=createXMLHttpRequest();callKey=""+calls.length;a.xmlHttpRequest=c;calls[callKey]=a;eval("f = function() { onResponseStateChange("+callKey+"); }");c.onreadystatechange=f;c.open(a.shouldGET?"GET":"POST",a.url,true);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");var d="__EVENTTARGET="+a.controlID;if(a.includeViewState&&document.getElementById(e)!=null)d+="&__VIEWSTATE="+encodeURIComponent(document.getElementById(e).value);if(a.vars!=null)d+="&__EVENTARGUMENT="+a.vars;c.send(d)}function debugAlert(a){shouldDebugAjax&&alert(a)}
