
XbProperties=function(){this.propHashes=new org.xmlBlaster.util.Hashtable();this.prioStrings=["default","account","cookies","url","localconf"];for(i=0,l=this.prioStrings.length;i<l;i++){var prio=this.prioStrings[i];this.propHashes.put(prio,new org.xmlBlaster.util.Hashtable());}
this._parseUrl=function(search){if(search){var parameters=search.substr(1);var paramArray=parameters.split('&');var length=paramArray.length;var hash=this.propHashes.get("url");for(var index=0;index<length;index++){var param=paramArray[index].split('=');var name=param[0];var value=typeof param[1]=="string"?decodeURIComponent(param[1].replace(/\+/g,' ')):true;hash.put(name,value);}}}
this._parseCookies=function(){if(document.cookie){var cookies=document.cookie.split(';');var hash=this.propHashes.get("cookies");for(var i=0,l=cookies.length;i<l;i++){var c=cookies[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);var keyVal=c.split('=');hash.put(keyVal[0],keyVal[1]);}}}
this._parseUrl(window.location.search);this._parseCookies();this.setDefaultProp=function(key,value){return this.propHashes.get("default").put(key,value);}
this.getDefaultInt=function(key,defaultValue){return org.xmlBlaster.util.toNumber(this.getStrFrom("default",key,defaultValue),defaultValue);}
this.resetDefaultProperties=function(){return this.propHashes.get("default").clear();}
this.setAccountProp=function(key,value){return this.propHashes.get("account").put(key,value);}
this.setAccountProperties=function(accountProperties){this.propHashes.put("account",accountProperties);return this.propHashes.get("account").clear();}
this.resetAccountProperties=function(){return this.propHashes.get("account").clear();}
this.setCookieProp=function(key,value,days){return this.propHashes.get("cookies").put(key,value);org.xmlBlaster.util.createCookie(key,value,days);}
this.resetCookieProperties=function(){return this.propHashes.get("cookies").clear();}
this.setLocalProp=function(key,value){return this.propHashes.get("localconf").put(key,value);}
this.resetLocalProperties=function(){return this.propHashes.get("localconf").clear();}
this.resetAllButNotDefaultProperties=function(){var l=this.prioStrings.length;for(var i=1;i<l;i++){var prio=this.prioStrings[i];this.propHashes.get(prio).clear()}}
this.getObject=function(key,defaultValue){return this.getStr(key,defaultValue);}
this.getStrFrom=function(prioString,key,defaultValue){var hash=this.propHashes.get(prioString);if(hash!=null){var value=hash.get(key);if(value!=null){return value;}}
if(org.xmlBlaster.util.isDefined(defaultValue)){return defaultValue;}
return null;}
this.getArray=function(key,defaultValue){var csv=this.getStr(key,defaultValue);var arr=(csv==null)?[]:csv.split(',');return arr;}
this.arrayContains=function(key,element,defaultValue){var arr=this.getArray(key,defaultValue);for(var i=0;i<arr.length;i++){if(arr[i]==element){return true;}}
return false}
this.getHashtable=function(key,defaultValue){var csv=this.getStr(key,defaultValue);var hash=org.xmlBlaster.util.Hashtable.parseCSV(csv);return hash;}
this.getStr=function(key,defaultValue){var l=this.prioStrings.length;for(var i=(l-1);i>=0;i--){var prio=this.prioStrings[i];var hash=this.propHashes.get(prio);var value=hash.get(key);if(value!=null){return value;}}
return(org.xmlBlaster.util.isDefined(defaultValue))?defaultValue:null;}
this.getDate=function(key,defaultIsoStrValue){var iso=this.getStr(key,defaultIsoStrValue);var defaultToCurrentDate=(defaultIsoStrValue=="");var date=org.xmlBlaster.util.getDateFromIsoDateStr(iso,defaultToCurrentDate);return date;}
this.getInt=function(key,defaultValue){return org.xmlBlaster.util.toNumber(this.getStr(key,defaultValue),defaultValue);}
this.getDouble=function(key,defaultValue){return org.xmlBlaster.util.toNumber(this.getStr(key,defaultValue),defaultValue);}
this.getBoolean=function(key,defaultValue){return org.xmlBlaster.util.toBoolean(this.getStr(key,defaultValue),defaultValue);}
this.getBooleanTolerant=function(key,defaultValue){var val=this.getStr(key,defaultValue);if(val==null)return defaultValue;val=val.toLowerCase();if(val=="true"||val=="on"||val=="1"||val=="start")
return true;if(val=="false"||val=="off"||val=="0"||val=="stop")
return false;return defaultValue;}}