var msxmlNames=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];function XHRPool(){this.pool=[];this.maxSize=5;this.init=function(){for(var A=0;A<this.maxSize;A++){this.pool.push(this.makeNewXHR())}};this.makeNewXHR=function(){try{return new XMLHttpRequest()}catch(B){}for(var A=0;A<msxmlNames.length;A++){try{return new ActiveXObject(msxmlNames[A])}catch(B){}}};this.getXHR=function(){if(this.pool.length>0){return this.pool.pop()}else{return this.makeNewXHR()}};this.returnXHR=function(A){if(this.pool.length>=this.maxSize){delete A}else{this.pool.push(A)}}}var xhrPool=new XHRPool();xhrPool.init();function abort(){}function urlEncode(A){s=A;s=s.replace(/amp;/g,"*am*");s=s.replace(/&/g,"*am*");s=s.replace(/=/g,"*eq*");s=s.replace(/\+/g,"*pl*");s=s.replace(/\%/g,"*pg*");return s}function urlDecode(A){s=A;s=s.replace("*am*",/&/g);s=s.replace("*eq*",/=/g);s=s.replace("*pl*",/\+/g);s=s.replace("*pl*",/\+/g);s=s.replace("&lt;","<");s=s.replace("&gt;",">");return s}var ERROR_AJAX_DISCONNECTION_MSG="Experiencing problems connecting to the Postalz Server,please retry the last action(if any).";var ERROR_AJAX_SERVER_UNAVAILABLE_MSG="Could not connect to the Postalz Server, please reload the page";var ERROR_AJAX_SERVER_ERROR_MSG="The server encountered an unexpected error ... we have recorded this error and shall fix this soon.Please try viewing another card.";var ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG="Oops we could not load this data from the server ... we have recorded this error and shall fix this soon.Please try viewing another card.";var ERROR_AJAX_UNKNOWN_ERROR_MSG="The server encountered an unexpected error ... we have recorded this error and shall fix this soon.Please try viewing another card.";var DEBUG_ERROR_AJAX_DISCONNECTION_MSG="Internet Connection issues , slow connection or packet drops";var DEBUG_ERROR_AJAX_SERVER_UNAVAILABLE_MSG="Server closed connection - check for server outage";var DEBUG_ERROR_AJAX_SERVER_ERROR_MSG="Exception in JSP code";var DEBUG_ERROR_AJAX_UNKNOWN_ERROR_MSG="Unknown status code ";var DEBUG_ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG="Page not found";function noPostAjaxCallBack(){}function clearAjaxResponse(){ajaxResponse=""}function log(A){if(A.indexOf("logAjax.jsp")<-1){postData("/jsp/zimo/logAjax.jsp","logMsg="+A,null,true)}}function ajaxErrors(C){connected="false";if(Dialog!=null){var A="err "+new Date().getTime();var B=Dialog.info(C,{className:"alphacube",showProgress:false,width:500,height:100,id:A});setTimeout(function(){closeAjaxInfo(A)},3000)}else{alert(C);closeAjaxInfo()}}function closeAjaxInfo(A){Windows.close(A);cleanup()}function fetchData(B,H,D){try{var F=function(){};var I=xhrPool.getXHR();if(H==null){F=noPostAjaxCallBack}else{F=H}if(D==null){D=true}D=true;if(I!=null){var E=new Date();var C=E.getTime();var G="&nocache="+C;if((B.indexOf("?"))==-1){G="?nocache="+C+"&user=guest"}I.open("GET",B+G,D);if(I.overrideMimeType){I.overrideMimeType("text/plain; charset=ISO-8859-1")}I.onreadystatechange=function(){if(I.readyState==4){var J=0;try{J=I.status}catch(L){log(B+" - "+L)}if(J==200){var K=I.responseText;if(K.indexOf("Exception Information")>-1){ajaxErrors(ERROR_AJAX_SERVER_ERROR_MSG);if(B.indexOf("logAjax.jsp")<0){log(B+" - "+DEBUG_ERROR_AJAX_SERVER_ERROR_MSG+" - "+K.trim())}}else{connected="true";F(K);xhrPool.returnXHR(I)}}else{if(J==404){ajaxErrors(ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG);log(B+" - "+DEBUG_ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG+" - "+I.responseText)}else{if((J==12030)||(J==12031)||(J==12029)){ajaxErrors(ERROR_AJAX_DISCONNECTION_MSG)}else{if(J==12152){ajaxErrors(ERROR_AJAX_SERVER_UNAVAILABLE_MSG);log(B+" - "+DrrEBUG_ERROR_AJAX_SERVER_UNAVAILABLE_MSG+" - "+I.responseText)}else{connected="false";log(B+" - "+DEBUG_ERROR_AJAX_UNKNOWN_ERROR_MSG+", status = "+J+" - "+I.responseText)}}}}}};I.send(null)}else{log(B+" - "+"httpr is null in fetchData")}}catch(A){log("fetchData  -"+B+" - "+A)}}function postData(B,F,I,D){try{var G=function(){};var J=xhrPool.getXHR();if(I==null){G=noPostAjaxCallBack}else{G=I}if(D==null){D=true}D=true;if(J!=null){var E=new Date();var C=E.getTime();var H="&nocache="+C;if((B.indexOf("?"))==-1){H="?nocache="+C+"&user=guest"}J.open("POST",B+H,D);if(J.overrideMimeType){J.overrideMimeType("text/plain; charset=ISO-8859-1")}J.onreadystatechange=function(){if(J.readyState==4){var K=0;try{K=J.status}catch(M){log(B+" - "+M)}if(K==200){var L=J.responseText;if(L.indexOf("Exception Information")>-1){ajaxErrors(ERROR_AJAX_SERVER_ERROR_MSG);if(B.indexOf("logAjax.jsp")<0){log(B+" - "+DEBUG_ERROR_AJAX_SERVER_ERROR_MSG+" - "+L.trim())}}else{connected="true";G(L);xhrPool.returnXHR(J)}}else{if(K==404){ajaxErrors(ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG);log(B+" - "+DEBUG_ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG+" - "+J.responseText)}else{if((K==12030)||(K==12031)||(K==12029)){ajaxErrors(ERROR_AJAX_DISCONNECTION_MSG)}else{if(K==12152){ajaxErrors(ERROR_AJAX_SERVER_UNAVAILABLE_MSG);log(B+" - "+DEBUG_ERROR_AJAX_SERVER_UNAVAILABLE_MSG+" - "+J.responseText)}else{connected="false";log(B+" - "+DEBUG_ERROR_AJAX_UNKNOWN_ERROR_MSG+", status = "+K+" - "+J.responseText)}}}}}};J.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");J.setRequestHeader("Content-length",F.length);J.setRequestHeader("Connection","close");J.send(F)}else{log(B+" - "+"httpr is null in fetchData")}}catch(A){alert("postData  -"+B+" - "+A)}}var cacheRegistryKeys=new Array();var cacheRegistryValues=new Array();function dataInCache(B){var A=cacheRegistryKeys.length;var D=false;for(var C=0;C<A;C=C+1){if(cacheRegistryKeys[C]==B){D=true;break}}if(D){return(cacheRegistryValues[C])}else{return null}}function fetchDataCached(F,B,C){try{var A=function(){};if(B==null){A=noPostAjaxCallBack}else{A=B}if(C==null){C=true}C=true;var E=xhrPool.getXHR();if(E!=null){E.open("GET",F,C);if(E.overrideMimeType){E.overrideMimeType("text/plain; charset=ISO-8859-1")}E.onreadystatechange=function(){if(E.readyState==4){var G=0;try{G=E.status}catch(I){log(F+" - "+I)}if(G==200){var H=E.responseText;if(H.indexOf("Exception Information")>-1){ajaxErrors(ERROR_AJAX_SERVER_ERROR_MSG);if(F.indexOf("logAjax.jsp")<0){log(F+" - "+DEBUG_ERROR_AJAX_SERVER_ERROR_MSG+" - "+H.trim())}}else{connected="true";cacheRegistryKeys.push(F);cacheRegistryValues.push(H);A(H);xhrPool.returnXHR(E)}}else{if(G==404){ajaxErrors(ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG);log(F+" - "+DEBUG_ERROR_AJAX_DATA_NOT_FOUND_ERROR_MSG+" - "+E.responseText)}else{if((G==12030)||(G==12031)||(G==12029)){ajaxErrors(ERROR_AJAX_DISCONNECTION_MSG)}else{if(G==12152){ajaxErrors(ERROR_AJAX_SERVER_UNAVAILABLE_MSG);log(F+" - "+DEBUG_ERROR_AJAX_SERVER_UNAVAILABLE_MSG+" - "+E.responseText)}else{connected="false";log(F+" - "+DEBUG_ERROR_AJAX_UNKNOWN_ERROR_MSG+", status = "+G+" - "+E.responseText)}}}}}};E.send(null)}else{log(F+" - "+"httpr is null in fetchData")}}catch(D){alert("fetchDataCached -"+F+" - "+D)}}