function selectModel(pn) { var switches = pn.substr(2, 2); var lamps = pn.substr(5, 2); //alert(switches); //alert(lamps); if (switches == "S1") { document.codeform.switches[0].checked = 1; } if (switches == "S3") { document.codeform.switches[1].checked = 1; } if (lamps == "OG") { document.codeform.lamps[0].checked = 1; } if (lamps == "OR") { document.codeform.lamps[1].checked = 1; } changeCode(); } function changeCode() { // set vars that don't change and initialize others var switches = ""; var lamp = ""; var switchDescrip = ""; var lampDescrip = ""; // ====================== reset classes of all selection divs and table cells to UN-selected state resetDivs(); // ================= reset summary boxes ========================== document.getElementById('priceSummary').innerHTML = "Error!"; document.getElementById('weightSummary').innerHTML = "Error!"; // ================================================ SWITCHES ==================================================== if (document.codeform.switches[0].checked) { document.getElementById('switch1').className="selectionChecked"; var switches = "S1"; var switchDescrip = "2-position; OPEN / CLOSE"; } if (document.codeform.switches[1].checked) { document.getElementById('switch2').className="selectionChecked"; var switches = "S3"; var switchDescrip = "3-position; OPEN / STOP / CLOSE";} // ================================================ LAMPS ==================================================== if (document.codeform.lamps[0].checked) { document.getElementById('lamps1').className="selectionChecked"; var lamp = "OG"; var lampDescrip = "Green = Open (left); RED = Closed (right)"; } if (document.codeform.lamps[1].checked) { document.getElementById('lamps2').className="selectionChecked"; var lamp = "OR"; var lampDescrip = "Red = Open (left); Green = Closed (right)"; } // ================================================ DESCRIPTION ==================================================== var enclosureDescrip = "Enclosure: Weatherproof 3-hole (NEMA 1, 4X, 12, 13)"; var switchDescrip = "Switch: "+switchDescrip; var lampDescrip = "Lamps: "+lampDescrip; var step1summary = enclosureDescrip + "
" + switchDescrip + "
" + lampDescrip; document.getElementById('step1summary').innerHTML = step1summary; // =========================================================== SET MODEL CODE ============================================= var mc="CB"+switches+"-"+lamp; var mcPrice="CB"+switches+"-OG"; var pic = "CB-"+switches+"-"+lamp; document.getElementById('PN').innerHTML =mc; document.codeform.id.value=mc; document.getElementById('MClinks').innerHTML =mc; document.getElementById('mainIMG').src = "/CB/models/"+pic+".jpg"; document.codeform.imgsrc.value="/CB/models/"+pic+".jpg"; // =========================================================== SET PRICING ============================================= var qty = document.codeform.qty.value; var PriceMC = mcPrice.replace(/-/g, "_"); var basePrice = (eval(PriceMC+".price")); var baseWeight = eval(PriceMC+".weight"); var priceSum = "Price: "+basePrice+" ("+mc+")"; var weightSum = "Weight: "+baseWeight+" ("+mc+")"; // LABOR =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= var fullPrice = Math.ceil(basePrice); var fullWeight = Math.ceil(baseWeight); document.getElementById('price').innerHTML = fullPrice; document.codeform.price.value=fullPrice; document.codeform.weight.value=fullWeight; document.getElementById('priceSummary').innerHTML = priceSum; document.getElementById('weightSummary').innerHTML = weightSum+"
TOTAL: "+fullWeight+" lbs."; var totalPrice = fullPrice * qty; document.getElementById('totalPrice').innerHTML = totalPrice; // =========================================================== SET DESCRIPTION ============================================= var fullSummary = step1summary; document.getElementById('fullSummary').innerHTML = fullSummary; document.codeform.info.value=fullSummary; } // ========================================================== END OF MAIN FUNCTION ============================================================ // ============================================================= OTHER FUNCTIONS ========================================================= function addToCart() { document.codeform.submit(); } 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 resetDivs() { document.getElementById('switch1').className="selection"; document.getElementById('switch2').className="selection"; document.getElementById('lamps1').className="selection"; document.getElementById('lamps2').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"; } function showInfo(what) { if (document.getElementById(what).style.display != "none") { document.getElementById(what).style.display = "none"; document.getElementById("specsBut").className = "infoTab"; document.getElementById("descripBut").className = "infoTab"; } else { if (what == "description") { document.getElementById("specs").style.display = "none"; document.getElementById("description").style.display = "block"; document.getElementById("descripBut").className = "infoTabSelected"; document.getElementById("specsBut").className = "infoTab"; } else { document.getElementById("specs").style.display = "block"; document.getElementById("description").style.display = "none"; document.getElementById("specsBut").className = "infoTabSelected"; document.getElementById("descripBut").className = "infoTab"; } } }