$(function() {
	$('#contactus').submit( function() {
		var errorMsg = '' ;
		
		// Check the email address
		if ( !$('input[name="contactEmail"]').val() )
			errorMsg += "Please enter an email address.\n" ;
		
		// Check if a title is selected
		if ( $('select[name="contactTitle"]').val() == '' )
			errorMsg += "Please select a title.\n" ;
		
		// Check if there is a surnamr
		if ( !$('input[name="contactSurname"]').val() )
			errorMsg += "Please enter a surname.\n" ;
			
		// Check if there is a subject
		if ( !$('input[name="contactSubject"]').val() )
			errorMsg += "Please enter a subject.\n" ;
		
		// Check if there is a comment
		if ( !$('#comment').val() )
			errorMsg += "Please enter a comment.\n" ;
		
		
		// Have we got any errors
		if ( errorMsg )
		{
			alert( errorMsg ) ;
			return false;
		}
		else
		{
			$('div.contactForm').hide() ;
			$('div.thankYou').show() ;
			return true;
		}
			
			
	} ) ;
}) ;
