/* 
	Written By Andrew D Foster sheff@sheff.tv
	This is being used with the permission of Andrew D Foster by Vantage Technologies Ltd.
	26/6/2001
*/
function getCookie(label) 
{
	var labelLen = label.length;
    var cLen = document.cookie.length;
	var i = 0;
	while (i < cLen)
	{
		var j = i + labelLen;
		if (document.cookie.substring(i,j) == label) 
		{
			var cEnd = document.cookie.indexOf(";",j);
		    if (cEnd == -1)
			{
				cEnd = document.cookie.length;
			}
			if(document.cookie.substring(j+1,cEnd) == ";")
			{
				j--;
			}
			return document.cookie.substring(j+1,cEnd);
		}
		i++;
	}
	return "";
}
function setCookie(label, days, hours, mins, seconds)
{
	var date = new Date();
	var checker = 0;
	if(days)
	{
		date.setDate(date.getDate()+days);
		checker = 1;
	}
	if(hours)
	{
		date.setHours(date.getHours()+hours);
		checker = 1;
	}
	if(mins)
	{
		date.setMinutes(date.getMinutes()+mins);
		checker = 1;
	}
	if(seconds)
	{
		date.setSeconds(date.getSeconds()+seconds);
		checker = 1;
	}
	var expires = date.toGMTString();

	var fullCookie = label + ";";
	if(checker)
	{
		fullCookie = fullCookie + " expires=" + expires + "; path=/";
	}
	document.cookie = fullCookie;
	return;
}
