var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{}; jaaulde.utils.cookies=function(){var h,i,d,g,e={expiresAt:null,path:"/",domain:null,secure:false};h=function(a){var b,c;if(typeof a!=="object"||a===null)b=e;else{b={expiresAt:e.expiresAt,path:e.path,domain:e.domain,secure:e.secure};if(typeof a.expiresAt==="object"&&a.expiresAt instanceof Date)b.expiresAt=a.expiresAt;else if(typeof a.hoursToLive==="number"&&a.hoursToLive!==0){c=new Date;c.setTime(c.getTime()+a.hoursToLive*60*60*1E3);b.expiresAt=c}if(typeof a.path==="string"&&a.path!=="")b.path=a.path; if(typeof a.domain==="string"&&a.domain!=="")b.domain=a.domain;if(a.secure===true)b.secure=a.secure}return b};i=function(a){a=h(a);return(typeof a.expiresAt==="object"&&a.expiresAt instanceof Date?"; expires="+a.expiresAt.toGMTString():"")+"; path="+a.path+(typeof a.domain==="string"?"; domain="+a.domain:"")+(a.secure===true?"; secure":"")};d=function(){var a={},b,c,f,j,k=document.cookie.split(";"),l;for(b=0;b<k.length;b+=1){c=k[b].split("=");f=c[0].replace(/^\s*/,"").replace(/\s*$/,"");try{j=decodeURIComponent(c[1])}catch(m){j= c[1]}if(typeof JSON==="object"&&JSON!==null&&typeof JSON.parse==="function")try{l=j;j=JSON.parse(j)}catch(n){j=l}a[f]=j}return a};g=function(){};g.prototype.get=function(a){var b,c,f=d();if(typeof a==="string")b=typeof f[a]!=="undefined"?f[a]:null;else if(typeof a==="object"&&a!==null){b={};for(c in a)b[a[c]]=typeof f[a[c]]!=="undefined"?f[a[c]]:null}else b=f;return b};g.prototype.filter=function(a){var b,c={},f=d();if(typeof a==="string")a=RegExp(a);for(b in f)if(b.match(a))c[b]=f[b];return c};g.prototype.set= function(a,b,c){if(typeof c!=="object"||c===null)c={};if(typeof b==="undefined"||b===null){b="";c.hoursToLive=-8760}else if(typeof b!=="string")if(typeof JSON==="object"&&JSON!==null&&typeof JSON.stringify==="function")b=JSON.stringify(b);else throw Error("cookies.set() received non-string value and could not serialize.");c=i(c);document.cookie=a+"="+encodeURIComponent(b)+c};g.prototype.del=function(a,b){var c={},f;if(typeof b!=="object"||b===null)b={};if(typeof a==="boolean"&&a===true)c=this.get(); else if(typeof a==="string")c[a]=true;for(f in c)typeof f==="string"&&f!==""&&this.set(f,null,b)};g.prototype.test=function(){var a=false;this.set("cT","data");if(this.get("cT")==="data"){this.del("cT");a=true}return a};g.prototype.setOptions=function(a){if(typeof a!=="object")a=null;e=h(a)};return new g}(); (function(){window.jQuery&&function(h){h.cookies=jaaulde.utils.cookies;h.each({cookify:function(i){return this.each(function(){var d,g=["name","id"],e,a=h(this),b;for(d in g)if(!isNaN(d)){e=a.attr(g[d]);if(typeof e==="string"&&e!==""){if(a.is(":checkbox, :radio")){if(a.attr("checked"))b=a.val()}else b=a.is(":input")?a.val():a.html();if(typeof b!=="string"||b==="")b=null;h.cookies.set(e,b,i);break}}})},cookieFill:function(){return this.each(function(){var i,d,g=["name","id"],e,a=h(this);for(d=function(){i= g.pop();return!!i};d();){e=a.attr(i);if(typeof e==="string"&&e!==""){d=h.cookies.get(e);if(d!==null)if(a.is(":checkbox, :radio"))a.val()===d?a.attr("checked","checked"):a.removeAttr("checked");else a.is(":input")?a.val(d):a.html(d);break}}})},cookieBind:function(i){return this.each(function(){var d=h(this);d.cookieFill().change(function(){d.cookify(i)})})}},function(i){h.fn[i]=this})}(window.jQuery)})();
