// JavaScript Document

function checkTrial()
{
	var thisForm = document.trial;
	
	// FIRST NAME
	if (thisForm.nameFirst.value == null || thisForm.nameFirst.value == "")
	{
		alert('You need to provide your first name.');
		thisForm.nameFirst.focus();
		return false;
	}
	// LAST NAME
	if (thisForm.nameLast.value == null || thisForm.nameLast.value == "")
	{
		alert('You need to provide your last name.');
		thisForm.nameLast.focus();
		return false;
	}
	
	// COMPANY NAME
	if (thisForm.companyName.value == null || thisForm.companyName.value == "")
	{
		alert('You need to provide your company name.');
		thisForm.companyName.focus();
		return false;
	}
	
	// CURRENT EMAIL
	if (thisForm.currentEmail.value == null || thisForm.currentEmail.value == "")
	{
		alert('You need to provide your current email address.');
		thisForm.currentEmail.focus();
		return false;
	}
	else
	{
		var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var emailval = thisForm.currentEmail.value;
		if (emailreg.test(emailval) == false)
		{
			alert('You need to provide a valid email address.');
			thisForm.currentEmail.focus();
			return false;
		}
	}
	
	// CONFIRM EMAIL
	if (thisForm.confirmEmail.value == null || thisForm.confirmEmail.value == "")
	{
		alert('You need to confirm your email address.');
		thisForm.confirmEmail.focus();
		return false;
	}
	else if (thisForm.currentEmail.value != thisForm.confirmEmail.value)
	{
		alert('The email addresses provided do not match.');
		thisForm.confirmEmail.focus();
		return false;
	}
	
	// TELEPHONE
	if (thisForm.telephoneNo.value == null || thisForm.telephoneNo.value == "")
	{
		alert('You need to provide your telephone number.');
		thisForm.telephoneNo.focus();
		return false;
	}
	
	// TRIAL SERVICE
	if (thisForm.trialServ.selectedIndex == 0)
	{
		alert('You need to select a service to trial.');
		thisForm.trialServ.focus();
		return false;
	}
	
	// TRIAL PASSWORD
	if (thisForm.trialPword.value == null || thisForm.trialPword.value == "")
	{
		alert('Please provide a password you would like to use with the service.');
		thisForm.trialPword.focus();
		return false;
	}
	
	// CONFIRM PASSWORD
	if (thisForm.confirmPword.value == null || thisForm.confirmPword.value == "")
	{
		alert('You need to confirm your password.');
		thisForm.confirmPword.focus();
		return false;
	}
	else if (thisForm.trialPword.value != thisForm.confirmPword.value)
	{
		alert('The passwords provided do not match.');
		thisForm.confirmPword.focus();
		return false;
	}
	if (document.getElementById('accsetup').style.display = "none")
	{
		document.getElementById('accsetup').style.display = "block";
	}
	document.getElementById('submitbutton').disabled = true;
}
