﻿function newslettervalidator(theForm) {
    if (theForm.submit.value != "") { 

        if ((theForm.email.value == "") || (theForm.email.value == "")) {
            alert("CHYBA: Nezadaná e-mailová adresa!");
            theForm.email.focus();
            return (false);
        }
        
        adresa = theForm.email.value;
        re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
        if (adresa.search(re) != 0) {
            alert("CHYBA: Chybně zadaná e-mailová adresa!");
            theForm.email.focus();
            return (false);
        }
    }
    return (true);
}

function knihavalidator(theForm) {
    if (theForm.submit.value != "") { 
        if (theForm.name.value == "") {
            alert("CHYBA: Nezadáno Jméno!");
            theForm.name.focus();
            return (false);
        }

        if (theForm.email.value == "") {
            alert("CHYBA: Nezadána e-mailova adresa!");
            theForm.email.focus();
            return (false);
        }
        
        adresa = theForm.youremail.value;
        re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
        if (adresa.search(re) != 0) {
            alert("CHYBA: Chybně zadaná e-mailová adresa!");
            theForm.youremail.focus();
            return (false);
        }
//return (true);
    }
}

