function selectModel(pn) {
var con = pn.substr(4, 1);
var sched = pn.substr(6, 2);
var size = pn.substr(9, 3);
var disp = pn.substr(13, 2);
//alert("con ="+con);
//alert("sched ="+sched);
//alert("disp ="+disp);
//alert("size ="+size);
if (con == "P") {
selectConType('pipe');
if (size == "050") {
document.codeform.pipeSize[0].checked = true;
}
if (size == "075") {
document.codeform.pipeSize[1].checked = true;
}
if (size == "100") {
document.codeform.pipeSize[2].checked = true;
}
if (size == "150") {
document.codeform.pipeSize[3].checked = true;
}
if (size == "200") {
document.codeform.pipeSize[4].checked = true;
}
if (size == "300") {
document.codeform.pipeSize[5].checked = true;
}
if (size == "400") {
document.codeform.pipeSize[6].checked = true;
}
}
if (con == "S") {
selectConType('saddle');
if (size == "150") {
document.codeform.saddleSize[0].checked = true;
}
if (size == "200") {
document.codeform.saddleSize[1].checked = true;
}
if (size == "300") {
document.codeform.saddleSize[2].checked = true;
}
if (size == "400") {
document.codeform.saddleSize[3].checked = true;
}
if (size == "600") {
document.codeform.saddleSize[4].checked = true;
}
if (size == "800") {
document.codeform.saddleSize[5].checked = true;
}
}
if (sched == "40") {
document.codeform.sched[0].checked = true;
}
if (sched == "80") {
document.codeform.sched[1].checked = true;
}
if (disp == "PT") {
document.codeform.disp[0].checked = true;
}
if (disp == "RD") {
document.codeform.disp[1].checked = true;
var cord = pn.substr(17);
if (cord == "5FT") {
document.codeform.wire[1].checked = true;
}
if (cord == "10FT") {
document.codeform.wire[0].checked = true;
}
if (cord == "15FT") {
document.codeform.wire[2].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.connection[0].checked) {
var con = "P";
if (document.codeform.pipeSize[0].checked) {
document.getElementById('pipeSize1').className="chartRowSelected";
var siz = "050"; var sizeDescrip = "1/2 inch pipe mounted"; var flowRange = "0.6 to 15 gpm";
}
if (document.codeform.pipeSize[1].checked) {
document.getElementById('pipeSize2').className="chartRowSelected";
var siz = "075"; var sizeDescrip = "3/4 inch pipe mounted"; var flowRange = "1.5 to 30 gpm";
}
if (document.codeform.pipeSize[2].checked) {
document.getElementById('pipeSize3').className="chartRowSelected";
var siz = "100"; var sizeDescrip = "1 inch pipe mounted"; var flowRange = "5 to 55 gpm";
}
if (document.codeform.pipeSize[3].checked) {
document.getElementById('pipeSize4').className="chartRowSelected";
var siz = "150"; var sizeDescrip = "1 1/2 inch pipe mounted"; var flowRange = "10 to 125 gpm";
}
if (document.codeform.pipeSize[4].checked) {
document.getElementById('pipeSize5').className="chartRowSelected";
var siz = "200"; var sizeDescrip = "2 inch pipe mounted"; var flowRange = "15 to 200 gpm";
}
if (document.codeform.pipeSize[5].checked) {
document.getElementById('pipeSize6').className="chartRowSelected";
var siz = "300"; var sizeDescrip = "3 inch pipe mounted"; var flowRange = "40 to 450 gpm";
}
if (document.codeform.pipeSize[6].checked) {
document.getElementById('pipeSize7').className="chartRowSelected";
var siz = "400"; var sizeDescrip = "4 inch pipe mounted"; var flowRange = "60 to 800 gpm";
}
}
if (document.codeform.connection[1].checked) {
var con = "S";
if (document.codeform.saddleSize[0].checked) {
document.getElementById('saddleSize1').className="chartRowSelected";
var siz = "150"; var sizeDescrip = "1 1/2 inch saddle mount (insertion mount)"; var flowRange = "10 to 125 gpm";
}
if (document.codeform.saddleSize[1].checked) {
document.getElementById('saddleSize2').className="chartRowSelected";
var siz = "200"; var sizeDescrip = "2 inch saddle mount (insertion mount)"; var flowRange = "15 to 200 gpm";
}
if (document.codeform.saddleSize[2].checked) {
document.getElementById('saddleSize3').className="chartRowSelected";
var siz = "300"; var sizeDescrip = "3 inch saddle mount (insertion mount)"; var flowRange = "40 to 450 gpm";
}
if (document.codeform.saddleSize[3].checked) {
document.getElementById('saddleSize4').className="chartRowSelected";
var siz = "400"; var sizeDescrip = "4 inch saddle mount (insertion mount)"; var flowRange = "60 to 800 gpm";
}
if (document.codeform.saddleSize[4].checked) {
document.getElementById('saddleSize5').className="chartRowSelected";
var siz = "600"; var sizeDescrip = "6 inch saddle mount (insertion mount)"; var flowRange = "120 to 1800 gpm";
}
if (document.codeform.saddleSize[5].checked) {
document.getElementById('saddleSize6').className="chartRowSelected";
var siz = "800"; var sizeDescrip = "8 inch saddle mount (insertion mount)"; var flowRange = "250 to 3200 gpm";
}
}
//============================== Exceptions for certain sizes =====================================
if ((document.codeform.connection[0].checked) && (document.codeform.pipeSize[0].checked || document.codeform.pipeSize[1].checked || document.codeform.pipeSize[2].checked)) {
document.codeform.sched[1].checked = 1;
document.codeform.sched[0].disabled = 1;
document.getElementById('sched1').className="selectionDisabled";
}
// =================== PIPE SCHEDULE ============================
if (document.codeform.sched[0].checked) {
document.getElementById('sched1').className="selectionChecked";
var sched = "40";
}
if (document.codeform.sched[1].checked) {
document.getElementById('sched2').className="selectionChecked";
var sched = "80";
}
// ======================================================================
// =================== Display Type =====================================
if (document.codeform.disp[0].checked) {
document.getElementById('disp1').className="selectionChecked";
var dispPrice = "PT";
var disp = "PT";
var dispDescrip = "Local display";
var dispPic = "";
}
if (document.codeform.disp[1].checked) {
document.getElementById('disp2').className="selectionChecked";
var dispPrice = "RD";
var dispPic = "-RD";
if (document.codeform.wire[0].checked) {
var disp = "RD5FT";
var dispDescrip = "Remote display with 5 ft. cord";
document.getElementById('wirecell1').className="selectionChecked";
}
if (document.codeform.wire[1].checked) {
var disp = "RD10FT";
var dispDescrip = "Remote display with 10 ft. cord";
document.getElementById('wirecell2').className="selectionChecked";
}
if (document.codeform.wire[2].checked) {
var disp = "RD15FT";
var dispDescrip = "Remote display with 15 ft. cord";
document.getElementById('wirecell3').className="selectionChecked";
}
}
// ======================================================================
var step1summary = "Size & Connection: "+sizeDescrip+", Schedule "+sched;
document.getElementById('step1summary').innerHTML= step1summary;
var step1summary = step1summary + "
Pipe/Saddle & Paddle Wheel Material: PVC
Electronincs Housing Material: ABS plastic
Accuracy: +/- 1.5%
Function: Total, resettable total, and flow rate
Units: U.S. Gallons, Liters, Cubic ft.
Included Accessories: Plug";
var step2summary = "Display Type: "+dispDescrip;
document.getElementById('step2summary').innerHTML= step2summary;
// =========================================================== SET MODEL CODE =============================================
var mc="WM_PT_"+con+"_"+sched+"_"+siz+"_"+disp;
var WWMmc="WWM_"+con+"_"+sched+"_"+siz+"_"+disp;
var mcPrice="WM_PT_"+con+"_"+sched+"_"+siz+"_"+dispPrice;
var pic = "WWM-"+con+dispPic;
var fullMc = WWMmc+pulse;
var fullMc = fullMc.replace(/_/g, "-");
document.getElementById('PN').innerHTML =fullMc;
document.codeform.id.value=fullMc;
document.getElementById('MClinks').innerHTML =fullMc;
document.getElementById('mainIMG').src = "/WWM/models/"+pic+".jpg";
document.codeform.imgsrc.value="/WWM/models/"+pic+".jpg";
// =========================================================== SET PRICING =============================================
var qty = document.codeform.qty.value;
// METER =--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
var basePrice = eval(mcPrice+".price")+WM_PT_PLUG.price;
var baseWeight = eval(mcPrice+".weight");
var priceSum = priceSum + "
Meter: "+basePrice+" ("+mc+")
";
var weightSum = weightSum + "
Meter: "+baseWeight+" ("+mc+")
";
// ACCESSORIES -=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// ========================= PLUG ====================
var step3summary = "No accessories selected";
if (document.codeform.plug.checked) {
var plugDescrip = "replaces meter for performing meter cleaning, repair, or replacement";
var step3summary = "Plug: " + plugDescrip;
var accessPrice = WM_PT_PLUG.price;
var accessWeight = WM_PT_PLUG.weight;
var accessSummary = "Plug: "+ plugDescrip+" (WWM-PLUG)" ;
document.codeform.plugprice.value=WM_PT_PLUG.price;
document.codeform.plugweight.value=WM_PT_PLUG.weight;
document.codeform.plugprodseries.value="WWM";
document.codeform.plugid.value="WWM-PLUG";
}
document.getElementById('step3summary').innerHTML= step3summary;
// LABOR =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -- NO LABOR -- //
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 selectConType(type) {
document.getElementById('pipe').className="tab";
document.getElementById('saddle').className="tab";
document.getElementById(type).className="tabSelected";
document.getElementById('pipeSection').style.display="none";
document.getElementById('saddleSection').style.display="none";
document.getElementById(type+'Section').style.display="block";
if (type == "pipe") {
document.codeform.connection[0].checked = 1;
}
if (type == "saddle") {
document.codeform.connection[1].checked = 1;
}
}
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('pipeSize1').className="chartRow";
document.getElementById('pipeSize2').className="chartRow";
document.getElementById('pipeSize3').className="chartRow";
document.getElementById('pipeSize4').className="chartRow";
document.getElementById('pipeSize5').className="chartRow";
document.getElementById('pipeSize6').className="chartRow";
document.getElementById('pipeSize7').className="chartRow";
document.getElementById('saddleSize1').className="chartRow";
document.getElementById('saddleSize2').className="chartRow";
document.getElementById('saddleSize3').className="chartRow";
document.getElementById('saddleSize4').className="chartRow";
document.getElementById('saddleSize5').className="chartRow";
document.getElementById('saddleSize6').className="chartRow";
document.getElementById('sched1').className="selection";
document.getElementById('sched2').className="selection";
document.getElementById('disp1').className="selection";
document.getElementById('disp2').className="selection";
document.codeform.sched[0].disabled = 0;
document.getElementById('wirecell1').className="selection";
document.getElementById('wirecell2').className="selection";
document.getElementById('wirecell3').className="selection";
}
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";
}