schedule("window", initForm);
 
 
 

function initForm()
{
 var downloadForm = document.getElementById("downloadForm");
 
 downloadForm.onsubmit = checkForm;
};
 
 
 

function checkForm()
{
 //1
 var firstName = document.getElementById("firstName");
  //2
 var lastName = document.getElementById("lastName");

  //3
 var address = document.getElementById("address");
 
   //4
 var email = document.getElementById("email");
 
   //5
 var daytimePhone = document.getElementById("daytimePhone");
 
 //6
 var positionApplied = document.getElementById("positionApplied");
 
 
 // set up the new variable to return code
 var ret = true; // default the value to be successful
 
 

//1
 if (firstName.value == "")
 {
  firstName.focus();
  alert("Please fill in your first name");
  ret = false; // now there is an error, so set the ret variable to be false;
 }
 
 //2
 if (lastName.value == "")
 {
  lastName.focus();
  alert("Please fill in your last name");
  ret = false; // now there is an error, so set the ret variable to be false;
 }
  //3
 if (address.value == "")
 {
  address.focus();
  alert("Please fill in your address");
  ret = false; // now there is an error, so set the ret variable to be false;
 }
  //4
 if (email.value == "")
 {
  email.focus();
  alert("Please fill in your email address");
  ret = false; // now there is an error, so set the ret variable to be false;
 }
  //5
 if (daytimePhone.value == "")
 {
  daytimePhone.focus();
  alert("Please fill in your daytime phone number");
  ret = false; // now there is an error, so set the ret variable to be false;
 }
   //6
 if (positionApplied.value == "")
 {
  positionApplied.focus();
  alert("Please fill the position applied for");
  ret = false; // now there is an error, so set the ret variable to be false;
 }

 // now you can check if the funtion has been successful or not... if it has been then we can send it
 if (ret == true)
  send_mail();
 
 // now return the functions success value
 return ret;
};
