// MAKE SURE ALL INFO IS SEMI-VALID AND SUBMITTED

// BEGIN STEP 1 of 1 //
function checkregistrationdata(){
   var coform = document.registrationform;


   if(coform.Name.value.length<=1){
      alert("You must provide your full name.");
      coform.Name.focus();
      return;
   }

   if(coform.Name.value=="required"){
      alert("You must provide your full name.");
      coform.Name.focus();
      return;
   }
   if(coform.Address.value.length<=1){
      alert("You must provide your current street address.");
      coform.Address.focus();
      return;
   }
   if(coform.Address.value=="required"){
      alert("You must provide your current street address.");
      coform.Address.focus();
      return;
   }
   if(coform.City.value.length<=1){
      alert("You must provide your city.");
      coform.City.focus();
      return;
   }
   if(coform.City.value=="required"){
      alert("You must provide your city.");
      coform.City.focus();
      return;
   }
   if(coform.State.value.length<=1){
      alert("You must provide your state.");
      coform.State.focus();
      return;
   }
   if(coform.State.value=="required"){
      alert("You must provide your state.");
      coform.State.focus();
      return;
   }
   if(coform.Zip.value.length<=1){
      alert("You must provide your zip code.");
      coform.Zip.focus();
      return;
   }
   if(coform.Zip.value=="required"){
      alert("You must provide your zip code.");
      coform.Zip.focus();
      return;
   }
   if(coform.Email.value.length<=0){
      alert("You must enter your email address.");
      coform.Email.focus();
      return;
   }
   else{
      if(validemail(coform.Email.value)==false){
         alert("The email address you entered is invalid.");
         coform.Email.focus();
         coform.Email.select();
         return;
      }
   }
   if(coform.Email.value=="required"){
      alert("You must enter your email address.");
      coform.Email.focus();
      return;
   }
      if(coform.Phone.value=="optional"){
      coform.Phone.value = "";
   }
   if(coform.Website.value=="optional"){
      coform.Website.value = "";
   }
   if(coform.School.value=="optional"){
      coform.School.value = "";
   }


   coform.submit();
}
// END STEP 1 of 1 //




function validemail(emailin){
   emailin+="";
   if(emailin.length==0){return false;}

   var position=emailin.indexOf("@");
   if(position<1){return false;}

   position=emailin.indexOf(".",position+1);
   if(position<3){return false;}

   if(position==emailin.length-1){return false;}

   return true;
}

function clickclear(thisfield, defaulttext) {
 if (thisfield.value == "required") {
  thisfield.value = "";
 }
 if (thisfield.value == "optional") {
  thisfield.value = "";
 }
}

function clickrecall(thisfield, defaulttext) {
 if (thisfield.value == "") {
  thisfield.value = defaulttext;
 }
}
