// JavaScript Document

function validinv() {

var email = document.webinarForm.email.value;
var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;

if (document.webinarForm.fname.value == "")
	{
		alert('Please enter your first name.');
		document.webinarForm.fname.style.background = 'Yellow';
		document.webinarForm.fname.focus();
		return false;
	}
	else if (document.webinarForm.lname.value == "") 
	{
		alert('Please enter your last name.');
		document.webinarForm.lname.style.background = 'Yellow';
		document.webinarForm.lname.focus();
		return false;
	}
	else if (document.webinarForm.phone.value == "") 
	{
		alert("Please enter your phone number.");
		document.webinarForm.phone.style.background = 'Yellow';
		document.webinarForm.phone.focus();
		return false;
	}
	else if (emailRegxp.test(email) != true) 
	{
		alert("Email address appears to be incorrect.");
		document.webinarForm.email.style.background = 'Yellow';
		document.webinarForm.email.focus();
		return false;

	}
	else if (document.webinarForm.datetime.value == "") 
	{
		alert("Please enter a preferred Webinar date & time.");
		document.webinarForm.datetime.style.background = 'Yellow';
		document.webinarForm.datetime.focus();
		return false;
	}
	else if (document.webinarForm.humano.value != "<?php echo $answer1; ?>")
	{
		alert('Your human verifier is wrong.');
		document.webinarForm.humano.style.background = 'Yellow';
		document.webinarForm.humano.focus();
		return false;
	}	

	document.webinarForm.fname.style.background = 'White';
	document.webinarForm.lname.style.background = 'White';
  	document.webinarForm.phone.style.background = 'White';
  	document.webinarForm.email.style.background = 'White';
  	document.webinarForm.datetime.style.background = 'White';
  	document.webinarForm.humano.style.background = 'White';
	document.webinarForm.submit();

}
