// JavaScript Document

function validate(form)
{
	var error = '';
	try {
	
	
		if (form.first_name.value == 'First name' || form.first_name.value.length < 2)		 error += 'fill in your first name.\n';
		if (form.last_name.value == 'Last name' || form.last_name.value.length < 2)		 error += 'fill in your surname.\n';
		if (form.title.value == '' || form.title.length < 2)		 error += 'enter your job title.\n';
		if (form.email.value == 'eg: you@yourhost.org.uk')		 error += 'fill in an email.\n';
		var efilter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!efilter.test(form.email.value)) error += 'fill in a valid email address.\n';
		if (form.phone.value == '' || form.phone.value.length < 2)		 error += 'fill in your daytime telephone number.\n';
		if (form.company.value == 'Last name' || form.company.value.length < 4)		 error += 'fill in your company name.\n';
		if (form.employees.selectedIndex == 0)		 error += 'select the number of employees.\n';
		if (form.country.selectedIndex == 0)		 error += 'select your country.\n';
		if (form.zip.value == '')		 error += 'enter your Post Code.\n';
		//if (form.SubscriptionAgreement.value != 'checked') error += 'You must read and agree to our terms and conditions to continue. Thank you.\n';
		
		if (document.forms[0]['SubscriptionAgreement'].checked)
        {
            //do something if necessary
        }
else   {
           error += 'You must read and agree to our terms and conditions to continue.\n';
        }
	
	if (error != '') {		
		alert("Please correct the following:\n\n"+error);
		return false;
		}
	}
	catch (e) {
		alert('Sorry there was a technical problem and we were unable to submit your form!');
		return false;
	} 
	return true;
};