(function(){function x(a,b){function f(){if("session"==a)try{j=m.parse(window.name||"{}")}catch(b){j={}}}var h=!1,e=0,g,d,j={};Math.random();if(b||"undefined"==typeof window[a+"Storage"])if("local"==a&&window.globalStorage)localStorage=window.globalStorage[window.location.hostname];else if("userDataBehavior"==l){b&&(window[a+"Storage"]&&window[a+"Storage"].parentNode)&&window[a+"Storage"].parentNode.removeChild(window[a+"Storage"]);d=document.createElement("button");document.getElementsByTagName("head")[0].appendChild(d); "local"==a?j=c:"session"==a&&f();for(g in j)j.hasOwnProperty(g)&&("__jstorage_meta"!=g&&"length"!=g&&"undefined"!=typeof j[g])&&(g in d||e++,d[g]=j[g]);d.length=e;d.key=function(a){var b=0,c;f();for(c in j)if(j.hasOwnProperty(c)&&"__jstorage_meta"!=c&&"length"!=c&&"undefined"!=typeof j[c]){if(b==a)return c;b++}};d.getItem=function(b){f();return"session"==a?j[b]:o.jStorage.get(b)};d.setItem=function(a,b){"undefined"!=typeof b&&(d[a]=(b||"").toString())};d.removeItem=function(b){if("local"==a)return o.jStorage.deleteKey(b); d[b]=void 0;h=!0;b in d&&d.removeAttribute(b);h=!1};d.clear=function(){"session"==a?(window.name="",x("session",!0)):o.jStorage.flush()};"local"==a&&(z=function(a,b){"length"!=a&&(h=!0,"undefined"==typeof b?a in d&&(e--,d.removeAttribute(a)):(a in d||e++,d[a]=(b||"").toString()),d.length=e,h=!1)});d.attachEvent("onpropertychange",function(b){if("length"!=b.propertyName&&!(h||"length"==b.propertyName)){if("local"==a)!(b.propertyName in j)&&"undefined"!=typeof d[b.propertyName]&&e++;else if("session"== a){f();"undefined"!=typeof d[b.propertyName]&&!(b.propertyName in j)?(j[b.propertyName]=d[b.propertyName],e++):"undefined"==typeof d[b.propertyName]&&b.propertyName in j?(delete j[b.propertyName],e--):j[b.propertyName]=d[b.propertyName];"session"==a&&(window.name=m.stringify(j));d.length=e;return}o.jStorage.set(b.propertyName,d[b.propertyName]);d.length=e}});window[a+"Storage"]=d}}function D(){var a="{}";if("userDataBehavior"==l){i.load("jStorage");try{a=i.getAttribute("jStorage")}catch(b){}try{q= i.getAttribute("jStorage_update")}catch(c){}k.jStorage=a}E();y();F()}function t(){var a;clearTimeout(G);G=setTimeout(function(){if("localStorage"==l||"globalStorage"==l)a=k.jStorage_update;else if("userDataBehavior"==l){i.load("jStorage");try{a=i.getAttribute("jStorage_update")}catch(b){}}if(a&&a!=q){q=a;var f=m.parse(m.stringify(c.__jstorage_meta.CRC32)),h;D();h=m.parse(m.stringify(c.__jstorage_meta.CRC32));var e,g=[],d=[];for(e in f)f.hasOwnProperty(e)&&(h[e]?f[e]!=h[e]&&g.push(e):d.push(e));for(e in h)h.hasOwnProperty(e)&& (f[e]||g.push(e));r(g,"updated");r(d,"deleted")}},25)}function r(a,b){a=[].concat(a||[]);if("flushed"==b){var a=[],c;for(c in n)n.hasOwnProperty(c)&&a.push(c);b="deleted"}c=0;for(var h=a.length;cB){var b=a[0],h=a[1];a=a[2];if(s[h])for(var e=0,g=s[h].length;e>>8^d;h[a]=g^-1;this.setTTL(a,f.TTL||0);z(a,b);r(a,"updated");return b},get:function(a,b){p(a);return a in c?c[a]&&"object"==typeof c[a]&&c[a]._is_xml&&c[a]._is_xml?C.decode(c[a].xml):c[a]:"undefined"==typeof b?null:b},deleteKey:function(a){p(a);return a in c?(delete c[a],"object"==typeof c.__jstorage_meta.TTL&&a in c.__jstorage_meta.TTL&&delete c.__jstorage_meta.TTL[a],delete c.__jstorage_meta.CRC32[a],z(a,void 0),v(),u(),r(a,"deleted"),!0):!1},setTTL:function(a,b){var f=+new Date;p(a); b=Number(b)||0;return a in c?(c.__jstorage_meta.TTL||(c.__jstorage_meta.TTL={}),0