var priceNo = ""; var lineNo = ""; var mat1 = new Array("3.88","4.27","4.72","5.11","5.5","6.26","7.84","9.49","11.02","13.08","13.98","16.78","19.55","22.34","27.92","0.048","0.0084");var mat2 = new Array("5.23","5.8","6.33","6.84","7.38","8.4","10.5","12.58","14.73","16.82","20.17","26.98","32.31","35.89","44.86","0.088","0.0154");var mat3 = new Array("6.99","7.69","8.4","9.1","9.82","11.25","14.01","16.82","19.62","22.43","26.93","35.84","43.07","47.8","59.79","0.13","0.02275");var mat4 = new Array("7.43","8.17","8.92","9.67","10.4","11.88","14.86","17.83","20.81","24.34","28.41","33.1","38.59","45.1","52.57","0.12","0.021");var mat5 = new Array("14.86","16.36","17.83","19.31","20.81","23.77","29.72","35.66","41.61","48.68","56.81","66.16","77.21","90.19","105.12","0.24","0.042");var mat6 = new Array("4.07","4.37","4.83","5.23","5.63","6.41","8.03","9.72","11.28","13.39","14.32","17.18","20.02","22.88","28.59","0.048","0.0084");var mat7 = new Array("6.4","6.9","7.58","8.22","8.81","10.12","12.62","15.13","17.65","21","25.2","30.96","36.04","41.23","51.5","0.1","0.0175");var mat8 = new Array("15.35","16.92","18.42","19.96","21.49","24.56","30.7","36.84","43","50.31","58.71","68.36","79.78","93.2","108.63","0.25","0.04375");var mat9 = new Array("4.27","4.70","5.19","5.62","6.05","6.89","8.62","10.44","12.12","14.39","15.38","18.46","21.51","24.57","30.71","0.0528","0.00924");var mat10 = new Array("4.1128","4.5262","5.0032","5.4166","5.83","6.6356","8.3104","10.0594","11.6812","13.8648","14.8188","17.7868","20.723","23.6804","29.5952","0.05088","0.0084");var mat11 = new Array("2","2.5","3","3.27","3.72","4.11","4.5","5.26","6.84","8","10.02","12.08","12.98","15.78","18.55","0.04","0.0084");var fac10 = new Array("GS1","GS6","GS8","GS8B","GS16","GS16P","GS17","PK1","PK6","PK16","WA1","WA2","WA7","WA8","WA9","WA10","WA11","WA12","GF1","GF2","GF3","GF4","GF5","GF6","GF7","GF8","BST8","BST9","BST10","BST11","BST12","BST13","HRO","HR4","HR4E","HR5","HR5E","HR14","HR15","HR16","HR17","BP6","BP6A","BP6E","BP6L","BP7","BP7S","BP8","PAS1","PAS2","PAS5","PAS6","PAS7","PAS34","PAK5","PAK34","PAA4","PAA5","PAF2","PA1","HR16M","PK16C","WA13Y","GF10","GF12","BST14","BST15","GS10-12T","WA16","BST16","GSHAT","GSHATC","HR0","PK56","PKCUP","PKCUPC");var fac13 = new Array("WA75","HR16Q","BP3M","PK17PB","SP6","GS4","GS4SB","GS33","GS38","GS39","PK4","PK4SB","PK8OBU","PK9","PK9C","PK37","WA3","WA3A","WA3P","WA14","WA15","GF9","HR3R","PAA6","PAD1","BP93","BPAD1","BPAD2","PK56SB","PKAQ","PKAQ10","PKAQ20","PKDAS","SP20","PRCRBU","PRCRS","PRKCR","PRKJS","PROCR","PROJA","PROJBULL","IBK6PRR","IBK7BB","IBK7BPR","IBK7PBRE","IBS6PRR","IBS7BPR","IBS7BPRE","IBSIPR-E");var fac11 = new Array("HR1","HR1RM","HR3PM","PAK1","PAK2","GS1P","GS3","GS6M","GS6MP","GS6P","GS7","GS7B","GS18","GS21","GS22","GS23","PK1P","PK3","PK6CP","PK6M","PK7","PK7B","PK18","PK21","WA1P","WA1T","WA2CP","WA2F","WA2P","WA7D","WA8PB","WA13","GF11","PAS9","PAS36","PAK36","SP11","SP13","PK24","PAS35","GS1R","GS6PA","PK6PA","QA-C","QA-E","QA-P","QA-U","SP21","SP27","WA1F","WA13Z","WA2S","PRCR");var fac12 = new Array("PK17","PAK3","GS2","GS2SB","GS9","GS9C","GS9D","GS9S","GS25-27","GS29-31","GS37","PK2","PK2SB","PK8","PK8C","PK8S","PK10-12","PK16B","PK17P","PK22","PK22TW","BP17A","BP95","PAK8","PAK9","PAK35","SP12","SP14","GS10-12W","HR9","HR10","WAXD","WAXS","GSSP","PK58","PKDA","PKSP","PRCRBULL","IBK1R","IBK6PAB","IBK6PR","IBK6PREX","IBS6PAB","IBS6PR","IBS6PREX","IBS7BB","IBSIMF","IBSIMFS","IBSIPK","IBSPIR","IBSIPR-C","IBSIPR-P","IBSIPR-U","GS2SB");var fac115 = new Array("GS10-12","GS10-12A","GS10-12B","GS10-12R");var fac16 = new Array("GS8OJBU","GS20","PK20","PK23CB","BP99","PAV1","PAV2","SP1","SP2","SP3","SP4","HR3E","BP17","BP99B","BP94","PAS4","PK8BU","BP4","BP18","BP96L","SP15","SP16","SP17","SP26","PRMF","PRMFS","PRMG","PRMGS","BP97L");var fac14 = new Array("SP7","HR3","WAC","WACA","SP24");var fac15 = new Array("GS8OJ","GS9DS","GS9SC","GS9SSE","GS10-12C","GS13-15","PK8LY","PK8OJ","PK8SC","PK8SE","PK8SSE","PK8T","PK13-15","BP3","BP3F","BP3LN","BP12","PAS8","PAS11","PAK11","PAD2","BP3A","SP22","SP23","SP5","PRKOJ");var fac30 = new Array("GS19","GS19H","PK19","PK19H","BP19","SP19");var fac18 = new Array("HR18","GS32","PK23","PK23C","BP96R","PAS3","SP18","SP25","SP28");var fac20 = new Array("BP16F","BP1","BP2","BP13","BP98");var fac185 = new Array("PAK7");var fac22 = new Array("BP9","BP16","BP10");var fac225 = new Array("BP15","BP14","BP5");var fac25 = new Array("BP5LN","PAK10","BP11"); var test=""; var disc = ""; var qty = ""; var curr = ""; var odDim = ""; var error = false; var mat = ""; var matFactor = ""; var unitVal = ""; var fac = ""; var idVal = ""; var odVal = ""; var hVal = ""; var csVal = ""; var h2Val = ""; var h3Val = ""; var profVal = ""; var currncy = ""; var r = 5; var items = 1; var Kit = 0; var kitE = 1; var kitDisc = 0; var kitPrice = 0; var kitadded = 0; function loadVars() { test = "test"; idVal = document.Vals.ID.value; odVal = document.Vals.OD.value; hVal = document.Vals.height.value; h2Val = document.Vals.height2.value; h3Val = document.Vals.height3.value; } function array_search (array, string) { for(var i = 0; i < array.length; i++) { if(array[i] == string) { return true; } } } function calcFac () { profVal = document.Vals.profile.value.toUpperCase(); numb = profVal.match(/\d\d/); if(numb) { profVal = profVal.replace(/\d\d/,parseInt(numb)); } switch(true) { case array_search(fac10, profVal): document.Vals.factor.value = 1; break;case array_search(fac13, profVal): document.Vals.factor.value = 1.3; break;case array_search(fac11, profVal): document.Vals.factor.value = 1.1; break;case array_search(fac12, profVal): document.Vals.factor.value = 1.2; break;case array_search(fac115, profVal): document.Vals.factor.value = 1.15; break;case array_search(fac16, profVal): document.Vals.factor.value = 1.6; break;case array_search(fac14, profVal): document.Vals.factor.value = 1.4; break;case array_search(fac15, profVal): document.Vals.factor.value = 1.5; break;case array_search(fac30, profVal): document.Vals.factor.value = 3; break;case array_search(fac18, profVal): document.Vals.factor.value = 1.8; break;case array_search(fac20, profVal): document.Vals.factor.value = 2; break;case array_search(fac185, profVal): document.Vals.factor.value = 1.85; break;case array_search(fac22, profVal): document.Vals.factor.value = 2.2; break;case array_search(fac225, profVal): document.Vals.factor.value = 2.25; break;case array_search(fac25, profVal): document.Vals.factor.value = 2.5; break; default: document.Vals.factor.value = 0; } } function currencyChange () { if (document.Vals.currency.value == "AUD") { currncy = "$"; document.Vals.del.value="3-4"; } else { currncy = "EUR"; document.Vals.del.value="6-8"; } var dollars = document.getElementsByName("dollar"); for (var i=0; i 0) { var errormsgs = "Cannot add item due to the following errors:\n\n"; for(i=0; i 12){ $('#quoteTable tr:eq(' + (r-1) + ')').after(' '+ ' ' + ' ' + ' '+ ' '+ ' '+ ''); } var x=document.getElementById('quoteTable').rows; //alert("total:" + x.length + " cur:" + r); pname = document.Vals.profile.value.toUpperCase(); pname = pname.replace("/","_"); var y=x[r].cells; y[0].innerHTML=''; y[1].innerHTML=''; if (u == "mm") { y[2].innerHTML=''; } else { y[2].innerHTML=''; document.getElementsByName('matDim'+items)[0].value = document.Vals.ID.value + '\"' + ' X ' + document.Vals.OD.value + '\"' + ' X ' +document.Vals.height.value + h + '\" ' + document.Vals.material.value.toUpperCase(); } if (Kit == 0) { y[4].innerHTML=''; y[5].innerHTML=''; } else { kitE = 0; y[4].innerHTML=''; y[5].innerHTML=''; kitPrice = (parseFloat(kitPrice) + nan2zero(parseFloat(document.getElementsByName('totalP'+items)[0].value))*(100-kitDisc)/100).toFixed(2); document.getElementsByName('totalP'+items)[0].value = 0; document.getElementsByName('totalP'+items)[0].style.display = "none"; document.getElementsByName('totalP'+kitNum)[0].value = kitPrice; kitnPrice = (kitPrice/parseFloat(document.getElementsByName('qty'+kitNum)[0].value)).toFixed(2); document.getElementsByName('netP'+kitNum)[0].value = kitnPrice; kitPrice = (kitnPrice * parseFloat(document.getElementsByName('qty'+kitNum)[0].value)).toFixed(2); document.getElementsByName('totalP'+kitNum)[0].value = kitPrice; } document.getElementById('rowNum').value = items; items = items+1; r = r+1; } // Add Sealnet Item function addSNItem(){ if(r > 12){ $('#quoteTable tr:eq(' + (r-1) + ')').after(' '+ ' ' + ' ' + ' '+ ' '+ ' '+ ''); } var x=document.getElementById('quoteTable').rows; var y=x[r].cells; pname = document.Vals.snProfile.value.toUpperCase(); pname = pname.replace("/","_"); y[0].innerHTML=''; y[1].innerHTML=''; y[2].innerHTML=''; if (Kit == 0) { y[4].innerHTML=''; y[5].innerHTML=''; } else { kitE = 0; y[4].innerHTML=''; y[5].innerHTML=''; kitPrice = (parseFloat(kitPrice) + nan2zero(parseFloat(document.getElementsByName('totalP'+items)[0].value))*(100-kitDisc)/100).toFixed(2); document.getElementsByName('totalP'+items)[0].value = 0; document.getElementsByName('totalP'+items)[0].style.display = "none"; document.getElementsByName('totalP'+kitNum)[0].value = kitPrice; kitnPrice = (kitPrice/parseFloat(document.getElementsByName('qty'+kitNum)[0].value)).toFixed(2); document.getElementsByName('netP'+kitNum)[0].value = kitnPrice; kitPrice = (kitnPrice * parseFloat(document.getElementsByName('qty'+kitNum)[0].value)).toFixed(2); document.getElementsByName('totalP'+kitNum)[0].value = kitPrice; } document.getElementById('rowNum').value = items; items = items+1; r = r+1; quotePrice(); currencyChange(); reAddCalc(); } function itemDelete () { if (r>5) { items = items-1; r = r-1; var x=document.getElementById('quoteTable').rows; var y=x[r].cells; y[0].innerHTML="
"; y[1].innerHTML="
"; y[2].innerHTML="
"; y[4].innerHTML="
"; y[5].innerHTML="
"; document.getElementById('rowNum').value = items -1; if (r > 12){ $('#quoteTable tr:eq(' + (r) + ')').remove(); } } } function nan2zero(tnum) { if (isNaN(tnum)) { return 0; } else { return tnum; } } function quotePrice() { var totalPrice = 0; for (var i=1; i< items; i++) { totalPrice = totalPrice + nan2zero(parseFloat(document.getElementsByName('totalP'+i)[0].value)); } totalPrice = totalPrice.toFixed(2); document.getElementsByName('tnPrice')[0].value = totalPrice; document.getElementsByName('tnPriceH')[0].value = totalPrice; var gstSelect = document.getElementById("GST"); if (gstSelect.options[gstSelect.selectedIndex].value == '1'){ document.getElementsByName('tgPrice')[0].value = (totalPrice/10).toFixed(2); document.getElementById("gst_label").innerHTML = 'Add 10% GST'; } else { document.getElementById("gst_label").innerHTML = 'Add 0% GST'; document.getElementsByName('tgPrice')[0].value = 0; } gst = document.getElementsByName('tgPrice')[0].value; totalfPrice = (nan2zero(parseFloat(gst)+parseFloat(totalPrice))).toFixed(2); document.getElementsByName('ttPrice')[0].value = totalfPrice; var ddlSample = document.getElementById("ddlSample"); if (ddlSample.options[ddlSample.selectedIndex].value == '1'){ document.getElementById("APS").checked = true; document.getElementById("APD").checked = false; } else if (ddlSample.options[ddlSample.selectedIndex].value == '2'){ document.getElementById("APD").checked = true; document.getElementById("APS").checked = false; } else if (ddlSample.options[ddlSample.selectedIndex].value == '3'){ document.getElementById("APS").checked = true; document.getElementById("APD").checked = true; } else { document.getElementById("APS").checked = false; document.getElementById("APD").checked = false; } } function toggle(obj) { var el = document.getElementById(obj); if ( el.style.display != 'none' ) { el.style.display = 'none'; } else { el.style.display = ''; } } function eLine () { if(r > 12){ $('#quoteTable tr:eq(' + (r-1) + ')').after(' '+ ' ' + ' ' + ' '+ ' '+ ' '+ ''); } var x=document.getElementById('quoteTable').rows; var y=x[r].cells; y[0].innerHTML=''; y[1].innerHTML=''; y[2].innerHTML=''; y[4].innerHTML=''; y[5].innerHTML=''; document.getElementById('rowNum').value = items; items = items+1; r = r+1; } function endKit () { var x=document.getElementById('quoteTable').rows; var y=x[r].cells; y[0].innerHTML=''; y[1].innerHTML=''; y[2].innerHTML=''; y[4].innerHTML=''; y[5].innerHTML=''; document.getElementById('rowNum').value = items; items = items+1; r = r+1; } function toMenu () { var answer = confirm('You have not saved the quote. Going back to the menu will erase all unsaved information. Do you really want to go back to the menu? Click Cancel to stay on the page.'); if (answer) { window.location = 'main.php'; } } function kitAssemble () { toggle('kit'); if (Kit == 0) { Kit = 1; document.getElementsByName('kitB')[0].value="Complete Kit"; } else { Kit = 0; document.Vals.addItem.value="Add Item"; document.getElementsByName('kitB')[0].value="Assemble Kit"; if (kitE == 0) { endKit(); eLine(); kitE = 1; } else { if (kitadded == 1) { items = items - 1; r = r - 1; document.getElementById('rowNum').value = items-1; kitadded = 0; } } kitPrice = 0; kitDisc = 0; document.getElementsByName('addKit')[0].disabled = ""; } } function kitAdd() { kitadded = 1; document.Vals.addItem.value="Add Item to Kit"; var x=document.getElementById('quoteTable').rows; var y=x[r].cells; y[0].innerHTML=''; y[1].innerHTML=''; y[2].innerHTML=''; y[4].innerHTML=''; y[5].innerHTML=''; kitDisc = parseFloat(document.getElementsByName('kDisc')[0].value); if (kitDisc == "") { kitDisc = 0; } kitNum = items; document.getElementById('rowNum').value = items; items = items+1; r = r+1; document.getElementsByName('addKit')[0].disabled = "disabled"; } function calcMatFac() { unitVal = document.Vals.units.value; if(unitVal != "mm") { odDim = parseFloat(document.Vals.OD.value) * 25.4; } else { odDim = parseFloat(document.Vals.OD.value); } if(odDim < 50) { priceNo = 0; } else if(odDim < 75) { priceNo = 1; } else if(odDim < 100) { priceNo = 2; } else if(odDim < 125) { priceNo = 3; } else if(odDim < 150) { priceNo = 4; } else if(odDim < 175) { priceNo = 5; } else if(odDim < 200) { priceNo = 6; } else if(odDim < 225) { priceNo = 7; } else if(odDim < 250) { priceNo = 8; } else if(odDim < 300) { priceNo = 9; } else if(odDim < 350) { priceNo = 10; } else if(odDim < 400) { priceNo = 11; } else if(odDim < 450) { priceNo = 12; } else if(odDim < 500) { priceNo = 13; } else if(odDim < 550) { priceNo = 14; } else { if(curr == "AUD") { priceNo = 15; } else { priceNo = 16; } } mat = document.Vals.material.value; mat = mat.toUpperCase(); var error = false; if(mat == "NBR" || mat == "ORSP" || mat == "TUF" || mat == "TUF" || mat == "MO" || mat == "MO" || mat == "MOTUF" || mat == "MOTUF" || mat == "ULTRA95" || mat == "SUPER95" || mat == "ROT95" || mat == "GRIN"){ lineNo = 1; } else if(mat == "PTFE" || mat == "PTFE" || mat == "TFV"){ lineNo = 2; } else if(mat == "TFG" || mat == "TFG" || mat == "TMB" || mat == "TMB" || mat == "TMF" || mat == "TMF" || mat == "TMCF"){ lineNo = 3; } else if(mat == "HNBR" || mat == "H-NBR"){ lineNo = 4; } else if(mat == "VITON"){ lineNo = 5; } else if(mat == "EPDM" || mat == "NEOPRENE"){ lineNo = 6; } else if(mat == "SILICON" || mat == "SILICONE" || mat == "SIL" || mat == "SILI"){ lineNo = 7; } else if(mat == "AFLAS" || mat == "AFLAS"){ lineNo = 8; } else if(mat == "MONYT"){ lineNo = 9; } else if(mat == "WIFF" || mat == "WIFFLON"){ lineNo = 10; } else if(mat == "NYLON" || mat == "POM"){ lineNo = 11; } else { error = true; } if(!error) { matFactor = window["mat"+lineNo][priceNo]; } else { matFactor = 0; } if(priceNo == 15 || priceNo == 16) { document.getElementById('odHeightL').value = "OD: "; document.getElementById('odHeight').value = odDim; matFactor = matFactor * odDim; } document.getElementById('matFac').value = matFactor; document.Vals.matFactor.value = matFactor; } function calcPrice() { if ($('#qToE').val() > 0){ calDiscount(); } curr = document.Vals.currency.value; unitVal = document.Vals.units.value; fac = document.Vals.factor.value; disc = document.Vals.discount.value; if (isNaN(disc)){ disc = 0; document.Vals.discount.value = 0; } matFactor = document.Vals.matFactor.value; if (disc == "") { disc = 0; } else { disc = parseFloat(disc); } qty = parseFloat(document.Vals.quantity.value); var hgt = parseFloat(document.Vals.height.value); if(hgt != 0 && odDim != 0) { if(unitVal == "mm") { if(hgt < 3) { hgt = 3; } var hValue = hgt + 2; } else { if(hgt < 0.118) { hgt = 0.118; } hgt = hgt * 25.4; hValue = hgt + 2; } document.getElementById('odHeightL').value = "Height Factor: height "; document.getElementById('odHeight').value = hgt.toFixed(2) + ' + 2 = ' + hValue.toFixed(2); document.getElementById('facCalc').value = fac; var price = matFactor * hValue * fac; if(curr == "Euro" && priceNo != 16) { price = price*0.62; } document.getElementById('nspCalc').value = price.toFixed(2); document.getElementById('spCalc').value = (price * qty).toFixed(2); price = price * (100 - disc) / 100; priceE = price; price = priceE * qty; } if ($('#qToE').val() > 0){ discountValue = itemValueDiscount(price); if (discountValue > 0){ price = price * (1 - discountValue/100); priceE = priceE * (1 - discountValue/100); realDiscount = (100-(priceE/document.Vals.nspCalc.value)*100); $('#discount').val(realDiscount.toFixed(2)); } } price = price.toFixed(2); priceE = priceE.toFixed(2); document.Vals.price.value = nan2zero(price); document.Vals.priceE.value = nan2zero(priceE); } function itemValueDiscount(itemValue){ dcItemValue = [500,1000,1500,2000,2500,3000,3500,5000,7500,10000,50000,100000]; dcValue = [5,10,15,20,25,30,35,40,45,50,55,60]; discountValue = 0; for(i = 0; i < 12; i++){ if (itemValue < dcItemValue[i]){ if (i > 0){ discountValue = dcValue[i-1]; } break; } else if(i==11 && itemValue > dcItemValue[i]){ discountValue = 60; } } return discountValue; } function calDiscount(){ var discount = 0; qty = $('#quantity').val(); if ($('#dcGroup').val() == 1){ if (qty == 1){ discount = 20; }else if(qty>1 && qty<10){ discount = 30; }else if(qty>=10){ discount = 40; } } else if($('#dcGroup').val() == 2){ if (qty == 1){ discount = 30; } else if(qty>1 && qty<10){ discount = 40; } else if(qty>=10){ discount = 50; } } else if ($('#dcGroup').val() == 3){ if (qty == 1){ discount = 40; } else if(qty>1 && qty<10){ discount = 50; } else if(qty>=10){ discount = 60; } } else if ($('#dcGroup').val() == 4){ if (qty == 1){ discount = 50; } else if(qty>1 && qty<10){ discount = 60; } else if(qty>=10){ discount = 70; } } $('#discount').val(discount); return discount; } function discountChange() { curr = document.Vals.currency.value; unitVal = document.Vals.units.value; fac = document.Vals.factor.value; disc = document.Vals.discount.value; if (isNaN(disc)){ disc = 0; document.Vals.discount.value = 0; } matFactor = document.Vals.matFactor.value; if (disc == "") { disc = 0; } else { disc = parseFloat(disc); } qty = parseFloat(document.Vals.quantity.value); var hgt = parseFloat(document.Vals.height.value); if(hgt != 0 && odDim != 0) { if(unitVal == "mm") { if(hgt < 3) { hgt = 3; } var hValue = hgt + 2; } else { if(hgt < 0.118) { hgt = 0.118; } hgt = hgt * 25.4; hValue = hgt + 2; } document.getElementById('odHeightL').value = "Height Factor: height "; document.getElementById('odHeight').value = hgt.toFixed(2) + ' + 2 = ' + hValue.toFixed(2); document.getElementById('facCalc').value = fac; var price = matFactor * hValue * fac; if(curr == "Euro" && priceNo != 16) { price = price*0.62; } document.getElementById('nspCalc').value = price.toFixed(2); document.getElementById('spCalc').value = (price * qty).toFixed(2); price = price * (100 - disc) / 100; priceE = price; price = priceE * qty; } document.Vals.price.value = nan2zero(price.toFixed(2)); document.Vals.priceE.value = nan2zero(priceE.toFixed(2)); } function matError() { document.Vals.material.value = "N/A"; } function trueValue() { if(Math.round(idVal*1000)/1000 != parseFloat(document.Vals.ID.value)) { idVal = document.Vals.ID.value; } if(Math.round(odVal*1000)/1000 != parseFloat(document.Vals.OD.value)) { odVal = document.Vals.OD.value; } if(Math.round(hVal*1000)/1000 != parseFloat(document.Vals.height.value)) { hVal = document.Vals.height.value; } if(Math.round(h2Val*1000)/1000 != parseFloat(document.Vals.height2.value)) { h2Val = document.Vals.height2.value; } if(Math.round(h3Val*1000)/1000 != parseFloat(document.Vals.height3.value)) { h3Val = document.Vals.height3.value; } } function convert() { if (document.Vals.units.options[0].selected == true) { idVal = idVal * 25.4; } else { idVal = idVal / 25.4 } document.Vals.ID.value = Math.round(idVal*1000)/1000; if (document.Vals.units.options[0].selected == true) { odVal = odVal * 25.4; } else { odVal = odVal / 25.4 } document.Vals.OD.value = Math.round(odVal*1000)/1000; if (document.Vals.units.options[0].selected == true) { hVal = hVal * 25.4; } else { hVal = hVal / 25.4 } document.Vals.height.value = Math.round(hVal*1000)/1000; if (document.Vals.units.options[0].selected == true) { h2Val = h2Val * 25.4; } else { h2Val = h2Val / 25.4 } document.Vals.height2.value = Math.round(h2Val*1000)/1000; if (document.Vals.units.options[0].selected == true) { h3Val = h3Val * 25.4; } else { h3Val = h3Val / 25.4 } document.Vals.height3.value = Math.round(h3Val*1000)/1000; if (document.Vals.units.options[0].selected == true) { csVal = csVal * 25.4; } else { csVal = csVal / 25.4 } document.Vals.cs.value = Math.round(csVal*1000)/1000; } function headerVal () { document.Vals.qNum.value = document.header.tHeaderQuote.qNumE.value; document.Vals.qDate.value = document.header.tHeaderQuote.qDateE.value; //document.Vals.qTo.value = document.header.tHeaderQuote.qToE.options[document.header.tHeaderE.qToE.selectedIndex].text; //document.Vals.attn.value = document.header.tHeaderQuote.attnE.value; //document.Vals.phone.value = document.header.tHeaderQuote.phoneE.value; //document.Vals.fax.value = document.header.tHeaderQuote.faxE.value; //document.Vals.from.value = document.header.tHeaderQuote.fromE.value; } function checkForm (sentMail) { if (document.Vals.qTo.value == "") { alert('Please select a company to quote to.'); return false; } else if (document.Vals.rowNum.value == "" || document.Vals.rowNum.value == "0") { alert('Please add at least one item to quote.'); return false; }else if (document.Vals.qNum.value == ""){ // There is no quote number $.get('quoteNumber.php', function(data) { document.Vals.qNum.value = data; }) .done(function(){ if (document.Vals.qNum.value == ""){ alert('Quote number is empty!'); return false; } else { if (sentMail==1){ submitSend(); } else { submitForm(); } } }); } else { return true; } } function calcDisc () { var newPrice = document.Vals.price.value; var origPrice = document.Vals.spCalc.value; var percent = newPrice / origPrice; document.Vals.discount.value = parseFloat(((1 - percent) * 100).toFixed(4)); calcPrice(); } function calcDiscN () { var newPrice = document.Vals.priceE.value; var origPrice = document.Vals.nspCalc.value; var percent = newPrice / origPrice; document.Vals.discount.value = parseFloat(((1 - percent) * 100).toFixed(4)); calcPrice(); } function netpChange (pLine) { if (isNaN(document.Vals.elements["netP"+pLine].value)){ document.Vals.elements["netP"+pLine].value = 0; } document.Vals.elements["totalP"+pLine].value = (document.Vals.elements["netP"+pLine].value * document.Vals.elements["qty"+pLine].value).toFixed(2); quotePrice(); currencyChange(); } function totalpChange (pLine) { document.Vals.elements["netP"+pLine].value = (document.Vals.elements["totalP"+pLine].value / document.Vals.elements["qty"+pLine].value).toFixed(2); quotePrice(); currencyChange(); }