
var PRAjaxUtil=new(function(){this.EventCache=new(function(){this.eventCache=new Array();this.eventCounter=0;this.getLatestCachedEvent=function(){var _this=this;return _this.eventCache[_this.eventCache.length-1];}
this.findCachedEvent=function(pElement,pEventType,pFunction,pUseCapture){var _this=this;var iId=_this.findCachedEventId(pElement,pEventType,pFunction,pUseCapture);if(iId>=0){return _this.eventCache[iId];}else{return null;}}
this.findCachedEventId=function(pElement,pEventType,pFunction,pUseCapture){var _this=this;for(var i=_this.eventCache.length-1;i>=0;i--){if(_this.eventCache[i][0].getAttribute('PRAjaxEventCounter')==pElement.getAttribute('PRAjaxEventCounter')){return i;}}
return-1;}
this.addCachedEvent=function(pElement,pEventType,pFunction,pUseCapture){var _this=this;if(pElement.setAttribute){pElement.setAttribute('PRAjaxEventCounter',_this.eventCounter++);}
_this.eventCache.push([pElement,pEventType,pFunction,pUseCapture]);}
this.removeCachedEvent=function(idx){var _this=this;var newCache=new Array();var cnt=_this.eventCache.length;for(var i=cnt;i>=0;i--){if(i!=idx){newCache.push(_this.eventCache[i]);}}
_this.eventCache=newCache;}})();this.deleteAllEvents=function(){var _this=this;if(_this.EventCache&&_this.EventCache.eventCache){for(var i=_this.EventCache.eventCache.length-1;i>=0;i--){_this.deleteEvent(_this.EventCache.eventCache[i][0],_this.EventCache.eventCache[i][1],_this.EventCache.eventCache[i][2],_this.EventCache.eventCache[i][3]);}}}
this.addEvent=function(pElement,pEventType,pFunction,pUseCapture){var _this=this;_this.EventCache.addCachedEvent(pElement,pEventType,pFunction,pUseCapture);if(pElement.addEventListener){return pElement.addEventListener(pEventType,_this.EventCache.getLatestCachedEvent()[2],pUseCapture);}else if(pElement.attachEvent){return pElement.attachEvent('on'+pEventType,_this.EventCache.getLatestCachedEvent()[2],pUseCapture);}else{return false;}}
this.deleteEvent=function(pElement,pEventType,pFunction,pUseCapture){var _this=this;var returnValue=false;var eCached=_this.EventCache.findCachedEvent(pElement,pEventType,pFunction,pUseCapture);if(eCached!=null){if(pElement.removeEventListener){returnValue=pElement.removeEventListener(pEventType,eCached[2],pUseCapture);}else if(pElement.detachEvent){returnValue=pElement.detachEvent('on'+pEventType,eCached[2],pUseCapture);}else{returnValue=false;}
_this.EventCache.removeCachedEvent(_this.EventCache.findCachedEventId(pElement,pEventType,pFunction,pUseCapture));}
return returnValue;}
this.addSlashes=function(pString){pString=pString+"";pString=pString.replace(/\\/g,"\\\\");pString=pString.replace(/\'/g,"\\'");pString=pString.replace(/\"/g,"\\\"");return pString;}
this.stripSlashes=function(pString){pString=pString+"";return pString.replace(/(\\)([\\\'\"])/g,"$2");}
this.getFormValues=function(pForm){var returnValue=new Array();var elements=pForm.elements;var cnt=elements.length;var name='';var value='';for(var i=0;i<cnt;i++){if(!elements[i].name)
continue;if(elements[i].type&&(elements[i].type=='radio'||elements[i].type=='checkbox')&&elements[i].checked==false)
continue;if(elements[i].disabled&&elements[i].disabled==true)
continue;if(elements[i].name){if(elements[i].type=='select-multiple'){for(var j=0;j<elements[i].length;j++){if(elements[i].options[j].selected==true){returnValue[elements[i].name]=elements[i].options[j].value;}}}else{returnValue[elements[i].name]=elements[i].value;}}}
return returnValue;}})();(function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={array:function(x){var a=['['],b,f,i,l=x.length,v;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a[a.length]=v;b=true;}}}
a[a.length]=']';return a.join('');},'boolean':function(x){return String(x);},'null':function(x){return"null";},number:function(x){return isFinite(x)?String(x):'null';},object:function(x){if(x){if(x instanceof Array){return s.array(x);}
var a=['{'],b,f,i,v;for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a.push(s.string(i),':',v);b=true;}}}
a[a.length]='}';return a.join('');}
return'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+x+'"';}};Boolean.prototype.toJSONString=function(){return s.boolean(this);};Number.prototype.toJSONString=function(){return s.number(this);};String.prototype.toJSONString=function(){return s.string(this);};Object.prototype.toJSONString=function(){return s.object(this);};Array.prototype.toJSONString=function(){return s.array(this);};})();String.prototype.parseJSON=function(){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+this+')');}catch(e){return false;}};