/****
 * Cookie
 * 功能描述 : Cookie
 * 作	者 : qingkuangs
 * 日   期 : 2009-06-08
 *
****/
var Cookie = {
	getExpires:function(days, hours, minutes){
		var exdate = new Date();
		if(typeof(days) == "number" && typeof(hours) == "number" && typeof(hours) == "number"){
			exdate.setDate(exdate.getDate() + parseInt(days));
			exdate.setHours(exdate.getHours() + parseInt(hours));
			exdate.setMinutes(exdate.getMinutes() + parseInt(minutes));
			return exdate.toGMTString();
		}
	},
/**
 * 设置cookie
 *
 * @param string name  cookie名字
 * @param string value  cookie值
 * @param string path  cookie路径
 * @param string domain cookie域名
 * @param string secure cookie安全性
 * @return void
**/
	set:function(name,value,expires,path,domain,secure) {
		if(typeof(name) != "undefined" && name != null && typeof(value) != "undefined") {
			document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "; path=/") + ((domain) ? "; domain=" + domain : "") + ((secure) ? secure : "");
		}
	},
/**
 * 获取cookie
 *
 * @param string name  cookie名字
 * @return string
**/
	get:function(name) {
		if(document.cookie.length > 0) {
			var start = document.cookie.indexOf(name + "=");
			var end;
			if(start != -1) {
				start = start + name.length + 1;
				end = document.cookie.indexOf(";",start);
				if(end == -1) end = document.cookie.length;
				//return unescape(document.cookie.substring(start,end));
				return decodeURI(document.cookie.substring(start,end));
			}
		}
		return "";
	},
/**
 * 删除cookie
 *
 * @param string name  cookie名字
 * @param string path  cookie路径
 * @param string domain  cookie域名
 * @param string secure  cookie安全性
 * @return string
**/
	del:function(name,path,domain,secure) {
		var exp = new Date();
		exp.setTime(exp.getTime() - 1);
		var cVal = Cookie.get(name);
		document.cookie = name + "=" + cVal + ";expires=" + exp.toGMTString() + ((path) ? "; path=" + path : "; path=/") + ((domain) ? "; domain=" + domain : "") + ((secure) ? secure : "");
	}
};