function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
	var sCookie = sName + "=" + encodeURIComponent(sValue);
	//失效时间 
	if (oExpires) {
		sCookie += "; expires= " + oExpires.toGMTString();
	}
	//路径 
	if (sPath) {
		sCookie += "; path = " + sPath;
	}
	//域 
	if (sDomain) {
		sCookie += "; domain = " + sDomain;
	}
	//安全标志 
	if (bSecure) {
		sCookie += "; secure = " + bSecure;
	}
	// 返回完整的Cookies 
	document.cookie = sCookie;
}

function getCookie(sName) {
	//正则表示的pattern 
	var sRE = "(?:; )?" + sName + "=([^;]*);?";
	//创建正则表达式对象 
	var oRE = new RegExp(sRE);
	// 使用test测试是否满足定义的格式 
	if (oRE.test(document.cookie)) {
		return decodeURIComponent(RegExp["$1"]);
	} else {
		return null;
	}
}
function deleteCookie(sName, sPath, sDomain) {
	var sCookie = sName + "=; expires =" + (new Date(0)).toGMTString();
	if (sPath) {
		sCookie += ";path= " + sPath;
	}
	if (sDomain) {
		sCookie += ";path= " + sDomain;
	}
	document.cookie = sCookie;
}