var submitted = 0;
var foc = 0;

function everything(form) {
foc = 0;
if (submitted) { alert("Form already submitted, please be patient"); return false;}

var text = "You have not correctly filled in the following fields:"	
if(isname(form) == false) {
text += "\n   your name is mandatory";
}
if(isemail(form) == false) {
text += "\n   your e-mail address is mandatory (format you@mail.domain)";
}
if(isto(form) == false) {
text += "\n   your friends e-mail address is mandatory (format them@mail.domain)";
}
if (foc) { alert(text); return false; }
if (!submitted) { 
form.submitit.disabled=true;
submitted = 1;
form.submit();
}}

function isname(form) {
if (form.name.value == "") {
if (!foc) {form.name.focus(); foc = 1;}
return false;
}
return true;
}
function isemail(form) {
if (!validateEmail(form.replyemail.value,1,0)) {
if (!foc) {form.replyemail.focus(); foc = 1;}
return false;
}
return true;
}
function isto(form) {
if (!validateEmail(form.destemail.value,1,0)) {
if (!foc) {form.destemail.focus(); foc = 1;}
return false;
}
return true;
}
function cl(t){
if (t.defaultValue==t.value) t.value = "";
}

