
/********************************************************************************/
/*  Profound Logic Ajax Library Version 1.5.4                                   */
/*  Copyright (c) 1999-2010 Profound Logic Software, Inc.  All rights reserved. */
/*                                                                              */
/********************************************************************************/

 
 function RPGspRequest(I){this.method=null;this.postData=null;this.url=null;this.async=null;this.user=null;this.password=null;this.suppressAlert=null;this.onsuccess=null;this.onfail=null;this.onready=null;this.headers=null;this.params=null;var xmlhttpObj=null;var g=null;var k=null;var f=new Array();var l=null;var c=this;if(typeof(arguments[0])=="object"){var C=arguments[0];for(var i in C){if(typeof(this[i])!="undefined"){this[i]=C[i];}}}else{this.url=arguments[0];}if(window.XMLHttpRequest){xmlhttpObj=new XMLHttpRequest();}else if(window.ActiveXObject){xmlhttpObj=new ActiveXObject("Microsoft.XMLHTTP");}else{alert("Ajax request error: Unsupported browser.");return;}this.send=function(){var method=null;var async=null;var postData=null;if(c.method==null){method="GET";}else{if((typeof c.method!="string")&&(c.method.toUpperCase()!="GET"||c.method.toUpperCase()!="POST"||c.method.toUpperCase()!="PUT")){alert('Invalid value for property: "method".');return;}else{method=c.method.toUpperCase();}}if(method=="POST"){if(c.postData!=null){if(typeof c.postData!="string"){alert('Invalid value for property: "postData".');return;}else{postData=c.postData;}}}if(c.async==null){async=true;}else if(c.async!=true&&c.async!=false){alert('Invalid value for property: "async".');return;}else{async=c.async;}if(typeof c.url!="string"){alert('Invalid value for property: "url".');return;}if(c.user!=null){if(typeof c.user!="string"){alert('Invalid value for property: "user".');return;}}if(c.password!=null){if(typeof c.password!="string"){alert('Invalid value for property: "password".');return;}}if(c.onsuccess!=null){if(typeof c.onsuccess!="function"){alert('Invalid value for event: "onsuccess".');return;}}if(c.onfail!=null){if(typeof c.onfail!="function"){alert('Invalid value for event: "onfail".');return;}}if(c.onready!=null){if(typeof c.onready!="function"){alert('Invalid value for event: "onready".');return;}}var url=c.url;var params=c["params"];if(typeof(params)=="object"){var F="";for(var name in params){var J=params[name];var K=[];if(typeof J=="object"){if(J.length!=null&&J.length>0){K=J;}}else{K.push(J);}for(var i=0;i<K.length;i++){if(F!="")F+="&";F+=encodeURIComponent(name)+"="+encodeURIComponent(K[i]);}}if(F!=""){if(method.toUpperCase()=="POST"){if(postData!=null&&postData!="")postData+="&";else postData="";postData+=F;}else{var H=url.split("?");if(H.length==2&&H[1]!=""){url=H[0]+"?"+H[1]+"&"+F;}else{url+="?"+F;}}}}var headers=c["headers"];if(typeof(headers)=="object"){for(var name in headers){c.setRequestHeader(name,headers[name]);}}try{xmlhttpObj.open(method,url,async,c.user,c.password);var j;for(var i=0;i<f.length;i++){j=f[i].split("|");xmlhttpObj.setRequestHeader(j[0],j[1]);}if(method=="POST"){xmlhttpObj.setRequestHeader('Content-type','application/x-www-form-urlencoded');}}catch(e){alert(e);return;}l=true;if(async==true)xmlhttpObj.onreadystatechange=t;try{xmlhttpObj.sendAsBinary(postData);}catch(e){xmlhttpObj.send(postData);}if(async!=true)t();function t(){if(xmlhttpObj.readyState==4){g=String(xmlhttpObj.status+" - "+xmlhttpObj.statusText);if(c.onready!=null)c.onready(c);if(xmlhttpObj.status==200){k=true;if(c.onsuccess!=null)c.onsuccess(c);}else{k=false;if(c.suppressAlert!=true){alert(g);}if(c.onfail!=null)c.onfail(c);}l=false;}}};this.ok=function(){if(k!=null){return k;}else{return false;}};this.getResponseText=function(){return xmlhttpObj.responseText;};this.getResponseXML=function(){return xmlhttpObj.responseXML;};this.getStatus=function(){return xmlhttpObj.status;};this.getStatusText=function(){return xmlhttpObj.statusText;};this.getStatusMessage=function(){return g;};this.getAllResponseHeaders=function(){if(!k)return;try{return xmlhttpObj.getAllResponseHeaders();}catch(e){alert(e);}};this.getResponseHeader=function(o){if(!k)return;try{return xmlhttpObj.getResponseHeader(o);}catch(e){alert(e);}};this.setRequestHeader=function(m,n){f[f.length]=String(m+"|"+n);};this.abort=function(){if(l==null||l==true)return;try{xmlhttpObj.abort();}catch(e){alert(e);}}};function ajax(url,t){var r;var r;var async;var D;var responseText="";if(arguments.length==1&&typeof(arguments[0])=="object"){var C=arguments[0];C["async"]=null;C["onsuccess"]=null;C["onfail"]=null;C["onsuccess"]=null;if(typeof(C["handler"])=="function"){async=true;D=C["handler"];}else{async=false;}}else{if(t!=null&&typeof(t)=="function"){async=true;D=t;}else{async=false;}}var r=new RPGspRequest(arguments[0]);r.async=async;r.onsuccess=v;r.send();if(async==false){return responseText;}function v(r){responseText+=r.getResponseText();if(async==true){D(responseText);}}};function ajaxXML(url,t){var r;var r;var async;var D;var responseXML=null;if(arguments.length==1&&typeof(arguments[0])=="object"){var C=arguments[0];C["async"]=null;C["onsuccess"]=null;C["onfail"]=null;C["onsuccess"]=null;if(typeof(C["handler"])=="function"){async=true;D=C["handler"];}else{async=false;}}else{if(t!=null&&typeof(t)=="function"){async=true;D=t;}else{async=false;}}var r=new RPGspRequest(arguments[0]);r.async=async;r.onsuccess=v;r.send();if(async==false){return responseXML;}function v(r){responseXML=r.getResponseXML();if(async==true){D(responseXML);}}};function ajaxJSON(url,t){var r;var r;var async;var D;var G=null;if(arguments.length==1&&typeof(arguments[0])=="object"){var C=arguments[0];C["async"]=null;C["onsuccess"]=null;C["onfail"]=null;C["onsuccess"]=null;if(typeof(C["handler"])=="function"){async=true;D=C["handler"];}else{async=false;}}else{if(t!=null&&typeof(t)=="function"){async=true;D=t;}else{async=false;}}var r=new RPGspRequest(arguments[0]);r.async=async;r.onsuccess=v;r.send();if(async==false){return G;}function v(r){var responseText=r.getResponseText();try{G=eval("("+responseText+")");}catch(e){D(null,e);return;}if(async==true){D(G);}}};function ajaxSubmit(form,t){var w;var postData="";if(typeof(form)=="object"){w=form;}else{w=document.getElementById(form);if(w==null){w=document.forms[form];}}var tagName;if(w!=null)tagName=w.tagName;if(w==null||tagName==null||tagName.toUpperCase()!="FORM"){alert("Ajax request error: Invalid form object.");return "";}if(form.action==""){alert("Ajax request error: Invalid form action.");return "";}for(var i=0;i<w.elements.length;i++){var B=w.elements[i];if(B.name!=null&&B.name!=""){var go=false;if(B.tagName=="INPUT"){var A=B.type;A=A.toLowerCase();if(A=="hidden")go=true;if(A=="password")go=true;if(A=="text")go=true;if(A=="")go=true;if(A=="checkbox"||A=="radio"){if(B.checked)go=true;}}if(B.tagName=="TEXTAREA")go=true;if(B.tagName=="SELECT")go=true;if(go){if(postData!="")postData+="&";postData+=B.name+"="+encodeURIComponent(B.value)}}}var r=new RPGspRequest(w.action);r.method="POST";r.postData=postData;var responseText="";var async;if(t!=null&&typeof(t)=="function"){async=true;}else{async=false;r.async=false;}r.onsuccess=v;r.send();if(async==false){return responseText;}function v(r){responseText+=r.getResponseText();if(async==true){t(responseText);}}}