/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ YUI.add('cookie',function(Y){var L=Y.Lang,O=Y.Object,NULL=null,isString=L.isString,isObject=L.isObject,isUndefined=L.isUndefined,isFunction=L.isFunction,encode=encodeURIComponent,decode=decodeURIComponent,doc=Y.config.doc;function error(message){throw new TypeError(message);} function validateCookieName(name){if(!isString(name)||name===""){error("Cookie name must be a non-empty string.");}} function validateSubcookieName(subName){if(!isString(subName)||subName===""){error("Subcookie name must be a non-empty string.");}} Y.Cookie={_createCookieString:function(name,value,encodeValue,options){options=options||{};var text=encode(name)+"="+(encodeValue?encode(value):value),expires=options.expires,path=options.path,domain=options.domain;if(isObject(options)){if(expires instanceof Date){text+="; expires="+expires.toUTCString();} if(isString(path)&&path!==""){text+="; path="+path;} if(isString(domain)&&domain!==""){text+="; domain="+domain;} if(options.secure===true){text+="; secure";}} return text;},_createCookieHashString:function(hash){if(!isObject(hash)){error("Cookie._createCookieHashString(): Argument must be an object.");} var text=[];O.each(hash,function(value,key){if(!isFunction(value)&&!isUndefined(value)){text.push(encode(key)+"="+encode(String(value)));}});return text.join("&");},_parseCookieHash:function(text){var hashParts=text.split("&"),hashPart=NULL,hash={};if(text.length){for(var i=0,len=hashParts.length;i0){var decodeValue=(shouldDecode===false?function(s){return s;}:decode),cookieParts=text.split(/;\s/g),cookieName=NULL,cookieValue=NULL,cookieNameValue=NULL;for(var i=0,len=cookieParts.length;i