﻿function validateForm(form) { //This is the name of the function

if (form.navn.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt navn!"); //Informs user of empty field
   form.navn.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.adresse.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt adresse!"); //Informs user of empty field
   form.adresse.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.kontaktperson.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt kontaktperson!"); //Informs user of empty field
   form.kontaktperson.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.postnr.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt postnummer!"); //Informs user of empty field
   form.postnr.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.by.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt by!"); //Informs user of empty field
   form.by.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.telefon.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt telefonnummer!"); //Informs user of empty field
   form.telefon.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

if (form.kommentar.value == "") { //This checks to make sure the field is not empty
   alert("Du har ikke udfyldt forespørgsel!"); //Informs user of empty field
   form.kommentar.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Indtast venligst en gyldig e-mail adresse!")
e.select()
}
return returnval
}
