<!--

window.onload = wkOnload;
	
var cookieName = "wilsonking_agree";
	
function wkOnload(){
	var redirect = readCookie(cookieName);
	if(redirect){
		//window.location = "http://www.wilsonking.co.uk/home.html";
	}	
	var wk_agree = document.getElementById(cookieName);
	wk_agree.onclick = checkAgree;
}

function checkAgree(){
	var agreeBox = document.getElementById('agree_t_c');
	if(agreeBox.checked){
		createCookie(cookieName,"True",365);
		return true;
	} else {
		alert('You must agree to our terms and conditions. Please read below and check the box if you agree with the statement.');
		return false;
	}
}
	
function readCookie(name) {
	
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
	
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
-->
