
function setCookie(Name, Value)
{
	var ArgumentCount;
	var ArgumentValues;
	var Domain;
	var Expires;
	var Path;
	var Secure;

	ArgumentValues = setCookie.arguments;
	ArgumentCount = setCookie.arguments.length;

	Expires = (ArgumentCount > 2) ? ArgumentValues[2] : null;
	Path = (ArgumentCount > 3) ? ArgumentValues[3] : null;
	Domain = (ArgumentCount > 4) ? ArgumentValues[4] : null;
	Secure = (ArgumentCount > 5) ? ArgumentValues[5] : false;

	document.cookie = Name + "=" + escape (Value) +
	((Expires == null) ? "" : ("; expires=" + Expires.toGMTString())) +
	((Path == null) ? "" : ("; path=" + Path)) +
	((Domain == null) ? "" : ("; domain=" + Domain)) +
	((Secure == true) ? "; secure" : "");
}

function getCookie(Name)
{
	var Argument;
	var ArgumetLength;
	var CookieLength;
	var EndString;
	var i;
	var j;

	Argument = Name + "=";
	ArgumentLength = Argument.length;
	CookieLength = document.cookie.length;
	i = 0;
	while (i < CookieLength)
	{
	j = i + ArgumentLength;
	if (document.cookie.substring(i, j) == Argument)
	{
	EndString = document.cookie.indexOf (";", j);
	if (EndString == -1)
	EndString = document.cookie.length;
	return unescape(document.cookie.substring(j, EndString));
	}
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0)
	break;
	}
	return (null);
}

function deleteCookie(Name)
{
	var CookieValue;
	var ExpirationDate;

	ExpirationDate = new Date();
	ExpirationDate.setTime (ExpirationDate.getTime() - 1);

	/* Make Sure Cookie Exists First */
	CookieValue = getCookie(Name);
	if (CookieValue != null)
	setCookie(Name, "", ExpirationDate, "/");
}