function validateApplication(){
	
	var form = document.applicationForm;	
	var errMsg = "";

	if(form.surname.value.length < 1){
		errMsg += "* You have not entered your surname \n";
	}	
	if(form.firstNames.value.length < 1){
		errMsg += "* You have not entered your first name \n";
	}		
	if(form.addr.value.length < 10){
		errMsg += "* You have not entered your full address \n";
	}		
	if(form.postcode.value.length < 1){
		errMsg += "* You have not entered a correct postcode \n";
	}		
	if(form.email.value.length < 1){
		errMsg += "* You have not entered your email address \n";
	}			
	if(form.telephone.value.length < 1){
		errMsg += "* You have not entered your telephone number \n";
	}				
	if(form.dob.value.length < 5){
		errMsg += "* You have not entered your date of birth \n";
	}			
	if(form.sex.value.length < 1){
		errMsg += "* You have not indicated your sex \n";
	}		
	if(form.nationality.value.length < 1){
		errMsg += "* You have not entered your nationality\n";
	}		
	if(form.guardians.value.length < 1){
		errMsg += "* You have not entered the name(s) of your parent(s)/guardian(s) \n";
	}	
	if(form.guardian1Address.value.length < 1){
		errMsg += "* You have not entered an address for your parent(s)/ guardian(s) \n";
	}		
	if(departRadioSelected() == false && form.otherDepartDate.value.length < 1)			{
		errMsg += "* You have not indicated which departure date you are considering \n";
	}
	if(form.school.value.length < 1){
		errMsg += "* You have not entered the name of your school \n";
	}		
	if(form.pastResults.value.length < 1){
		errMsg += "* You have not entered details of academic results already obtained \n";
	}	
	if(form.achievements.value.length < 1){
		errMsg += "* You have not entered details of your achievements \n";
	}		
	if(form.abilities.value.length < 1){
		errMsg += "* You have not entered details of your skills and abilities \n";
	}			
	if(form.health.value.length < 1){
		errMsg += "* You have not entered a description of your present state of health \n";
	}		
	if(form.dietary.value == "yes" && form.dietaryRequirements.value.length == 0){
		errMsg += "* You have not specified what your dietary requirements are\n";
	}	
	if(form.reasons.value.length < 1){
		errMsg += "* You have not entered your reasons for applying to LINK \n";
	}		
	if(form.futurePlans.value.length < 1){
		errMsg += "* You have not entered details of your future plans \n";
	}	
	if(form.convictions.value == "yes" && form.convictionDetails.value.length == 0){
		errMsg += "* You have not given details of your criminal convictions\n";
	}		
	if(form.ref1Name.value.length <1 || form.ref1Address.value.length <1 || form.ref1Telephone.value.length <1 || form.ref2Name.value.length <1 || form.ref2Address.value.length <1 || form.ref2Telephone.value.length <1){
		errMsg += "* You have not entered all the required details for both refereees \n";
	}
	if (errMsg != ""){
		strtMsg = "The following errors have been found with your submission: \n _____________________________________________________________________ \n\n";	
		errMsg = strtMsg + errMsg + "\n _____________________________________________________________________ \n\nPlease correct the errors and resubmit the form";	
		alert(errMsg);
		return false;
	}
	return true;
}

function clearDepartRadios(){
	for (var i = 0; i < document.applicationForm.departDate.length; i++){
		document.applicationForm.departDate[i].checked = false;
	}
}


function departRadioSelected(){
	sel = 0;
	for (var i = 0; i < document.applicationForm.departDate.length; i++){
		if (document.applicationForm.departDate[i].checked == true)
			sel = 1;
	}
	if (sel == 1)
		return true;
	else 	
		return false;
}


