/********************************************************************************
* Functions	: 	cookieCheck() checkCookie() showInfo() setCookie()				*
* Purpose	:	Provides a message about the costing of AED courses.			*
*			:	Checks that cookies are enabled.		*
*			:	Displays a message onmouseover one time only.					*
* Input		:	An onmouseover event is required to trigger the scripts except	*
*			:	for the cookieCheck function which checks for enabled cookies	*
* Output	:	Sets Cookies.  Displays and alert box							*
*			:																	*
* Author	:	John DF Abbott.													*
* Date		:	02 Oct 2006														*
* Notes		:	None															*
********************************************************************************/

/*This checks that the browser is set to accept cookies.  If not, false is returned.*/
function cookieCheck() {
	document.cookie = "ok";
	if (document.cookie.match("ok") == "ok") {
		return true;
	}
	else {
		return false;
	}
}

/*This checks that the cookie name has a value of "seen".  The 
regular expression is condensed from the argument and the text "seen".*/
function checkCookie(name) {
	var re = new RegExp(name + "=seen");
	return (re.test(document.cookie));
}

/*This is the Primary Controlling Function on this page.  It identifies the table
element responsible for firing the event for which it is the registered handler.
A check of cookies is made and if present no action is undertaken as the message will
already have been seen.  If the relevant cookie value is not present, the message is 
displayed and then a cookie is set to prevent further displays of the message.*/
function showInfo(evt) {
	var elementID = (window.event)?window.event.srcElement.id : evt.target.id;
	if (checkCookie(elementID)) {
		return;
	}
	alert("Training is free when combined with other courses unless separate certification is required.\nCost is 25 pounds for separate certification in combination with other training.");
	setCookie(elementID);
	return;
	
}


/*This sets the cookie with a name taken from the argument and a value of "seen"
The cookie is available from the root directory ";path=/".  Specifying a path is a 
requirement of p3p initative.*/
function setCookie(name) {
	document.cookie = name + "=seen;path=/";
	return;
}
