// ###############################################
//
// Created by: Luis O. Hernández
// Created for: Mai-Wah Cheung
// Functionality: Gets and Sets variable for cookies.
//
// ###############################################


// Returns a cokie crumb
function GetCookie(sName)
{
	// cookies are separated by semicolons
	aCookie = new Array();
	aCrumb = new Array();
	aCookie = document.cookie.split("; ");
 
	for (var i=0; i < aCookie.length; i++)
	{
		// a name/value pair (a crumb) is separated by an equal sign
		aCrumb = aCookie[i].split("=");
        
		if (sName == aCrumb[0])
		{
			return unescape(aCrumb[1]);
		}
	}

	// a cookie with the requested name does not exist
	return null;
}

// Sets a cookie crumb
function SetCookie(sName, sValue)
{
	document.cookie = sName + "=" + escape(sValue) + "; expires=Mon, 31 Dec 2028 23:59:59 UTC; path=/;";
	return;
}

// Deletes a cookie crumb
function DelCookie (name) {
	var expireNow = new Date();
	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
	return;
}
