function createCookie(strName, strValue, nDays)
{
	var strExpires;

	if (nDays)
	{
		var date = new Date();
		date.setTime(date.getTime() + (nDays * 24 * 60 * 60 * 1000));
		strExpires = '; expires=' + date.toGMTString();
	}
	else
	{
		strExpires = '';
	}
	document.cookie = strName + '=' + escape(strValue) + strExpires + '; path=/';
}

function readCookie(strName)
{
	var strNameEQ = strName + '=';
	var arrayCookies = document.cookie.split(';');
	var strCookie;

	for (var i = 0; i < arrayCookies.length; i++)
	{
		strCookie = arrayCookies[i];
		while (strCookie.charAt(0) == ' ')
		{
			strCookie = strCookie.substring(1, strCookie.length);
		}
		if (strCookie.indexOf(strNameEQ) == 0)
		{
			return unescape(strCookie.substring(strNameEQ.length, strCookie.length));
		}
	}
	return null;
}

function eraseCookie(strName)
{
	createCookie(strName, '', -1);
}
