function setCookie(sName,sValue,sDaysToLive,sPath,sDomain,bSecure){try{var sCookie=sName+"="+encodeURIComponent(sValue);if(sDaysToLive!=null){var expDate=new Date();expDate.setTime(expDate.getTime()+(sDaysToLive*24*60*60*1000));sCookie+="; expires="+expDate.toGMTString();}if(sPath){sCookie+="; path="+sPath;}if(sDomain){sCookie+="; domain="+sDomain;}if(bSecure){sCookie+="; secure";}document.cookie=sCookie;}catch(e){}};function getCookie(sName){try{var sCookieRE="(?:; )?"+sName+"=([^;]*);?";var oCookieRE=new RegExp(sCookieRE);if(oCookieRE.test(document.cookie)){return decodeURIComponent(RegExp["$1"]);}else{return null;}}catch(e){}};function deleteCookie(sName,sPath,sDomain){try{setCookie(sName,"",new Date(0),sPath,sDomain);}catch(e){}};function CookieMAN(name){try{this.$name=name;var allcookies=document.cookie;if(allcookies==""){return;}var cookies=allcookies.replace(" ","").split(';');var cookie=null;for(i=0;i<cookies.length;i++){cookies[i]=cookies[i].replace(/\s/g,"");if(cookies[i].substring(0,name.length+1)==(name+"=")){cookie=cookies[i];break;}}if(cookie==null){return;}var cookieval=cookie.substring(name.length+1);var a=cookieval.split('&');for(i=0;i<a.length;i++){a[i]=a[i].split(':');}for(i=0;i<a.length;i++){this[a[i][0]]=decodeURIComponent(a[i][1]);}}catch(e){}};CookieMAN.prototype.store=function(daysToLive,path,domain,secure){try{var cookieval="";for(var prop in this){if((prop.charAt(0)=='$')||((typeof this[prop])=='function')){continue;}if(cookieval!=""){cookieval+='&';}cookieval+=prop+':'+encodeURIComponent(this[prop]);}var cookie=this.$name+'='+cookieval;if(daysToLive||daysToLive==0){cookie+=";max-age="+(daysToLive*24*60*60);}if(path==undefined){path="/";}if(path){cookie+="; path="+path;}if(domain){cookie+="; domain="+domain;}if(secure){cookie+="; secure";}document.cookie=cookie;}catch(e){}};CookieMAN.prototype.remove=function(path,domain,secure){try{for(var prop in this){if(prop.charAt(0)!='$'&&typeof this[prop]!='function'){delete this[prop];}}this.store(0,path,domain,secure);}catch(e){}};CookieMAN.enabled=function(){try{if(navigator.cookieEnabled!=undefined){return navigator.cookieEnabled;}if(Cookie.enabled.cache!=undefined){return Cookie.enabled.cache;}document.cookie="testcookie=test; max-age=10000";var cookies=document.cookie;if(cookies.indexOf("testcookie=test")== -1){return Cookie.enabled.cache=false;}else{document.cookie="testcookie=test; max-age=0";return Cookie.enabled.cache=true;}}catch(e){}}
