<!--Begin
//function saada(submitForm) collects data from forms "customer" and "form_2", puts data into "submitForm" and then goes to "mailsender.asp" where form data are sent by e-mail and thanks page is displayed
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
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;
var myCode=document.myForm.postikood.value;
document.submitForm.Zip_Code.value=myCode;
var salesMan=document.myForm.email.value;
document.submitForm.Salesman.value=salesMan;
//alert(salesMan);
document.submitForm.Zip_Code.value=myCode;
document.submitForm.Telephone.value=document.customer.phone.value;
document.submitForm.Email.value=document.customer.email.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].value;
document.submitForm.Pieces.value=document.form_2.pieces.value;
document.submitForm.Length_1.value=document.form_2.length_1.value;
document.submitForm.Width_1.value=document.form_2.width_1.value;
document.submitForm.Length_2.value=document.form_2.length_2.value;
document.submitForm.Width_2.value=document.form_2.width_2.value;
document.submitForm.Length_3.value=document.form_2.length_3.value;
document.submitForm.Width_3.value=document.form_2.width_3.value;
document.submitForm.Length_4.value=document.form_2.length_4.value;
document.submitForm.Width_4.value=document.form_2.width_4.value;
document.submitForm.Length_5.value=document.form_2.length_5.value;
document.submitForm.Width_5.value=document.form_2.width_5.value;
document.submitForm.Length_6.value=document.form_2.length_6.value;
document.submitForm.Width_6.value=document.form_2.width_6.value;
document.submitForm.Length_7.value=document.form_2.length_7.value;
document.submitForm.Width_7.value=document.form_2.width_7.value;
document.submitForm.Straight_straight.value=document.form_2.straight.value;
document.submitForm.Straight_halfrounded.value=document.form_2.halfrounded.value;
document.submitForm.Straight_rounded.value=document.form_2.rounded.value;
document.submitForm.Curved_straight.value=document.form_2.straight_c.value;
document.submitForm.Curved_halfrounded.value=document.form_2.halfrounded_c.value;
document.submitForm.Curved_rounded.value=document.form_2.rounded_c.value;
document.submitForm.CornersA.value=document.form_2.roundcornera.value;
document.submitForm.CornersB.value=document.form_2.roundcornerb.value;
document.submitForm.Inset_sink.value=document.form_2.standard.value;
document.submitForm.Flushfit_sink.value=document.form_2.flushfit.value;
document.submitForm.Undermounted_sink.value=document.form_2.under.value;
document.submitForm.Underup_mounted_sink.value=document.form_2.underup.value;

document.submitForm.Sink_1.value=document.form_2.allas1[document.form_2.allas1.selectedIndex].text;
document.submitForm.Sink_2.value=document.form_2.allas2[document.form_2.allas2.selectedIndex].text;
document.submitForm.Sink_3.value=document.form_2.allas3[document.form_2.allas3.selectedIndex].text;

var hinta1=document.form_2.hinta1.value;
var hinta2=document.form_2.hinta2.value;
var hinta3=document.form_2.hinta3.value;

document.submitForm.Hob.value=document.form_2.hob.value;
document.submitForm.Taphole.value=document.form_2.taphole.value;
document.submitForm.Drainergrooves.value=document.form_2.draininggroove.value;
document.submitForm.Splashback_width_1.value=document.form_2.splashwidth_1.value;
document.submitForm.Splashback_length_1.value=document.form_2.splashlength_1.value;
document.submitForm.Splashback_width_2.value=document.form_2.splashwidth_2.value;
document.submitForm.Splashback_length_2.value=document.form_2.splashlength_2.value;
document.submitForm.Splashback_width_3.value=document.form_2.splashwidth_3.value;
document.submitForm.Splashback_length_3.value=document.form_2.splashlength_3.value;
document.submitForm.Templating.value=document.form_2.templating.value;
document.submitForm.Fitting.value=document.form_2.fitting.value;
document.submitForm.Location.value=document.form_2.asukoht[document.form_2.asukoht.selectedIndex].value;
//document.submitForm.TotalCost.value=document.plans.estimate.value;
document.submitForm.TotalCost.value=document.plans.discount.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("Press the \"Quote\" button to calculate your worktop cost!");
return (false);
}
if (document.plans.estimate.value != document.plans.check.value){
alert("Please click on the \"Quote\" button again");
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("Please check again that all fields are filled in correctly!");
//document.form_2.estimate.value="0";
return(false);
}
*/
//validate the user data
//validate name
if (document.submitForm.Name.value ==""){
alert("Enter your name!");
document.customer.name.focus();
return (false);
}
//validate address
if (document.submitForm.Address.value ==""){
alert("Enter your address!");
document.customer.address.focus();
return (false);
}
if (document.myForm.postikood.value==""){
alert("Enter your postcode at the top of this page!");
document.myForm.postikood.focus();
return (false);
}
//validate ZIP code
/*if (document.submitForm.Zip_Code.value ==""){
alert("Enter your postcode!");
document.customer.zip.focus();
return (false);
}
*/
//validate telephone number
if (document.submitForm.Telephone.value ==""){
alert("Enter your telephone number");
document.customer.phone.focus();
return (false);
}
var checkStr = document.customer.phone.value;
var prsVal = parseFloat(checkStr);
if (isNaN(prsVal)) 
  {
    alert("Please enter only numbers in the \"Telephone\" field.");
    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("Enter your e-mail address!");
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("Do not use invalid characters in e-mail address!");
document.customer.email.focus();
return false
}
}
atPos = email.indexOf("@",1)         //there has to be a @ symbol 
if (atPos == -1){
alert("In e-mail address, there must be a \@ character!");
document.customer.email.focus();
return false
}
if (email.indexOf("@",atPos+1) != -1){         //only one @ symbol 
alert("Only one \@ symbol!");
document.customer.email.focus();
return false
}

periodPos = email.indexOf(".",atPos)
if (periodPos == -1){         //and at least one "." after the @ sign
alert("There has to be at least one \"\.\" after \@ character!");
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("There must be at least two charactes after the \"\.\"")
document.customer.email.focus();
return false;
}

//submit the validated "submitForm" to "mailsender.php"
document.submitForm.submit();
return true;
}
//-- End>