<!--Begin
//function saada(submitForm) collects data from forms  
//"customer" (kliendi kontaktandmed), "form_1" (valitud graniit) and "plans" (tööpinna mõõdud, väljalõiked jne)
//puts data into "submitForm" and sends them to Diapol by e-mail
var months=new Array(13);1
months[1]="Januar";
months[2]="Februar";
months[3]="Marts";
months[4]="April";
months[5]="Maj";
months[6]="Juni";
months[7]="Juli";
months[8]="August";
months[9]="September";
months[10]="Oktober";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var aasta=time.getYear();
if (navigator.appName == "Netscape")
aasta=1900 + aasta;
if (navigator.userAgent.indexOf("Opera") >= 0)
aasta = 1900 + aasta;
var kuupaev=lmonth + ' ' + date + ',&nbsp;' + aasta;
function saada(submitForm){
document.submitForm.Name.value=document.customer.name.value;
document.submitForm.Address.value=document.customer.address.value;
document.submitForm.Zip_Code.value=document.customer.zip.value;
document.submitForm.Telephone.value=document.customer.phone.value;
document.submitForm.Email.value=document.customer.email.value;
document.submitForm.Source.value=document.customer.medie[document.customer.medie.selectedIndex].value;
document.submitForm.Sent.value=kuupaev;
//document.submitForm.Templating_date.value=document.customer.date.value;
document.submitForm.Granite.value=document.form_1.brand[document.form_1.brand.selectedIndex].text;
document.submitForm.Pieces.value=document.plans.pieces.value;
document.submitForm.Length_1.value=document.plans.length_1.value;
document.submitForm.Width_1.value=document.plans.width_1.value;
document.submitForm.Length_2.value=document.plans.length_2.value;
document.submitForm.Width_2.value=document.plans.width_2.value;
document.submitForm.Length_3.value=document.plans.length_3.value;
document.submitForm.Width_3.value=document.plans.width_3.value;
document.submitForm.Length_4.value=document.plans.length_4.value;
document.submitForm.Width_4.value=document.plans.width_4.value;
document.submitForm.Length_5.value=document.plans.length_5.value;
document.submitForm.Width_5.value=document.plans.width_5.value;
document.submitForm.Length_6.value=document.plans.length_6.value;
document.submitForm.Width_6.value=document.plans.width_6.value;
document.submitForm.Length_7.value=document.plans.length_7.value;
document.submitForm.Width_7.value=document.plans.width_7.value;
document.submitForm.Straight_straight.value=document.plans.straight.value;
document.submitForm.Straight_halfrounded.value=document.plans.halfrounded.value;
document.submitForm.Straight_rounded.value=document.plans.rounded.value;
document.submitForm.Curved_straight.value=document.plans.straight_c.value;
document.submitForm.Curved_halfrounded.value=document.plans.halfrounded_c.value;
document.submitForm.Curved_rounded.value=document.plans.rounded_c.value;
document.submitForm.CornersA.value=document.plans.roundcornera.value;
document.submitForm.CornersB.value=document.plans.roundcornerb.value;
document.submitForm.Inset_sink.value=document.plans.standard.value;
document.submitForm.Flushfit_sink.value=document.plans.flushfit.value;
document.submitForm.Undermounted_sink.value=document.plans.under.value;
document.submitForm.Underup_mounted_sink.value=document.plans.underup.value;
document.submitForm.Hob.value=document.plans.hob.value;
document.submitForm.Taphole.value=document.plans.taphole.value;
document.submitForm.Drainergrooves.value=document.form_2.draininggroove.value;
document.submitForm.Splashback_width_1.value=document.plans.splashwidth_1.value;
document.submitForm.Splashback_length_1.value=document.plans.splashlength_1.value;
document.submitForm.Splashback_width_2.value=document.plans.splashwidth_2.value;
document.submitForm.Splashback_length_2.value=document.plans.splashlength_2.value;
document.submitForm.Splashback_width_3.value=document.plans.splashwidth_3.value;
document.submitForm.Splashback_length_3.value=document.plans.splashlength_3.value;
document.submitForm.Templating.value=document.form_2.templating.value;
//document.submitForm.Templating.value=document.plans.templating.value;
document.submitForm.Fitting.value=document.form_2.fitting.value;
//document.submitForm.Fitting.value=document.plans.fitting.value;
//document.submitForm.Location.value=document.form_2.asukoht[document.form_2.asukoht.selectedIndex].value;
document.submitForm.TotalCost.value=document.plans.estimate.value;


//forbid manual messing with the "Quote" field (deleting or changing the total cost)

if (document.plans.estimate.value=="" || document.plans.estimate.value=="0"){
alert("Klik på \"Kalkulér\"-knappen for at udregne prisen på dit køkkenbord!");
return (false);
}
if (document.plans.estimate.value != document.plans.check.value){
//alert("You have manually changed the \"Quote\" field.\n Click on \"Quote\" button again");
document.plans.estimate.value=document.plans.check.value;
//document.plans.estimate.focus();
//return(false);
}

if (document.form_2.length_1.value=="" || document.form_2.length_1.value=="0"|| document.form_2.width_1.value==""|| document.form_2.width_1.value=="0"){
alert("Tjek venligst, om alle felter er korrekt udfyldt!");
//document.plans.estimate.value="0";
return(false);
}

//validate the user data
//validate name
if (document.submitForm.Name.value ==""){
alert("Skriv dit navn!");
document.customer.name.focus();
return (false);
}
//validate address
if (document.submitForm.Address.value ==""){
alert("Skriv din adresse!");
document.customer.address.focus();
return (false);
}
//validate ZIP code
if (document.submitForm.Zip_Code.value ==""){
alert("Skriv dit postnummer!");
document.customer.zip.focus();
return (false);
}
//validate telephone number
if (document.submitForm.Telephone.value ==""){
alert("Skriv dit telefonnummer!");
document.customer.phone.focus();
return (false);
}
var checkStr = document.customer.phone.value;
var prsVal = parseFloat(checkStr);
if (isNaN(prsVal)) 
  {
    alert("Skriv venligst kun numrene i \"Telefon\"-feltet!");
    document.customer.phone.focus();
    return (false);
  }	
//validate e-mail address
var email=document.customer.email.value;
invalidChars = "/:,;"
if (email == ""){         //email can't be empty
alert("Skriv din mailadresse!");
document.customer.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.customer.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.customer.email.focus();
return false
}
if (email.indexOf("@",atPos+1) != -1){         //only one @ symbol 
alert("Skriv venligst kun et \"@\"!");
document.customer.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.customer.email.focus();
return false
}
/*
if (email.indexOf(".",periodPos+1) !=-1){    //only one period
alert("Only one period \"\.\"!");
document.customer.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.customer.email.focus();
return false;
}
//validate reference
if (document.submitForm.Source.value ==""){
alert("Vælg din kilde!");
document.customer.medie.focus();
return (false);
}
//submit the validated "submitForm" to "mailsender.asp"
document.submitForm.submit();
return true;
}
//-- End>
