function Cookie()
{}
Cookie.prototype.Get = Cookie_Get;
Cookie.prototype.Set = Cookie_Set;
Cookie.prototype.SetSession = Cookie_SetSession;
Cookie.prototype.Delete = Cookie_Del;

function Cookie_Get(szName)
{
	var nStart = document.cookie.indexOf(szName+"=");
	var nLen = nStart + szName.length + 1;
	if ( (!nStart) && (szName != document.cookie.substring(0, szName.length )) )
		return null;
	if (nStart == -1)
		return null;
	var nEnd = document.cookie.indexOf(";", nLen);
	if (nEnd == -1) 
		nEnd = document.cookie.length;
	return unescape(document.cookie.substring(nLen,nEnd));
}

function Cookie_SetSession(szName, Value, szPath, szDomain, bSecure)
{
	//cookie lasts only this session

	document.cookie = szName + "="  + escape(Value) +
		( (szPath) ? ";path=" + szPath : "") + 
		( (szDomain) ? ";domain=" + szDomain : "") +
		( (bSecure) ? ";secure" : "");
}
function Cookie_Set(szName, Value, dateExpires, szPath, szDomain, bSecure)
{
	if (!dateExpires)
	{
		dateExpires = new Date();
		dateExpires.setFullYear(3000);
	}

	document.cookie = szName + "="  + escape(Value) +
		( (dateExpires) ? ";expires=" + dateExpires.toGMTString() : "") +
		( (szPath) ? ";path=" + szPath : "") + 
		( (szDomain) ? ";domain=" + szDomain : "") +
		( (bSecure) ? ";secure" : "");
}

function Cookie_Del(szName)
{
	document.cookie = szName + "=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}

