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.sex.value.length < 2){
alert("Please select your sex");
f.sex.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.sex.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.yearofadmiision.value.length < 2){
alert("Please select your Year of Admission");
f.yearofadmiision.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.yearofadmiision.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.yearofpassing.value.length < 2){
alert("Please select your Year of passing");
f.yearofpassing.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.yearofpassing.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.dob.value.length < 2){
alert("Please enter your Date of Birth");
f.dob.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.dob.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.address.value.length < 2){
alert("Please enter your Present Address");
f.address.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.address.style.background = "white";
}
// make sure the form is not submitted
return false;
}

if(f.mobile.value.length < 2){
alert("Please enter your Mobile ");
f.mobile.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.mobile.style.background = "white";
}
// make sure the form is not submitted
return false;
}
if(f.country.value.length < 2){
alert("Please enter your Country");
f.country.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.country.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;
}


}