
window.onload = function() {
	checkCookiesEnabled();		
}

function checkCookiesEnabled()
{
	
	var bStat = false;
				
	try
	{					
		var cookies = new CookieHandler();		
		var fwct 	= "";
			
		fwct = cookies.get("FWCT");				
			
		if (fwct != false) {				
			cookies.deleteCookie("FWCT", fwct);
			bStat = true;			
		}
		else{
			alert("This site requires cookies. Please check that Cookies are enabled in your browser settings and then refresh this page.");		
		}
	}
	catch(err){
		alert(err);
	}
		
	return bStat;					
}

/*********** Cookie Handler ************/

function CookieHandler () {
	this.valid = false;
	this.val = null;
	this.path = "/";
	this.domain = "";
}

new CookieHandler();

CookieHandler.prototype.get = function (key) {
	this.getv(key);
	return this.valid ? this.val : false;
}

CookieHandler.prototype.set = function (key,val) {

	var today = new Date()
	expires = new Date(today.getTime() + 2*24*60*60*1000);
	document.cookie = key + "=" + escape(val) + "; expires=" + expires.toGMTString() + 
		(this.path=="" ? "" : "; path=" + this.path) + 
		(this.domain=="" ? "" : "; domain=" + this.domain);
}

CookieHandler.prototype.del = function (key,path,domain) {

	document.cookie= key + "=" +
		((path) ? "; path=" + path : this.path) +
		((domain) ? "; domain=" + domain : this.domain) +
		"; expires=Thu 01-Jan-70 00:00:01 GMT";
}

CookieHandler.prototype.getv = function (key) { // sets valid and val, returns true/false on success/failure

	var endstr;
	var arg = key + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i=0, j=0;
	
	while (i < clen) {
		j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			endstr = document.cookie.indexOf(";", j);
			if (endstr == -1) {
				endstr = document.cookie.length;
			}
			this.val = unescape(document.cookie.substring(j, endstr));
			this.valid = true;
			return true;
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) {
			break;
		}
	}
	this.valid = false;
	return false;
}

CookieHandler.prototype.deleteCookie = function(key, val)
{	
    var d = new Date();
    document.cookie = key + "=" + val + ";expires=" + d.toGMTString() + ";" + "path=/";
}

