function open_new_window(theURL,winName,features) { //v2.0 mywindow = window.open(theURL,winName,features); mywindow.focus(); } function openwindow() { open_new_window('/calculator/samples.php','Granite','scrollbars=yes, width=570,height=800' ); } function clickclear(thisfield, defaulttext) { if (thisfield.value == defaulttext) { thisfield.value = ""; } } function clickrecall(thisfield, defaulttext) { if (thisfield.value == "") { thisfield.value = defaulttext; } } function CheckFormSubmit() { var errorMsg = ""; if (document.cambrianQuotation.name.value == ''){ errorMsg += "\n\tPlease enter your name"; } if (document.cambrianQuotation.tel.value == ''){ errorMsg += "\n\tPlease enter your telephone number"; } if (document.cambrianQuotation.email.value == ''){ errorMsg += "\n\tPlease enter your email"; } if (errorMsg != ""){ msg = "______________________________________________________________\n\n"; msg += "Your enquiry has not been sent because there are problem(s) with the form.\n"; msg += "Please correct the problem(s) and re-submit the form.\n"; msg += "______________________________________________________________\n\n"; msg += "The following field(s) need to be corrected: -\n"; errorMsg += alert(msg + errorMsg + "\n\n"); return false; } return true; } function CheckForm () { var errorMsg = ""; if ((document.GeoForm.geocode.value.length > 4)||(document.GeoForm.geocode.value == "e.g. DN14")){ errorMsg += "\n\tPostcode part 1 \t- This is invalid"; } if ((document.GeoForm.geocode1.value.length > 4)||(document.GeoForm.geocode1.value == "e.g. 7XF")){ errorMsg += "\n\tPostcode part 2 \t- This is invalid"; } if (errorMsg != ""){ msg = "______________________________________________________________\n\n"; msg += "Your enquiry has not been sent because there are problem(s) with the form.\n"; msg += "Please correct the problem(s) and re-submit the form.\n"; msg += "______________________________________________________________\n\n"; msg += "The following field(s) need to be corrected: -\n"; errorMsg += alert(msg + errorMsg + "\n\n"); return false; } return true; } // PAGE 2 function CalculateWorktop(){ var worktotal1 = Number((document.Page2.worktop1a.value)*(document.Page2.worktop1b.value)); var worktotal2 = Number((document.Page2.worktop2a.value)*(document.Page2.worktop2b.value)); var worktotal3 = Number((document.Page2.worktop3a.value)*(document.Page2.worktop3b.value)); var worktotal4 = Number((document.Page2.worktop4a.value)*(document.Page2.worktop4b.value)); var worktotal5 = Number((document.Page2.worktop5a.value)*(document.Page2.worktop5b.value)); var worktotal6 = Number((document.Page2.worktop6a.value)*(document.Page2.worktop6b.value)); var worktotal7 = Number((document.Page2.worktop7a.value)*(document.Page2.worktop7b.value)); var worktotal8 = Number((document.Page2.worktop8a.value)*(document.Page2.worktop8b.value)); var worktop_total_area = (worktotal1+worktotal2+worktotal3+worktotal4+worktotal5+worktotal6+worktotal7+worktotal8)/1000000 + " m²"; document.Page2.worktop_area.value = worktop_total_area ; var worktotalarea = ((worktotal1+worktotal2+worktotal3+worktotal4+worktotal5+worktotal6+worktotal7+worktotal8)/1000000); var worktop_cost = Number(worktotalarea*document.Page2.selectiongross.value); document.Page2.worktop_cost.value = "£"+worktop_cost.toFixed(2); } // PAGE 3 function CalculatePolishedEdges(){ var Edges = Number((document.Page3.edges_polished_value.value)*(document.Page3.edges_polished_length.value/1000)); document.Page3.edges_polished_price.value = "£" + Edges.toFixed(2); } function CalculateProfiles(){ var Profile = Number((25.20)*(document.Page3.edges_profile.value/1000)); document.Page3.edges_profile_price.value = "£" + Profile.toFixed(2); } function ChangePolishedEdgePrice(){ document.Page3.edges_polished_value.value = "24"; } function ChangePolishedEdgePriceI(){ document.Page3.edges_polished_value.value = "80"; } // PAGE 4 function CalculatePolishedCutout(){ var cutout_polished=Number(document.Page4.cutout_polished_quantity.value * 144.00); document.Page4.cutout_polished_price.value = "£"+cutout_polished.toFixed(2); } function CalculateDrainerGrooves(){ var drainer_grooves=Number(document.Page4.drainer_grooves_quantity.value * 156.00); document.Page4.drainer_grooves_price.value = "£"+drainer_grooves.toFixed(2); } function CalculateDrainerRecessed(){ var recessed_drainer=Number(document.Page4.recessed_drainer.value * 350.00); document.Page4.recessed_drainer_price.value = "£"+recessed_drainer.toFixed(2); } function CalculateUnPolishedCutout(){ var cutout_unpolished=Number(document.Page4.cutout_unpolished_quantity.value * 93.00); document.Page4.cutout_unpolished_price.value = "£"+cutout_unpolished.toFixed(2); } // PAGE 5 function CalculateTapHoles(){ var tap_holes_quantity=Number(document.Page5.tap_holes_quantity.value * 14.40); document.Page5.tap_holes_price.value = "£"+tap_holes_quantity.toFixed(2); } function CalculateHobHoles(){ var hob_cutout_quantity=Number(document.Page5.hob_cutout_quantity.value * 75.00); document.Page5.hob_holes_price.value = "£"+hob_cutout_quantity.toFixed(2); } function CalculateSocketHoles(){ var socket_quantity=Number(document.Page5.socket_quantity.value * 35.00); document.Page5.socket_price.value = "£"+socket_quantity.toFixed(2); } function CalculateAdditionalHoles(){ var additional_cutout_quantity=Number(document.Page5.additional_cutout_quantity.value * 15.00); document.Page5.additional_holes_price.value = "£"+additional_cutout_quantity.toFixed(2); } // PAGE 6 function CalculateUpstands(){ upstandI = Number((document.Page6.selectiongrossI.value)*(document.Page6.upstand_length.value/1000)); document.Page6.upstandsPrice.value = "£" + upstandI.toFixed(2); } function CalculateSplashback(){ var splashback1 = Number((document.Page6.splashback1a.value)*(document.Page6.splashback1b.value)); var splashback2 = Number((document.Page6.splashback2a.value)*(document.Page6.splashback2b.value)); var splashback3 = Number((document.Page6.splashback3a.value)*(document.Page6.splashback3b.value)); var splashback4 = Number((document.Page6.splashback4a.value)*(document.Page6.splashback4b.value)); var splashback5 = Number((document.Page6.splashback5a.value)*(document.Page6.splashback5b.value)); var splashback6 = Number((document.Page6.splashback6a.value)*(document.Page6.splashback6b.value)); var splashback7 = Number((document.Page6.splashback7a.value)*(document.Page6.splashback7b.value)); var splashback8 = Number((document.Page6.splashback8a.value)*(document.Page6.splashback8b.value)); var splashback_total_area = (splashback1+splashback2+splashback3+splashback4+splashback5+splashback6+splashback7+splashback8)/1000000 + " m²"; document.Page6.splashback_area.value = splashback_total_area ; var splashbackarea = ((splashback1+splashback2+splashback3+splashback4+splashback5+splashback6+splashback7+splashback8)/1000000); var splashback_cost = Number(splashbackarea*document.Page6.selectiongrossII.value); document.Page6.splashback_cost.value = "£"+splashback_cost.toFixed(2); } function toggleAddress() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "show"; } else { ele.style.display = "block"; text.innerHTML = "hide"; } }