var Cookie = {
	/**
	 * Initializes our coupons array
	 */
	Cookies: new Array(),

	/**
	 * For setting a cookie on the user's computer
	 */
	Set: function (name, value, expires, path, domain, secure) {
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime(today.getTime());
	
		if (expires)
			expires = expires * 1000 * 60 * 60 * 24;
		
		var expires_date = new Date(today.getTime() + (expires));
		
		document.cookie = name + "=" +escape(value) +
			((expires) ? ";expires=" + expires_date.toGMTString() : "") +
			((path) ? ";path=" + path : "") +
			((domain) ? ";domain=" + domain : "") +
			((secure) ? ";secure" : "");
	},

	/**
	 * For getting a cookie from the user's computer
	 */
	Get: function(name) {
		return this.Cookies[name];
	},

	/**
	 * Initialize our cookies
	 */
	Init: function() {
		var all_cookies = document.cookie.split(';');
		for(var i = 0; i < all_cookies.length; i++) {
			temp_cookie = all_cookies[i].split('=');
			cookie_name = temp_cookie[0].replace(/^\s+|\s+$/g,'');
			cookie_value = unescape(temp_cookie[1].replace(/^\s+|\s+$/g,''));

			// Save it internally
			this.Cookies[cookie_name] = cookie_value;
		}
	}
}

// Initializes cookies from the page
Cookie.Init();
