function mailcheck(){
if (document.myForm.name.value == "") 
{
alert ("Feltet Navn skal udfyldes!");
document.myForm.name.focus();
return false;
}
var email=document.myForm.email.value;
if(email == ""){
alert ("Feltet Email skal udfyldes!");
document.myForm.email.focus();
return false;
}
invalidChars = "/:,;"
if (email == ""){         //email can't be empty
alert("Feltet Email skal udfyldes!");
document.myForm.email.focus();
return false
}
for (i=0; i<invalidChars.length;i++){         //does the users input contain any invalid characters?
badChar = invalidChars.charAt(i)
if (email.indexOf(badChar,0) > -1){
alert("Skriv kun gyldige tegn i e-mail-adressen!");
document.myForm.email.focus();
return false
}
}
atPos = email.indexOf("@",1)         //there has to be a @ symbol 
if (atPos == -1){
alert("E-mail-adresse skal indeholde et \"\@\"-tegn!");
document.myForm.email.focus();
return false
}
if (email.indexOf("@",atPos+1) != -1){         //only one @ symbol 
alert("Skriv venligst kun et \"\@\"!");
document.myForm.email.focus();
return false
}

periodPos = email.indexOf(".",atPos)
if (periodPos == -1){         //and at least one "." after the @ sign
alert("Der skal være mindst én \".\" efter @-tegnet!");
document.myForm.email.focus();
return false
}
if (periodPos+3 > email.length){         //must be at least two characters after the "."
alert("Der skal være mindst 2 tegn efter \".\"!")
document.myForm.email.focus();
return false;
}
if (document.myForm.comments.value == ""){
alert ("Feltet Besked skal udfyldes!");
document.myForm.comments.focus();
return false;
}
document.myForm.source.value=document.getElementById("medie")[document.getElementById("medie").selectedIndex].text;
document.myForm.submit();
return true;
}

