function Cookie() {
	this.expires = "";
	this.path    = "";
	this.domain  = "";
	this.secure  = false;
}
Cookie.prototype = {
	erase : function(prop, value) {
		var str = (encodeURI ? encodeURI(prop) : escape(prop)) + "=" + (encodeURI ? encodeURI(value) : escape(value));
		if (this.expires) str += "; expires=" + (new Date(new Date() - 1000 * 60 * 60 * 24));
		if (this.path)    str += "; path=" + this.path;
		if (this.domain)  str += "; domain=" + this.domain;
		if (this.secure)  str += "; secure";
		document.cookie = str;
	},
	set : function(prop, value) {
		if (prop && value) {
			var str = (encodeURI ? encodeURI(prop) : escape(prop)) + "=" + (encodeURI ? encodeURI(value) : escape(value));
			if (this.expires) str += "; expires=" + this.expires;
			if (this.path)    str += "; path=" + this.path;
			if (this.domain)  str += "; domain=" + this.domain;
			if (this.secure)  str += "; secure";
			document.cookie = str;
		} else if (prop) {
			this.erase(prop, value);
		}
	},
	get : function(prop) {
		var data = {};
		if (document.cookie) {
			var cookies = (new String(document.cookie)).split(";");
			for (var i = 0, n = cookies.length; i < n; i++) {
				var pos = cookies[i].indexOf("=");
				var name = cookies[i].substr(0, pos);
				var value = cookies[i].substr(pos + 1);
				try {
					data[name] = decodeURI ? decodeURI(value) : unescape(value);
				} catch(e) {
					data[name] = unescape(value);
				}
			}
		}
		return (prop) ? data[prop] : data;
	}
}
