if(!saw.delivers){saw.delivers=function(){}}if(!saw.delivers.resourceFile){saw.delivers.resourceFile="delivers/obide.Delivers.xml"}obids.AjaxRequest=function(c,a,d,b){this.callback=a;this.errorCallback=d;this.ajaxRequest=new saw.ajax.Request(c,this._responseHandler,this,b);this.ajaxRequest.setFatalErrorHandler(this._errorHandler);this.bShowErrors=true;this.responseType=saw.ajax.ResponseBlock.TYPE_XML};obids.AjaxRequest.prototype.setResponseType=function(a){this.responseType=a};obids.AjaxRequest.prototype.getRequest=function(){return this.ajaxRequest};obids.AjaxRequest.prototype.post=function(){var b=saw.ajax.createConnection(this.ajaxRequest);b.setSync(this.callback?false:true);var a=b.post();if(!this.callback){return this._checkForErrors(a)}return null};obids.AjaxRequest.prototype._responseHandler=function(b,a){var c=this._checkForErrors(b);if(c){this.callback.functionPointer.call(this.callback.thisContext,c,a)}else{if(this.errorCallback){this.errorCallback.functionPointer.call(this.errorCallback.thisContext,b)}}};obids.AjaxRequest.prototype._errorHandler=function(c,b,a){if(this.bShowErrors){var f=[];for(var d=0;d<b.length;d++){var e=b[d].getMessage();f.push([e])}this._showErrors(f)}if(this.errorCallback){this.errorCallback.functionPointer.call(this.errorCallback.thisContext,c)}};obids.AjaxRequest.prototype._checkForErrors=function(c){var i=[];var f=null;if(!this.callback){if(c.errors&&c.errors.length>0){i=c.errors}}else{i=c.getErrors()}if(i.length==0){var e=(!this.callback?c.response:c);switch(this.responseType){case saw.ajax.ResponseBlock.TYPE_HTML:f=e.getHTML();break;case saw.ajax.ResponseBlock.TYPE_XML:f=e.getXML();break;case saw.ajax.ResponseBlock.TYPE_TEXT:f=e.getText();break;case saw.ajax.ResponseBlock.TYPE_JSON:f=e.getJSON();break;case saw.ajax.ResponseBlock.TYPE_SCRIPT:f=e.getScript();break}if(f&&this.responseType==saw.ajax.ResponseBlock.TYPE_XML){var k=obips.XMLDOM.selectSingleNode(f,"//soap:Fault",saw.delivers.namespaceMap);if(k){var h=obips.XMLDOM.selectSingleNode(k,"faultcode").firstChild.nodeValue;var a=obips.XMLDOM.selectSingleNode(k,"faultstring").firstChild.nodeValue;var g=obips.ResourceManager.getSingleton();var j=g.getResource(saw.delivers.resourceFile,"kmsgDeliversFaultError").getString();j=j.replace("(%1)",h);j=j.replace("(%2)",a)}else{var k=obips.XMLDOM.selectSingleNode(f,"//soap1.2:Fault",saw.delivers.namespaceMap);if(k){var l=obips.XMLDOM.selectSingleNode(k,"soap1.2:Reason/soap1.2:Text",saw.delivers.namespaceMap).firstChild.nodeValue;var g=obips.ResourceManager.getSingleton();var j=g.getResource(saw.delivers.resourceFile,"kmsgDeliversFaultError").getString();j=j.replace("(%1)","");j=j.replace("(%2)",l)}}if(j){var d=j.split("\\n");for(var b=0;b<d.length;b++){i.push([d[b]])}}}}if(i.length>0){this._showErrors(i);f=null}return f};obids.AjaxRequest.prototype._showErrors=function(a){saw.ondemandload.loadScripts({messageTemplate:"kuiDeliversAjaxRequestError"},null,this._showErrorsResLoaded,this,a)};obids.AjaxRequest.prototype._showErrorsResLoaded=function(g){var f=obips.ResourceManager.getSingleton();var h=obips.FloatingWindow.Manager.getSingleton();var a=f.getResource(saw.delivers.resourceFile,"kmsgDeliversServerError").getString();var d=new obips.ExceptionDialog.SimpleModel(a);for(var e=0;e<g.length;e++){for(var c=0;c<g[e].length;c++){d.aErrMsgs.push((g[e][c].message?g[e][c].message:g[e][c]))}}var b=new obips.ExceptionDialog.Viewer(d,h);document.body.style.cursor="default"};