//***************************************************************
//  Security Validation
//***************************************************************
function isValidEmail(s) {
	var regexp = /^((([a-z]|[A-Z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[A-Z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9]|\-){0,61}([a-z]|[A-Z]|[0-9])\.))*([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9]|\-){0,61}([a-z]|[A-Z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	return regexp.test(s);}
//**END OF SECURITY VALIDATION***********************************

//***************************************************************
//  Registration Form Validation - ENTER.ASP
//***************************************************************
function chkRegistrationForm(frmObj)
{
	var frm = frmObj;
	var chk = false;

	if (frm.name.value == "")
	{
	        document.frmEmail.name.focus(); 
    	    document.getElementById('name').style.color="red"; 
			alert('Please enter your name.');
	}

	else if (frm.telephone.value == "")
	{
	        document.frmEmail.telephone.focus(); 
    	    document.getElementById('telephone').style.color="red"; 
			alert('Please enter your telephone number.');
	}
	else if (frm.primaryEmail.value == "")
		{
	        document.frmEmail.primaryEmail.focus(); 
    	    document.getElementById('primaryEmail').style.color="red"; 
			alert('Please enter your email address.');
		}
	else if (!isValidEmail(frm.primaryEmail.value))
		{
	        document.frmEmail.primaryEmail.focus(); 
    	    document.getElementById('primaryEmail').style.color="red"; 
			alert('Your email address is not valid. Please make sure it is correct.');
		}
	else if (frm.age.value < 19 )
		{
	        document.frmEmail.age.focus(); 
    	    document.getElementById('age').style.color="red"; 
			alert('Sorry, you must be 19 years of age or older to enter.');
		}

	else if (frm.question.value < 1 )
		{
	        document.frmEmail.question.focus(); 
    	    document.getElementById('question').style.color="red"; 
			alert('You must answer the skill testing question.');
		}
	else
    {
		chk=true;
	}

	if (chk)
		{
			frm.sendform.value = true;
			document.forms['frmEmail'].submit();
			alert('Thank you!\n\nYour entry has been accepted.\n');
		}
	else
		{
			return -1;
		}
}
//**END OF REGISTRATION FORM VALIDATION**************************
