function selectModel(pn) {
var size = pn.substr(8, 3);
//alert(size);
if (size == "050") {
document.codeform.nptSize[0].checked = true;
}
if (size == "075") {
document.codeform.nptSize[1].checked = true;
}
if (size == "100") {
document.codeform.nptSize[2].checked = true;
}
if (size == "150") {
document.codeform.nptSize[3].checked = true;
}
if (size == "200") {
document.codeform.nptSize[4].checked = true;
}
var PO = pn.substr(11);
//alert(PO);
if (PO == "-R/1P") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[0].checked = true;
showHideAccess('pulse');
}
if (PO == "-R/2P") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[1].checked = true;
showHideAccess('pulse');
}
if (PO == "-R/10P") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[2].checked = true;
showHideAccess('pulse');
}
if (PO == "-R/20P") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[3].checked = true;
showHideAccess('pulse');
}
if (PO == "-R/10G") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[4].checked = true;
showHideAccess('pulse');}
if (PO == "-R/5G") {
document.codeform.pulse.checked = true;
document.codeform.pulseOpt[5].checked = true;
showHideAccess('pulse');
}
}
function changeCode() {
// set vars that don't change and initialize others
var bodyMatDescrip = "Body Material: Stainless Steel";
var sizeDescrip = "";
var flowRange = "";
var accessDescrip = "";
var pulseModel = "";
var siz = "";
var pulse = "";
var ghaPrice = 0;
var pic = "";
var accPrice = 0;
var priceSum = "Pricing:";
var weightSum = "Weight:";
var price = 0;
var accessPrice = 0;
var assemblyWeight = 0;
var accessWeight = 0;
var accessSummary = "";
var step1summary = "";
var step2summary = "";
var step3summary = "";
// ====================== reset classes of all selection divs and table cells to UN-selected state
resetSizeDivs();
resetPulseDivs();
// ================= reset summary boxes ==========================
document.getElementById('priceSummary').innerHTML = "Error!";
document.getElementById('weightSummary').innerHTML = "Error!";
// ================================================ SIZE & CONNECTION ====================================================
if (document.codeform.nptSize[0].checked) {
document.getElementById('nptSize1').className="chartRowSelected";
var siz = "050"; var sizeDescrip = "1/2 inch NPT"; var flowRange = "1 - 20 gpm";
var CVmodel = "C112CVLFN";
var ghaModel = "WMGHA050";
}
if (document.codeform.nptSize[1].checked) {
document.getElementById('nptSize2').className="chartRowSelected";
var siz = "075"; var sizeDescrip = "3/4 inch NPT"; var flowRange = "1 - 20 gpm";
var CVmodel = "D112CVLFN";
var ghaModel = "WMGHA075";
}
if (document.codeform.nptSize[2].checked) {
document.getElementById('nptSize3').className="chartRowSelected";
var siz = "100"; var sizeDescrip = "1 inch NPT"; var flowRange = "3 - 30 gpm";
var CVmodel = "E112CVLFN";
}
if (document.codeform.nptSize[3].checked) {
document.getElementById('nptSize4').className="chartRowSelected";
var siz = "150"; var sizeDescrip = "1 1/2 inch NPT"; var flowRange = "5 - 75 gpm";
var CVmodel = "G112CVLFN";
}
if (document.codeform.nptSize[4].checked) {
document.getElementById('nptSize5').className="chartRowSelected";
var siz = "200"; var sizeDescrip = "2 inch NPT"; var flowRange = "8 - 120 gpm";
var CVmodel = "H112CVLFN";
}
var step1summary = "Size & Connection: "+sizeDescrip+"
Housing Material: Lead Free Brass
Flow Range: "+flowRange+"
Accuracy: +/- 1.5%
Function: Totalizer only
Units: U.S. Gallons";
//============================ SET Available Accessories based on size selected ================================
//==================== Pulse Output
if (document.codeform.pulse.checked) { // ---- only need to do this if the box is checked
if (siz == "050") {
if (document.codeform.pulseOpt[2].checked || document.codeform.pulseOpt[4].checked) { document.codeform.pulseOpt[0].checked = true; }
if (document.codeform.pulseOpt[3].checked || document.codeform.pulseOpt[5].checked) { document.codeform.pulseOpt[1].checked = true; }
document.codeform.pulseOpt[2].disabled=true;
document.codeform.pulseOpt[3].disabled=true;
document.codeform.pulseOpt[4].disabled=true;
document.codeform.pulseOpt[5].disabled=true;
document.getElementById('pulse3').className = "selectionDisabled";
document.getElementById('pulse4').className = "selectionDisabled";
document.getElementById('pulse5').className = "selectionDisabled";
document.getElementById('pulse6').className = "selectionDisabled";
}
if (siz == "075" || siz == "100") {
if (document.codeform.pulseOpt[4].checked) { document.codeform.pulseOpt[0].checked = true; }
if (document.codeform.pulseOpt[5].checked) { document.codeform.pulseOpt[1].checked = true; }
document.codeform.pulseOpt[4].disabled=true;
document.codeform.pulseOpt[5].disabled=true;
document.getElementById('pulse5').className = "selectionDisabled";
document.getElementById('pulse6').className = "selectionDisabled";
}
if (siz == "150" || siz == "200") {
if (document.codeform.pulseOpt[0].checked) { document.codeform.pulseOpt[4].checked = true; }
if (document.codeform.pulseOpt[1].checked) { document.codeform.pulseOpt[5].checked = true; }
if (document.codeform.pulseOpt[2].checked) { document.codeform.pulseOpt[4].checked = true; }
if (document.codeform.pulseOpt[3].checked) { document.codeform.pulseOpt[5].checked = true; }
document.codeform.pulseOpt[0].disabled=true;
document.codeform.pulseOpt[1].disabled=true;
document.codeform.pulseOpt[2].disabled=true;
document.codeform.pulseOpt[3].disabled=true;
document.getElementById('pulse1').className = "selectionDisabled";
document.getElementById('pulse2').className = "selectionDisabled";
document.getElementById('pulse3').className = "selectionDisabled";
document.getElementById('pulse4').className = "selectionDisabled";
}
}
//==================== GHA Only 1/2 and 3/4 =========
if (siz != "050" && siz != "075") {
document.codeform.gha.checked = false;
document.getElementById('ghaHEAD').style.display = "none";
document.getElementById('ghaHEAD').className = "accessHead";
document.getElementById('ghaBOX').style.display = "none";
document.getElementById('ghaNA').style.display = "";
} else {
document.getElementById('ghaHEAD').style.display = "";
if (document.codeform.gha.checked) {
document.getElementById('ghaBOX').style.display = "";
}
document.getElementById('ghaNA').style.display = "none";
}
//==================== Check Valve nothing to do - all models have check valves available
// =========================================================== ACCESSORIES =============================================
// ========================= PULSE OUTPUT ====================
if (document.codeform.pulse.checked) {
if (document.codeform.pulseOpt[0].checked) {
document.getElementById('pulse1').className="selectionChecked";
var pulse = "_R/1P";
var pulseModel = "WM_C_SRS";
var pulseDescrip = "1 pulse per Gallon";
}
if (document.codeform.pulseOpt[1].checked) {
document.getElementById('pulse2').className="selectionChecked";
var pulse = "_R/2P";
var pulseModel = "WM_C_DRS";
var pulseDescrip = "2 pulses per Gallon";
}
if (document.codeform.pulseOpt[2].checked) {
document.getElementById('pulse3').className="selectionChecked";
var pulse = "_R/10P";
var pulseModel = "WM_C_SRS";
var pulseDescrip = "10 pulses per Gallon";
}
if (document.codeform.pulseOpt[3].checked) {
document.getElementById('pulse4').className="selectionChecked";
var pulse = "_R/20P";
var pulseModel = "WM_C_DRS";
var pulseDescrip = "20 pulses per Gallon";
}
if (document.codeform.pulseOpt[4].checked) {
document.getElementById('pulse5').className="selectionChecked";
var pulse = "_R/10G";
var pulseModel = "WM_C_SRS";
var pulseDescrip = "1 pulses per 10 Gallons";
}
if (document.codeform.pulseOpt[5].checked) {
document.getElementById('pulse6').className="selectionChecked";
var pulse = "-R/5G";
var pulseModel = "WM_C_DRS";
var pulseDescrip = "1 pulses per 5 Gallons";
}
var step1summary = step1summary + "
Pulse Output: Dry Contact Reed Switch, "+pulseDescrip+" ($"+eval(pulseModel+".price")+")
";
}
document.getElementById('step1summary').innerHTML= step1summary;
// ========================= DIGITAL PULSE COUNTER ====================
document.getElementById('counterTYPE_1').className = "selection";
document.getElementById('counterTYPE_2').className = "selection";
document.getElementById('counterTYPE_3').className = "selection";
if (document.codeform.counter.checked && document.codeform.pulse.checked) {
if (document.codeform.counterType[0].checked) {
document.getElementById('counterTYPE_1').className = "selectionChecked";
document.codeform.COUNTERprice.value=KAL_D06.price;
document.codeform.COUNTERweight.value=KAL_D06.weight;
document.codeform.COUNTERprodseries.value="WM-PC-"+siz;
document.codeform.COUNTERid.value="KAL-D06";
document.codeform.COUNTERinfo.value="digital pulse counter";
var step2summary = "Digital Pulse Counter: KAL-D06 digital pulse counter ($"+KAL_D06.price+")
";
}
if (document.codeform.counterType[1].checked) {
document.getElementById('counterTYPE_2').className = "selectionChecked";
document.codeform.COUNTERprice.value=KAL_D06_DIN32_ENC.price;
document.codeform.COUNTERweight.value=KAL_D06_DIN32_ENC.weight;
document.codeform.COUNTERprodseries.value="WM-PC-"+siz;
document.codeform.COUNTERid.value="KAL-D06-DIN32-ENC";
document.codeform.COUNTERinfo.value="digital pulse counter in NEMA 4 weatherproof enclosure";
var step2summary = "Digital Pulse Counter: KAL-D06 digital pulse counter in NEMA 4 weatherproof enclosure ($"+KAL_D06_DIN32_ENC.price+")
";
}
if (document.codeform.counterType[2].checked) {
document.getElementById('counterTYPE_3').className = "selectionChecked";
document.codeform.COUNTERprice.value=LOCK_KAL_D06.price;
document.codeform.COUNTERweight.value=LOCK_KAL_D06.weight;
document.codeform.COUNTERprodseries.value="WM-PC-"+siz;
document.codeform.COUNTERid.value="LOCK_KAL_D06";
document.codeform.COUNTERinfo.value="NEMA 4 weatherproof digital pulse counter";
var step2summary = "Digital Pulse Counter: LOCK-KAL-D06 weatherproof digital pulse counter ($"+LOCK_KAL_D06.price+")
";
}
}
// ========================= CHECK VALVES ====================
if (document.codeform.cv.checked) {
document.codeform.CHECKprice.value=eval(CVmodel+".price");
document.codeform.CHECKweight.value=eval(CVmodel+".weight");
document.codeform.CHECKprodseries.value="WM_NLCH_"+siz;
document.codeform.CHECKid.value=CVmodel;
var step2summary = "Check Valve: Lead Free Brass check valve ($"+eval(CVmodel+".price")+")
";
}
// ========================= Garden Hose Adapter ====================
if (document.codeform.gha.checked) {
document.codeform.GHAprice.value=eval(ghaModel+".price");
document.codeform.GHAweight.value=eval(ghaModel+".weight");
document.codeform.GHAprodseries.value="WM_NLCH_"+siz;
document.codeform.GHAid.value=ghaModel;
var step2summary = step2summary +"Garden Hose Adapters: (1) FNPT x MGHT, (1) FNPT x FGHT ($"+eval(ghaModel+".price")+")
";
}
document.getElementById('step2summary').innerHTML= step2summary;
// =========================================================== SET MODEL CODE =============================================
var mc="WM_NLCH_"+siz;
var pic = "WM-NLC";
var fullMc = mc+pulse;
var fullMc = fullMc.replace(/_/g, "-");
document.getElementById('PN').innerHTML =fullMc;
document.codeform.id.value=fullMc;
document.getElementById('MClinks').innerHTML = fullMc; //mc+pulse;
document.getElementById('mainIMG').src = "/WM-NLCH/models/"+pic+".jpg";
document.codeform.imgsrc.value="/WM-NLCH/models/"+pic+".jpg";
// =========================================================== SET PRICING =============================================
var qty = document.codeform.qty.value;
// METER =--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
var basePrice = eval(mc+".price");
var baseWeight = eval(mc+".weight");
var priceSum = priceSum + "
Meter: "+basePrice+" ("+mc+")
";
var weightSum = weightSum + "
Meter: "+baseWeight+" ("+mc+")
";
// ACCESSORIES -=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//================= PULSE COUNTER ==============
if(document.codeform.counter.checked && document.codeform.pulse.checked) {
if (document.codeform.counterType[0].checked) {
var counterPrice = KAL_D06.price;
var counterWeight = KAL_D06.weight;
var priceSum = priceSum + "
Pulse Counter: "+counterPrice+" (KAL-D06)
";
var weightSum = weightSum + "
Pulse Counter: "+counterWeight+" (KAL-D06)
";
var accessPrice = counterPrice;
var accessWeight = counterWeight;
var accessSummary = "Digital Pulse Counter: KAL-D06 digital pulse counter ($"+counterPrice+")
";
}
if (document.codeform.counterType[1].checked) {
var counterPrice = KAL_D06_DIN32_ENC.price;
var counterWeight = KAL_D06_DIN32_ENC.weight;
var priceSum = priceSum + "
Pulse Counter: "+counterPrice+" (KAL-D06-DIN32-ENC)
";
var weightSum = weightSum + "
Pulse Counter: "+counterWeight+" (KAL-D06-DIN32-ENC)
";
var accessPrice = counterPrice;
var accessWeight = counterWeight;
var accessSummary = "Digital Pulse Counter: KAL-D06-DIN32-ENC digital pulse counter in NEMA 4 weatherproof enclosure ($"+counterPrice+")
";
}
if (document.codeform.counterType[2].checked) {
var counterPrice = LOCK_KAL_D06.price;
var counterWeight = LOCK_KAL_D06.weight;
var priceSum = priceSum + "
Pulse Counter: "+counterPrice+" (LOCK-KAL-D06)
";
var weightSum = weightSum + "
Pulse Counter: "+counterWeight+" (LOCK-KAL-D06)
";
var accessPrice = counterPrice;
var accessWeight = counterWeight;
var accessSummary = "Digital Pulse Counter: NEMA 4 weatherproof LOCK-KAL-D06 digital pulse counter ($"+counterPrice+")
";
}
}
//================= PULSE OUTPUT ==============
if (pulseModel !="") {
var pulsePrice= eval(pulseModel+".price");
var pulseWeight=eval(pulseModel+".weight");
var priceSum = priceSum + "
Pulse Output Switch: "+pulsePrice+" ("+pulseModel+")";
var weightSum = weightSum + "
Pulse Output Switch: "+pulseWeight+" ("+pulseModel+")";
var basePrice = basePrice + pulsePrice;
}
//================= CHECK VALVE ===================
if(document.codeform.cv.checked) {
var cvPrice= eval(CVmodel+".price");
var cvWeight=eval(CVmodel+".weight");
var priceSum = priceSum + "
Check Valve: "+cvPrice+" ("+CVmodel+")
";
var weightSum = weightSum + "
Check Valve: "+cvWeight+" ("+CVmodel+")
";
var accessPrice = cvPrice;
var accessWeight = cvWeight;
var accessSummary = "Check Valve: Lead free brass check valve($"+cvPrice+")
";
}
//================= GHA ===================
if(document.codeform.gha.checked) {
var ghaPrice= eval(ghaModel+".price");
var ghaWeight=eval(ghaModel+".weight");
var priceSum = priceSum + "
GHA: "+ghaPrice+" ("+ghaModel+")
";
var weightSum = weightSum + "
GHA: "+ghaWeight+" ("+ghaModel+")
";
var accessPrice = accessPrice + ghaPrice;
var accessWeight = accessWeight + ghaWeight;
var accessSummary = accessSummary + "Garden Hose Adapter Set: (1) FNPT x MGHT, (1) FNPT x FGHT ($"+ghaPrice+")";
}
// LABOR =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -- NO LABOR -- //
//alert(priceSum);
var fullPrice = Math.ceil(basePrice) //+ Math.ceil(accessPrice);
var fullWeight = Math.ceil(baseWeight) //+ Math.ceil(accessWeight);
document.getElementById('price').innerHTML = fullPrice;
document.codeform.price.value=fullPrice;
document.getElementById('priceSummary').innerHTML = priceSum+"
TOTAL: $"+fullPrice;
document.getElementById('weightSummary').innerHTML = weightSum+"
TOTAL: "+fullWeight+" lbs.";
document.codeform.weight.value=fullWeight;
var totalPrice = (fullPrice + accessPrice) * qty;
document.getElementById('totalPrice').innerHTML = totalPrice;
// =========================================================== SET DESCRIPTION =============================================
var fullSummary = step1summary; // + "
" + step2summary + "
" + step3summary;
/*
if (siz == '200') {
var fullSummary = fullSummary + "
NOTE: 2 inch meters are special order. Allow up to 12 weeks for delivery.";
}
*/
document.getElementById('fullSummary').innerHTML = fullSummary;
document.codeform.info.value=fullSummary;
if (accessPrice != 0) {
document.getElementById('accessPriceText').style.display="block";
document.getElementById('accessPrice').innerHTML=accessPrice;
document.getElementById('accessSummary').innerHTML=accessSummary;
} else {
document.getElementById('accessPriceText').style.display="none";
}
}
// ========================================================== END OF MAIN FUNCTION ============================================================
// ============================================================= OTHER FUNCTIONS =========================================================
function addToCart() {
document.codeform.submit();
//alert ('not quite yet... need to add in pricing');
}
function showHideAccess(item) {
if (document.getElementById(item+"BOX").style.display == "none") {
document.getElementById(item+"BOX").style.display = "block";
document.getElementById(item+"HEAD").className = "accessHeadOpen";
document.getElementById(item).checked = 1;
} else {
document.getElementById(item+"BOX").style.display = "none";
document.getElementById(item+"HEAD").className = "accessHead";
document.getElementById(item).checked = 0;
}
}
function resetSizeDivs() {
document.getElementById('nptSize1').className="chartRow";
document.getElementById('nptSize2').className="chartRow";
document.getElementById('nptSize3').className="chartRow";
document.getElementById('nptSize4').className="chartRow";
document.getElementById('nptSize5').className="chartRow";
}
function resetPulseDivs() {
document.getElementById('pulse1').className="selection";
document.getElementById('pulse2').className="selection";
document.getElementById('pulse3').className="selection";
document.getElementById('pulse4').className="selection";
document.getElementById('pulse5').className="selection";
document.getElementById('pulse6').className="selection";
document.codeform.pulseOpt[0].disabled=false;
document.codeform.pulseOpt[1].disabled=false;
document.codeform.pulseOpt[2].disabled=false;
document.codeform.pulseOpt[3].disabled=false;
document.codeform.pulseOpt[4].disabled=false;
document.codeform.pulseOpt[5].disabled=false;
}
function closeStep(step) {
document.getElementById('step'+step+'close').style.display="none";
document.getElementById('step'+step+'edit').style.display="block";
document.getElementById('step'+step+'section').style.display="none";
document.getElementById('step'+step+'summary').style.display="block";
}
function editStep(step) {
document.getElementById('step'+step+'close').style.display="block";
document.getElementById('step'+step+'edit').style.display="none";
document.getElementById('step'+step+'section').style.display="block";
document.getElementById('step'+step+'summary').style.display="none";
}