var errfound = false; function ValidateLength(item, len) { return (item.length >= len); } function ValidateEmail(item) { if (!ValidateLength(item, 5)) return false; if (item.indexOf ('@', 0) == -1) return false; return true; } function FormError(elem, text) { if (errfound) return; window.alert(text); if(elem.type == 'text') { elem.select(); } elem.focus(); errfound = true; } function ValidateReservation(form,code) { errfound = false; if (!ValidateLength(form.farrival.value,1)) FormError(form.farrival,"Pflichtfeld: Termin von"); if (!ValidateLength(form.fdays.value,1)) FormError(form.fdays,"Pflichtfeld: Nächte"); if (!ValidateLength(form.frooms.value,1)) FormError(form.frooms,"Pflichtfeld: Zimmer"); if (!ValidateLength(form.fadults.value,1)) FormError(form.fadults,"Pflichtfeld: Kinder"); if (!ValidateLength(form.fchilds.value,1)) FormError(form.fchilds,"Pflichtfeld: Dětí"); if (!ValidateLength(form.fname.value,1)) FormError(form.fname,"Pflichtfeld: Nachname, Vorname"); if (!ValidateEmail(form.fmail.value)) FormError(form.fmail,"Pflichtfeld: E-mail"); if (code > 0) if (!ValidateLength(form.fcode.value,1)) FormError(form.fcode,"Pflichtfeld: Bitte geben Sie den Code ein"); return !errfound; }