function validate () { 

	//Initialise variables
	var errorMsg = "";

	//Check for a first name
	if (document.onlinefrm.fname.value == ""){
		errorMsg += "\n\tFirst Name \t- Enter your First Name";	
	}
	
	//Check for a last name
	if (document.onlinefrm.lname.value == ""){
		errorMsg += "\n\tLast Name \t- Enter your Last Name";
	}
	
	if (document.onlinefrm.address.value == ""){
		errorMsg += "\n\tAddress   \t- Enter your Address";
	}
	
	if (document.onlinefrm.pstcode.value == ""){
		errorMsg += "\n\tPost Code \t- Enter your Post Code";
	}
	
	if (document.onlinefrm.phone.value == ""){
		errorMsg += "\n\tPhone   \t\t- Enter your Contact Number";
	}
	
	if (document.onlinefrm.debtsNumber.value == "sel"){
		errorMsg += "\n\tTotal Creditors \t- Please select total number of creditors";
	}
	//Check for an e-mail address and that it is valid
	if ((document.onlinefrm.email.value == "") || (document.onlinefrm.email.value.length > 0 && (document.onlinefrm.email.value.indexOf("@",0) == - 1 || document.onlinefrm.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter your valid e-mail address";
	}
			
	//Check for an enquiry
	if (document.onlinefrm.crntdebt.value == "sel") { 
 		errorMsg += "\n\tTotal Debt \t- Please select Total Debt";
	}
		
	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
