jQuery.cookie=function(name,value,options){ if(typeofvalue!='undefined'){// name and value given, set cookie
options=options||{}; if(value===null){ value=''; options.expires =-1; } var expires =''; if(options.expires &&(typeofoptions.expires =='number'||options.expires.toUTCString)){ vardate; if(typeofoptions.expires =='number'){ date=newDate(); date.setTime(date.getTime()+(options.expires * 24 * 60 * 60 * 1000)); }else{ date=options.expires; } expires ='; expires='+date.toUTCString();// use expires attribute, max-age is not supported by IE
} varpath=options.path?'; path='+options.path:''; vardomain=options.domain?'; domain='+options.domain:''; var secure =options.secure ?'; secure':''; document.cookie=[name,'=', encodeURIComponent(value), expires,path,domain, secure].join(''); }else{// only name given, get cookie
var cookieValue =null; if(document.cookie&&document.cookie!=''){ var cookies =document.cookie.split(';'); for(var i = 0; i < cookies.length; i++){ varcookie= jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want?