function check_form(f) { // f is the form (passed using the this keyword)

if(f.name.value.length < 2){
alert("Please enter your name");
f.name.focus(); // put the prompt in the name field 
// if the browserbrowser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.name.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.address.value.length < 5){
alert("Please enter your postal address");
f.address.focus(); // put the prompt in the DOB field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.address.style.background = "white";
}
// make sure the form is not submitted
return false;
}



// check the email address ( the exclamation means "not" )
if(!check_email(f.email.value)){
alert("Please enter a valid Email Address");
f.email.focus(); 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.email.style.background = "white";
}
// make sure the form is not submitted
return false;
}


if(f.phone.value.length < 5){
alert("Please provide phone number");
f.phone.focus(); 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.phone.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.job[f.job.selectedIndex].value == ""){
alert("Please choose your desired job type");
f.job.focus(); 
// make sure the form is not submitted
return false;
}


if(f.highest_qualification.value.length < 2){
alert("Please enter your highest academic qualification");
f.highest_qualification.focus(); // put the prompt in the DOB field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.highest_qualification.style.background = "white";
}
// make sure the form is not submitted
return false;
}


if(f.date_completed.value.length < 2){
alert("Please enter the date completed");
f.date_completed.focus(); // put the prompt in the DOB field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.date_completed.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.years_of_exp.value.length < 1){
alert("Please enter your years of experiance");
f.years_of_exp.focus(); // put the prompt in the DOB field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.years_of_exp.style.background = "white";
}
// make sure the form is not submitted
return false;
}


// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < f.teaching_qual.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (f.teaching_qual[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please choose Teaching Qualification Yes/No.")
return (false);
}



// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < f.young_learners.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (f.young_learners[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please choose if you have taught young learners Yes/No ")
return (false);
}


if(f.speak_languages.value.length < 3){
alert("Please enter the languages you know to speak");
f.speak_languages.focus(); // put the prompt in the field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field 
f.speak_languages.style.background = "white";
}
// make sure the form is not submitted
return false;
}


if(f.write_languages.value.length < 3){
alert("Please enter the languages you know to write");
f.write_languages.focus(); // put the prompt in the field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field 
f.write_languages.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.professional_ref.value.length < 3){
alert("Please provide professional references");
f.professional_ref.focus(); // put the prompt in the field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field 
f.professional_ref.style.background = "white";
}
// make sure the form is not submitted
return false;
}

}