/*
**	Simple Cookie Class
**	Keith Foster, FB Toronto.
*/

function Cookie(n)
{
	this.name = n;
	this.value = "";
	this.expires = "";
	this.set = function(value, expires)
	{
		var ex = "";
		if (expires && expires != "")
		{
			var date = new Date();
			date.setTime(date.getTime()+(expires*24*60*60*1000));
			ex = "; expires="+date.toGMTString();
		}
		this.value = value;
		this.expires = ex;
		document.cookie = this.name+"="+this.value+this.expires+"; path=/";
	};
	this.erase = function()
	{
		createCookie(this.name,"",-1);
	};
	this.get = function() {
		if (document.cookie != "") 
		{
			var thisCookie = document.cookie.split("; ");
			for (i=0; i<thisCookie.length; i++) {
				if (this.name == thisCookie[i].split("=")[0]) {
					this.value = thisCookie[i].split("=")[1];
				}
			}
			if(this.value!="")
			{
				return this.value;
			}
			else
				return null;
		}
		else
			return null;
	};
};