/*
控制cookie可访问目录：
document.cookie="name=value; path=cookieDir";
例如：document.cookie="userId=320; path=/shop";
表示当前仅能在shop目录下使用。
如果要在整个网站下可用，用：
document.cookie="userId=320; path=/";
*/
function addCookie(name,value,expireHours){
var cookieString=name+"="+escape(value);
if(expireHours>0){
var date=new Date();
date.setTime(date.getTime()+expireHours*3600*1000);
cookieString=cookieString+";expire="+date.toGMTString() + ";path=/";
}
document.cookie=cookieString;
}
function getCookie(name) { 
var search; 
search = name + "=" 
offset = document.cookie.indexOf(search) 
if (offset != -1) { 
offset += search.length ; 
end = document.cookie.indexOf(";", offset) ; 
if (end == -1) 
end = document.cookie.length; 
return unescape(document.cookie.substring(offset, end)); 
} 
else 
return ""; 
}
function deleteCookie(name){
var date=new Date();
date.setTime(date.getTime()-10000);
document.cookie=name+"=v; expire="+date.toGMTString();
}
