function selectModel(pn) {
var size = pn.substr(5, 3);
//alert(size);
if (size == "025") {
document.codeform.nptSize[0].checked = true;
}
if (size == "050") {
document.codeform.nptSize[1].checked = true;
}
if (size == "075") {
document.codeform.nptSize[2].checked = true;
}
if (size == "100") {
document.codeform.nptSize[3].checked = true;
}
var GHA = pn.substr(8);
//alert(PO);
if (GHA == "-GHA") {
document.codeform.gha.checked = true;
}
}
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();
// ================= 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 = "025"; var sizeDescrip = "1/4 inch NPT (male)"; var flowRange = "5.22 to 105 gph";
var CVmodel = "A112CVLFN";
}
if (document.codeform.nptSize[1].checked) {
document.getElementById('nptSize2').className="chartRowSelected";
var siz = "050"; var sizeDescrip = "1/2 inch NPT (male)"; var flowRange = "19.2 to 395 gph";
var CVmodel = "C112CVLFN";
var ghaModel = "WMGHA050";
}
if (document.codeform.nptSize[2].checked) {
document.getElementById('nptSize3').className="chartRowSelected";
var siz = "075"; var sizeDescrip = "3/4 inch NPT (male)"; var flowRange = "1 to 22 gpm";
var CVmodel = "D112CVLFN";
var ghaModel = "WMGHA075";
}
if (document.codeform.nptSize[3].checked) {
document.getElementById('nptSize4').className="chartRowSelected";
var siz = "100"; var sizeDescrip = "1 inch NPT (male)"; var flowRange = "1.75 to 365 gpm";
var CVmodel = "E112CVLFN";
}
var step1summary = "Size & Connection: "+sizeDescrip+"
Housing Material: Plastic Pa66 + GF/PPS
Flow Range: "+flowRange+"
Accuracy: +/- 1% Full Scale
Function: Rate, total, and batch total
Units: U.S. Gallons, Pints, Quarts, Liters";
//============================ SET Available Accessories based on size selected ================================
//==================== 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
if (siz == "025") {
if (document.codeform.cv.checked) { document.codeform.cv.checked=0; }
document.getElementById('cvHEAD').style.display = "none";
document.getElementById('cvHEAD').className = "accessHead";
document.getElementById('cvBOX').style.display = "none";
document.getElementById('cvNA').style.display = "";
} else {
document.getElementById('cvHEAD').style.display = "";
if (document.codeform.cv.checked) {
document.getElementById('cvBOX').style.display = "";
}
document.getElementById('cvNA').style.display = "none";
}
// =========================================================== ACCESSORIES =============================================
document.getElementById('step1summary').innerHTML= step1summary;
// ========================= 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_PC_"+siz;
document.codeform.CHECKid.value=CVmodel;
var step2summary = 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_PC_"+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="DM_P_"+siz;
var pic = "DM-P";
var fullMc = mc;
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 = "/DM-P/models/"+pic+".jpg";
document.codeform.imgsrc.value="/DM-P/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 -=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//================= 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 = accessPrice + cvPrice;
var accessWeight = accessWeight + cvWeight;
var accessSummary = 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;
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";
}
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";
}