lC = null

function ReadCookie (key, skips) 
{
	if (skips == null) {skips = 0}
	var cookie_string = '' + document.cookie;
	var cookie_array = cookie_string . split ('; ');
	for (var i = 0; i < cookie_array . length; ++ i) 
		{var single_cookie = cookie_array [i] . split ('=');
			if (single_cookie . length != 2) {continue}
			var name = unescape (single_cookie [0]);
			var value = unescape (single_cookie [1]);
			if (key == name && skips -- == 0) {return value}
		}
	return 'None';
}

function SetCookie (name, value) 
	{	var argv = SetCookie.arguments;
		var argc = SetCookie.arguments.length;
		var expires = (argc > 2) ? argv[2] : null;
		var path = (argc > 3) ? argv[3] : null;
		var domain = (argc > 4) ? argv[4] : null;
		var secure = (argc > 5) ? argv[5] : false;
		document.cookie = name + '=' + escape (value) +
		((expires == null) ? '' : ('; expires=' + expires.toGMTString())) +
		((path == null) ? '' : ('; path=' + path)) +
		((domain == null) ? '' : ('; domain='+lC)) +
		((secure == true) ? '; secure' : '');
	}

function setExpiry(days)
{	var newExpires = new Date ();
	newExpires.setTime (newExpires.getTime() + days * (24 * 60 * 60 * 1000)); // 1 days from now
	return (newExpires)
}
