function validate_first_name(theForm) {
  if(theForm.first_name.value==""){
   alert(first_name_msg);
   theForm.first_name.focus();
   return false;
  } else {
    return true;
  }
}

function validate_last_name(theForm) {
  if (theForm.last_name.value == "") {
   alert(last_name_msg);
   theForm.last_name.focus();
   return false;
  } else {
    return true;
  }
}

function validate_company(theForm) {
  if (theForm.company.value == "")
  {
    alert(company_msg);
    theForm.company.focus();
    return false;
 } else {
    return true;
  }
}

function validate_street(theForm) {
  if(theForm.street.value==""){
   alert(street_msg);
   theForm.street.focus();
   return false;
  } else {
    return true;
  }
}

function validate_zip(theForm) {
  if(theForm.zip.value==""){
   alert(zip_msg);
   theForm.zip.focus();
   return false;
   } else {
    return true;
  }
}

function validate_city(theForm) {
  if(theForm.city.value==""){
   alert(city_msg);
   theForm.city.focus();
   return false;
  }    else {
    return true;
  } 
} 

function validate_country(theForm) {
  if(theForm.country.value==""){
     alert(country_msg);
     theForm.country.focus();
     return false;
  } else {
    return true;
  }
}

function validate_phone(theForm) {
  if (theForm.phone.value == "") {
   alert(phone_msg);
   theForm.phone.focus();
   return false;
  } else {
    return true;
  }
}

function validate_fax(theForm) {
  if (theForm.fax.value == "") {
    alert(fax_msg);
    theForm.fax.focus();
    return false;
 } else {
    return true;
  }
}

function validate_email(theForm) {
  if (theForm.email.value == "") {  
    alert(email_msg);
    theForm.email.focus();
    return false;
  } else {
    return true;
  }
}

function validate_message(theForm) {
  if (theForm.message.value == "") {
    alert(message_msg);
    theForm.message.focus();
    return false;
  } else {
    return true;
  }
}

// is the field numeric?
function isNumeric(field)
{
 if(field.value == ""){
  return;
 }

 // analyse the field
 var test = parseFloat(field.value);

 // OK? return
 if(!isNaN(test)) {
  field.value = test;
  return;
 }

 // Error message
 alert(numerical_input_msg); 
 field.focus();
 field.select();
 return false;
}


function validate_rental_service(theForm) { 
  if(!validate_first_name(theForm) ||
     !validate_last_name(theForm) ||
     !validate_street(theForm) ||
     !validate_zip(theForm) ||
     !validate_city(theForm) ||
     !validate_phone(theForm) ||
     !validate_email(theForm)){
      return false;
  }  
} 
 
function validate_contact(theForm) {  
  if(!validate_first_name(theForm) ||
     !validate_last_name(theForm) ||
     !validate_street(theForm) ||
     !validate_zip(theForm) ||
     !validate_city(theForm) ||
     !validate_country(theForm) ||
	 !validate_phone(theForm) ||
     !validate_email(theForm) ||
     !validate_message(theForm)){
      return false;
  }
}

function validate_driving_instructor_material(theForm) {

  var valid = false;
  for (var i = 0; i < theForm.materialElements.length; i++){

    var field = theForm.materialElements[i];  
    if(document.getElementById(field).value!=""){     
        valid =  true;
    }
  }
  if(valid){    
    if(!validate_first_name(theForm) ||
      !validate_last_name(theForm) ||
      !validate_company(theForm) ||
      !validate_street(theForm) ||
      !validate_zip(theForm) ||
      !validate_city(theForm) ||    
      !validate_phone(theForm) ||    
      !validate_fax(theForm) ||    
      !validate_country(theForm) ||
      !validate_email(theForm) ||
      !validate_message(theForm)) {
        return false;
    }
 } else {
    alert(nothing_chosen_msg);
    return false;
 }
}

function validate_information_brochures(theForm){
  if(!validate_first_name(theForm) ||
      !validate_last_name(theForm) ||
      !validate_street(theForm) ||
      !validate_zip(theForm) ||
      !validate_city(theForm) ||    
      !validate_phone(theForm) ||    
      !validate_email(theForm)) {
        return false;
  }
}

function validate_application_linde_academy(theForm){

if (theForm.seminartitel.value == please_choose) {
 alert(seminar_msg);
 theForm.seminartitel.focus();
 return false;
}

if (theForm.seminartermin.value == please_choose || theForm.seminartermin.value == please_choose_date) {
 alert(target_date_msg);
 theForm.seminartermin.focus();
 return false;
 }

if(theForm.first_name1.value=="" || theForm.last_name1.value==""){
 alert(name_msg);
 theForm.first_name1.focus();
 return false;

}

if (theForm.licence_for_trucks1[0].checked == false && theForm.licence_for_trucks1[1].checked == false){
 alert(drivers_license_for_industrial_trucks_msg);
 scrollTo(0,0);
 return false;
} 



if(!validate_first_name(theForm) ||
    !validate_last_name(theForm) ||
    !validate_company(theForm) ||
    !validate_phone(theForm) ||
    !validate_fax(theForm) ||   
    !validate_street(theForm) ||
    !validate_zip(theForm) ||
    !validate_city(theForm) ||    
    !validate_country(theForm) ||
    !validate_email(theForm)||
    !validate_message(theForm)) {
      return false;
 }
}
