// JavaScript Document

//On load to confirm things are working
function load()
{
alert("Page is loaded");
}


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=/";
	//alert("Creating Cookie");
}


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;
}



//Check the cookie

function GetCookie()
{
	//alert(document.cookie);
//alert("Checking the cookie");
if (readCookie ("UnderstandingYouAgreement") == "yes")
	{
	
	//alert("Cookie is set!!!!");
	document.getElementById('Agreement').style.display = 'none';
	
	}
else {
	//alert("Cookie is NOT set" +document.cookie);
	document.getElementById('Agreement').style.display = 'block';
	}
}




// THis function checks that the checkbox is ticked, creates the cookie then hides the agreement div
function SubmitForm () {
	//alert(document.getElementById('agree').checked);
	if (document.getElementById('agree').checked==true){
		createCookie('UnderstandingYouAgreement', 'yes');
		document.getElementById('Agreement').style.display = 'none';
	} else {
		//alert("Check the damn box");
	}
}





	
	
	

	
	
	
	
	
	
