if(typeof(xCookie) == "undefined") xCookie = {};

xCookie.set = function(name,value,days){
	if(days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}else{
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
};
xCookie.get = function(name){
	name += "=";
	var s = document.cookie.split("; ");
	for(var i = 0; i < s.length; i++){
		var c = s[i];
		if(c.indexOf(name) == 0){
			return unescape(c.substring(name.length,c.length));
		}
	}
	return null;
};
xCookie.erase = function(name){
	this.set(name,"",-1);
};
xCookie.getEnabled = function(){// Private
	this.set("xcookietest","xcookietest");
	return this.get("xcookietest") != null;
};
xCookie.enabled = xCookie.getEnabled();
