
function validate() {
   
   flag = 1;
   msg = 'Form Error(s)\n';

   if(document.favorites.user_first_name.value == "") { 
      msg += 'You must fill out the First Name field\n'; 
      flag = 0; 
   }
   if(document.favorites.user_last_name.value == "") { 
      msg += 'You must fill out the Last Name field\n'; 
      flag = 0; 
   }

   var reEmail = /^.+@.+\..{2,3}$/;
   if(document.favorites.user_email.value == "") {
      msg += 'You must fill out the Email field\n';
      flag = 0;
   }
   else if(!reEmail.test(document.favorites.user_email.value)) {
      msg += 'You must provide a valid Email address.\n';
      flag = 0;
   }

   if(document.favorites.user_phone.value == "") { 
      msg += 'You must fill out the Phone field\n'; 
      flag = 0; 
   }

   if(document.favorites.student_first_name.value == "") { 
      msg += 'You must fill out the Student First Name field\n'; 
      flag = 0; 
   }

   if(document.favorites.student_last_name.value == "") { 
      msg += 'You must fill out the Student Last Name field\n'; 
      flag = 0; 
   }

   if(document.favorites.student_email.value == "") { 
      msg += 'You must fill out the Student Email field\n'; 
      flag = 0; 
   }

   if(document.favorites.student_phone.value == "") { 
      msg += 'You must fill out the Student Phone field\n'; 
      flag = 0; 
   }

   if(document.favorites.recipe.value == "") { 
      msg += 'You must fill out the Recipe field\n'; 
      flag = 0; 
   }



   if(!flag) {
      alert(msg);
      return false; 
   }
   else {
      return true;
   }

}

