function testCookies()
	{
	var i;
	document.cookie = 'IAcceptCookies=yes';
	if(document.cookie == '') i = false; else i = true;
	document.cookie = 'IAcceptCookies=yes; expires=Thu, 01-Jan-1998 00:00:00 GMT';
	return i;
	}

function bakeCookie (name, value, expiry, path, domain, secure)
	{
	if (testCookies())
		{
		document.cookie = name + '=' + escape(value) + ((expiry)?(';expires=' + ((new Date((new Date()).getTime() + expiry*86400000)).toGMTString())):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':'');
		}
	}


function showCookie(name)
	{
	return unescape(getCookie(name));
	}


function getCookie(name)
	{
	if(document.cookie == '') return false; 
	else
		{
		var cookieStart, cookieEnd;
		var cookieString = document.cookie;
		cookieStart = cookieString.indexOf(name);
		if(cookieStart != -1)
			{
			cookieStart += name.length + 1;
			cookieEnd = cookieString.indexOf(';', cookieStart);
			if(cookieEnd == -1) cookieEnd = cookieString.length;
			return cookieString.substring(cookieStart, cookieEnd);
			}
		else
			{
			return false;
			}
		}
	}

function eatCookie(name, path, domain)
	{
	var cookieValue = getCookie(name);
	if(cookieValue)
		{
		document.cookie = name + '=' + cookieValue + '; expires=Thu, 01-Jan-1998 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'');
		}
	}

function hitCounter()
	{
	if (testCookies())
		{
		var num = getCookie('hitcount');
		if (num == false)
			{
			bakeCookie('hitcount',0);
			num = 0;
			}
		bakeCookie('hitcount',parseInt(num)+1,'3650');
		return showCookie('hitcount');
		}
	else return false;
	}
