function validation(form)
{
	// --- Start of general field tests --- //
	
	if (form.first_name.value == '') 
	{
	    alert('Please enter your Name.');
		form.first_name.style.background = 'Yellow';
	    form.first_name.focus();
	    return false;
	}
	
	form.first_name.style.background = 'White';
	
//---------------------------------------------------------------------------------	

	if (form.job_title.value == '') 
	{
	    alert('Please enter your Job Title.');
	    form.job_title.style.background = 'Yellow';
	    form.job_title.focus();
	    return false;
	}
	
	form.job_title.style.background = 'White';
	
//---------------------------------------------------------------------------------
	
	// --- Industry combo box --- //
	
	if (form.industry.selectedIndex == 0)
	{
		alert('Please select your Industry.');
		form.industry.style.background = 'Yellow';
	    form.industry.focus()
		return false;
	}
	
    form.industry.style.background = 'White';
	
//---------------------------------------------------------------------------------
	
	if (form.company.value == '') 
	{
	    alert('Please enter your Company Name.');
	    form.company.style.background = 'Yellow';
	    form.company.focus();
	    return false;
	}
	
	form.company.style.background = 'White';
	
//---------------------------------------------------------------------------------
  
  	// --- Start of email tests --- //
	
	if (form.email.value == '') 
	{
	    alert('Please enter your Email Address.');
	    form.email.style.background = 'Yellow';
	    form.email.focus();
	    return false;
	}
	
	form.email.style.background = 'White';
	
	function trim(s) // trims whitespace - called from var below
	{
		return s.replace(/^\s+|\s+$/, '');
	}
	
	var error="";
	var tfld = trim(form.email.value);    // value of field with whitespace trimmed off
	var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	
	if (!emailFilter.test(tfld)) //test email for illegal characters 
	{              
	    form.email.style.background = 'Yellow';
	    alert('Please enter a valid email address.');
		form.email.focus();
		return false;
	} 
	
	else if (form.email.value.match(illegalChars)) 
	{
	    form.email.style.background = 'Yellow';
	    alert('The email address contains illegal characters.');
		form.email.focus();
		return false;
	} 
	
	form.email.style.background = 'White';
	
//---------------------------------------------------------------------------------
	
	// --- Start of phone tests --- //
	
	var stripped = form.phone.value.replace(/[\(\)\.\-\ ]/g, ''); 
	
	if (form.phone.value == '') 
	{
	    alert('Please enter a contact Phone Number.');
	    form.phone.style.background = 'Yellow';
	    form.phone.focus();
	    return false;
    } 

	else if (isNaN(parseInt(stripped))) 
	{
        alert('The phone number contains illegal characters.');
        form.phone.style.background = 'Yellow';
		form.phone.focus();
	    return false;
    } 
	
	else if (stripped.length < 10)		
	{
        	alert('The phone number is the wrong length. Make sure you included an area code.');
        	form.phone.style.background = 'Yellow';
		form.phone.focus();
	    return false;
    }

	form.phone.style.background = 'White';
	
//---------------------------------------------------------------------------------	
	
	// --- No of employees combo box --- //
	
	if (form.employees.selectedIndex == 0)
	{
		alert('Please select the Number of Employees in your organisation.');
		form.employees.style.background = 'Yellow';
	    form.employees.focus()
		return false;
	}
	
	form.employees.style.background = 'White';
	
//---------------------------------------------------------------------------------	
	
	// --- Info required combo box --- //
	
	if (form.info_req.selectedIndex == 0)
	{
		alert('Please select the Number of Employees in your organisation.');
		form.info_req.style.background = 'Yellow';
	    form.info_req.focus()
		return false;
	}
	
	form.info_req.style.background = 'White';
	
//---------------------------------------------------------------------------------	
	
	// --- How did you hear combo box --- //
	
	if (form.lead_source.selectedIndex == 0)
	{
		alert('Please tell us how you heard about us.');
		form.lead_source.style.background = 'Yellow';
	    form.lead_source.focus()
		return false;
	}
	
    form.lead_source.style.background = 'White';
	
//---------------------------------------------------------------------------------	

	return true;
}

