YAHOO.namespace("util");YAHOO.util.Cookie={_createCookieString:function(f,d,e,a){var b=YAHOO.lang;var c=encodeURIComponent(f)+"="+(e?encodeURIComponent(d):d);if(b.isObject(a)){if(a.expires instanceof Date){c+="; expires="+a.expires.toGMTString()}if(b.isString(a.path)&&a.path!=""){c+="; path="+a.path}if(b.isString(a.domain)&&a.domain!=""){c+="; domain="+a.domain}if(a.secure===true){c+="; secure"}}return c},_createCookieHashString:function(d){var b=YAHOO.lang;if(!b.isObject(d)){throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.")}var c=new Array();for(var a in d){if(b.hasOwnProperty(d,a)&&!b.isFunction(d[a])&&!b.isUndefined(d[a])){c.push(encodeURIComponent(a)+"="+encodeURIComponent(String(d[a])))}}return c.join("&")},_parseCookieHash:function(c){var d=c.split("&"),b=null,e=new Object();if(c.length>0){for(var f=0,a=d.length;f<a;f++){b=d[f].split("=");e[decodeURIComponent(b[0])]=decodeURIComponent(b[1])}}return e},_parseCookieString:function(f,d){var e=new Object();if(YAHOO.lang.isString(f)&&f.length>0){var c=(d===false?function(l){return l}:decodeURIComponent);if(/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(f)){var h=f.split(/;\s/g),g=null,b=null,k=null;for(var a=0,j=h.length;a<j;a++){k=h[a].match(/([^=]+)=/i);if(k instanceof Array){try{g=decodeURIComponent(k[1]);b=c(h[a].substring(k[1].length+1))}catch(i){}}else{g=decodeURIComponent(h[a]);b=g}e[g]=b}}}return e},get:function(a,d){var b=YAHOO.lang;var c=this._parseCookieString(document.cookie);if(!b.isString(a)||a===""){throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.")}if(b.isUndefined(c[a])){return null}if(!b.isFunction(d)){return c[a]}else{return d(c[a])}},getSub:function(a,d,e){var b=YAHOO.lang;var c=this.getSubs(a);if(c!==null){if(!b.isString(d)||d===""){throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.")}if(b.isUndefined(c[d])){return null}if(!b.isFunction(e)){return c[d]}else{return e(c[d])}}else{return null}},getSubs:function(a){if(!YAHOO.lang.isString(a)||a===""){throw new TypeError("Cookie.getSubs(): Cookie name must be a non-empty string.")}var b=this._parseCookieString(document.cookie,false);if(YAHOO.lang.isString(b[a])){return this._parseCookieHash(b[a])}return null},remove:function(b,a){if(!YAHOO.lang.isString(b)||b===""){throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.")}a=a||{};a.expires=new Date(0);return this.set(b,"",a)},removeSub:function(d,b,a){if(!YAHOO.lang.isString(d)||d===""){throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.")}if(!YAHOO.lang.isString(b)||b===""){throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.")}var c=this.getSubs(d);if(YAHOO.lang.isObject(c)&&YAHOO.lang.hasOwnProperty(c,b)){delete c[b];return this.setSubs(d,c,a)}else{return""}},set:function(e,d,a){var b=YAHOO.lang;if(!b.isString(e)){throw new TypeError("Cookie.set(): Cookie name must be a string.")}if(b.isUndefined(d)){throw new TypeError("Cookie.set(): Value cannot be undefined.")}var c=this._createCookieString(e,d,true,a);document.cookie=c;return c},setSub:function(f,d,e,a){var b=YAHOO.lang;if(!b.isString(f)||f===""){throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.")}if(!b.isString(d)||d===""){throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.")}if(b.isUndefined(e)){throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.")}var c=this.getSubs(f);if(!b.isObject(c)){c=new Object()}c[d]=e;return this.setSubs(f,c,a)},setSubs:function(e,d,a){var b=YAHOO.lang;if(!b.isString(e)){throw new TypeError("Cookie.setSubs(): Cookie name must be a string.")}if(!b.isObject(d)){throw new TypeError("Cookie.setSubs(): Cookie value must be an object.")}var c=this._createCookieString(e,this._createCookieHashString(d),false,a);document.cookie=c;return c}};YAHOO.register("cookie",YAHOO.util.Cookie,{version:"2.7.0",build:"1799"});