function selectModel(pn) {
var postype = pn.substr(0, 2);
//alert(postype);
if (postype == "P5") {
document.codeform.pos[0].checked = 1;
var feedtype = pn.substr(3);
//alert(feedtype);
if (feedtype == "F5") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[0].checked = 1;
selectFeedType('one');
}
if (feedtype == "F5XP") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[1].checked = 1;
selectFeedType('one');
}
if (feedtype == "F5IS") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[2].checked = 1;
selectFeedType('one');
}
if (feedtype == "F5420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[3].checked = 1;
selectFeedType('two');
}
if (feedtype == "F5XP420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[4].checked = 1;
selectFeedType('two');
}
if (feedtype == "F5IS420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[5].checked = 1;
selectFeedType('two');
}
}
if (postype == "E5") {
var postype= pn.substr(0, 4);
if (pn == "E5") {
document.codeform.pos[1].checked = 1;
}
if (postype == "E5XP") {
document.codeform.pos[2].checked = 1;
}
if (postype == "E5IS") {
document.codeform.pos[3].checked = 1;
}
if (postype == "E5-F")
var feedtype = pn.substr(3);
//alert(feedtype);
if (feedtype == "-F5") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[0].checked = 1;
}
if (feedtype == "-F5XP") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[1].checked = 1;
}
if (feedtype == "-F5IS") {
document.codeform.feedback[1].checked = 1;
document.codeform.feed[2].checked = 1;
}
if (feedtype == "-F5420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[3].checked = 1;
}
if (feedtype == "-F5XP420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[4].checked = 1;
}
if (feedtype == "-F5IS420") {
document.codeform.feedback[2].checked = 1;
document.codeform.feed[5].checked = 1;
}
}
changeCode();
}
function changeCode() {
// set vars that don't change and initialize others
var pos = "";
var feed = "";
var posDescrip = "";
var feedDescrip = "none";
var accessDescrip = ""; // ----------- actuator accesories on assembly
var accessoryDescrip = ""; // ------- accesories that ship loose
var pospic = "";
var feedpic = "";
var accPrice = 0;
var priceSum = "Pricing:";
var weightSum = "Weight:";
var price = 0;
var feedPrice = 0;
var posPrice = 0;
var accPrice = 0;
var feedWeight = 0;
var posWeight = 0;
var baseWeight = 0;
var accessPrice = 0;
var accessoryPrice = 0;
var accPriceSum = "
";
var assemblyWeight = 0;
var accessWeight = 0;
var accessoryWeight = 0;
var step1summary = "";
var step1summary = "";
var step3summary = "";
var alertNote = "";
// ====================== reset classes of all selection divs and table cells to UN-selected state
resetPosDivs();
// ================= reset summary boxes ==========================
document.getElementById('priceSummary').innerHTML = "Error!";
document.getElementById('weightSummary').innerHTML = "Error!";
// ======================================================== Positioner TYPE ==================================================
if (document.codeform.pos[0].checked) {
var pospic = "P5";
var pos = "P5";
var posDescrip = "Pneumatic, using 3-15 psi control signal";
document.getElementById('pos_1').className = "selectionChecked";
}
if (document.codeform.pos[1].checked) {
var pospic = "E5";
var pos = "E5";
var posDescrip = "Electro-Pneumatic using 4-20 mA control signal; NEMA 4/4X weatherproof";
document.getElementById('pos_2').className = "selectionChecked";
document.getElementById('feed_2').className = "selectionDisabled";
document.getElementById('feed_3').className = "selectionDisabled";
if (document.codeform.feed[1].checked || document.codeform.feed[2].checked) {
document.codeform.feed[0].checked = 1;
}
document.getElementById('feed_5').className = "selectionDisabled";
document.getElementById('feed_6').className = "selectionDisabled";
if (document.codeform.feed[4].checked || document.codeform.feed[5].checked) {
document.codeform.feed[3].checked = 1;
}
}
if (document.codeform.pos[2].checked) {
var pospic = "E5";
var pos = "E5XP";
var posDescrip = "Electro-Pneumatic using 4-20 mA control signal; NEMA 7 explosion proof";
document.getElementById('pos_3').className = "selectionChecked";
document.getElementById('feed_1').className = "selectionDisabled";
document.getElementById('feed_3').className = "selectionDisabled";
if (document.codeform.feed[0].checked || document.codeform.feed[2].checked) {
document.codeform.feed[1].checked = 1;
}
document.getElementById('feed_4').className = "selectionDisabled";
document.getElementById('feed_6').className = "selectionDisabled";
if (document.codeform.feed[3].checked || document.codeform.feed[5].checked) {
document.codeform.feed[4].checked = 1;
}
}
if (document.codeform.pos[3].checked) {
var pospic = "E5";
var pos = "E5IS";
var posDescrip = "Electro-Pneumatic using 4-20 mA control signal; Intrisically safe";
document.getElementById('pos_4').className = "selectionChecked";
document.getElementById('feed_1').className = "selectionDisabled";
document.getElementById('feed_2').className = "selectionDisabled";
if (document.codeform.feed[0].checked || document.codeform.feed[1].checked) {
document.codeform.feed[2].checked = 1;
}
document.getElementById('feed_4').className = "selectionDisabled";
document.getElementById('feed_5').className = "selectionDisabled";
if (document.codeform.feed[3].checked || document.codeform.feed[4].checked) {
document.codeform.feed[5].checked = 1;
}
}
var priceSum = "Positioner: $ "+eval(pos+".price")+" ("+pos+")";
var weightSum = "Positioner: "+eval(pos+".weight")+" ("+pos+")";
// =================== Step 1 Summary =================
var posDescrip = "Positioner Type: "+posDescrip;
var step1summary = posDescrip;
document.getElementById('step1summary').innerHTML = step1summary;
// ======================================================== Feedback TYPE ==================================================
if (document.codeform.feedback[0].checked == 0) {
var feedpic = "F5";
if (document.codeform.feed[0].checked) {
var feed = "F5";
var feedDescrip = "2 SPDT mechanical switches; NEMA 4 weatherproof";
document.getElementById('feed_1').className = "selectionChecked";
}
if (document.codeform.feed[1].checked) {
var feed = "F5EX";
var feedDescrip = "2 SPDT mechanical switches; NEMA 7 explosion proof";
document.getElementById('feed_2').className = "selectionChecked";
}
if (document.codeform.feed[2].checked) {
var feed = "F5IS";
var feedDescrip = "2 SPDT mechanical switches; intrinsically safe";
document.getElementById('feed_3').className = "selectionChecked";
}
if (document.codeform.feed[3].checked) {
var feed = "F5420";
var feedDescrip = "4-20 mA output signal and 2 SPDT mechanical switches; NEMA 4 weatherproof";
document.getElementById('feed_4').className = "selectionChecked";
}
if (document.codeform.feed[4].checked) {
var feed = "F5EX420";
var feedDescrip = "4-20 mA output signal and 2 SPDT mechanical switches; NEMA 7 explosion proof";
document.getElementById('feed_5').className = "selectionChecked";
}
if (document.codeform.feed[5].checked) {
var feed = "F5IS420";
var feedDescrip = "4-20 mA output signal and 2 SPDT mechanical switches; intrinsically safe";
document.getElementById('feed_6').className = "selectionChecked";
}
var priceSum = priceSum + "
Feedback: $ "+eval(feed+".price")+" ("+feed+")";
var weightSum = weightSum + "
Feedback: "+eval(feed+".weight")+" ("+feed+")";
}
// ======================================================== SET step 2 summary ==================================================
var feedDescrip = "Feedback Unit: "+feedDescrip;
var step2summary = feedDescrip;
document.getElementById('step2summary').innerHTML = step2summary;
document.getElementById('accessPriceText').style.display="none";
// ======================================================== Accessories ==================================================
if (document.codeform.fitCHECK.checked) {
if (document.codeform.fit[0].checked) {
document.codeform.fitinfo.value = eval('FIT_NPTFITKITPOS["siz_descrip"]');
document.codeform.fitid.value = 'NPTFITKITPOS';
document.codeform.fitprodseries.value = 'for Part No. '+mc;
document.codeform.fitprodname.value = 'NPT_STRAIGHT_FITTING_KIT_FOR_POSITIONER';
document.codeform.fitprice.value = eval('FIT_NPTFITKITPOS["price"]');
document.codeform.fitweight.value = eval('FIT_NPTFITKITPOS["weight"]');
accPrice = accPrice + eval('FIT_NPTFITKITPOS["price"]');
accPriceSum = accPriceSum+"Fittings:"+accPrice;
accessoryDescrip = "Fittings: (2x) straight 1/2 in. x 1/4 tube push fittings and (1x) bug vent";
}
if (document.codeform.fit[1].checked) {
document.codeform.fitinfo.value = eval('FIT_NPTFITKITPOS90["siz_descrip"]');
document.codeform.fitid.value = 'FIT_NPTFITKITPOS90';
document.codeform.fitprodseries.value = 'for Part No. '+mc;
document.codeform.fitprodname.value = 'NPT_90_FITTING_KIT_FOR_POSITIONER';
document.codeform.fitprice.value = eval('FIT_NPTFITKITPOS90["price"]');
document.codeform.fitweight.value = eval('FIT_NPTFITKITPOS90["weight"]');
accPrice = accPrice + eval('FIT_NPTFITKITPOS90["price"]');
accPriceSum = accPriceSum+"Fittings:"+accPrice;
accessoryDescrip = "Fittings: (2x) 90 degree 1/2 in. x 1/4 tube push fittings and (1x) bug vent";
}
}
if (document.codeform.mountCHECK.checked) {
document.codeform.mountinfo.value = eval('POS_EUMBHV803020["siz_descrip"]');
document.codeform.mountid.value = 'EUMBHV803020';
document.codeform.mountprodseries.value = 'for Part No. '+mc;
document.codeform.mountprodname.value = 'MOUNTING_KIT_FOR_POSITIONER';
document.codeform.mountprice.value = eval('POS_EUMBHV803020["price"]');
document.codeform.mountweight.value = eval('POS_EUMBHV803020["weight"]');
accPrice = accPrice + eval('POS_EUMBHV803020["price"]');
accPriceSum = accPriceSum+"
Mounting Bracket:"+eval('POS_EUMBHV803020["price"]');
accessoryDescrip = accessoryDescrip + "
Mounting Bracket: NAMUR size 1/2/3 stainless steel mounting bracket";
}
if (document.codeform.regCHECK.checked) {
document.codeform.reginfo.value = eval('REG["siz_descrip"]');
document.codeform.regid.value = 'AS34204179';
document.codeform.regprodseries.value = 'for Part No. '+mc;
document.codeform.regprodname.value = 'REGULATOR_FOR_POSITIONER';
document.codeform.regprice.value = eval('REG["price"]');
document.codeform.regweight.value = eval('REG["weight"]');
accPrice = accPrice + eval('REG["price"]');
accPriceSum = accPriceSum+"
Regulator:"+eval('REG["price"]');
accessoryDescrip = accessoryDescrip + "
Regulator: 1/4" NPT Air filter/regulator with Gauge";
}
if (document.codeform.gaugeCHECK.checked) {
document.codeform.gaugeinfo.value = eval('gauge["siz_descrip"]');
document.codeform.gaugeid.value = 'P5_GAUGEKIT';
document.codeform.gaugeprodseries.value = 'for Part No. '+mc;
document.codeform.gaugeprodname.value = 'GAUGE_KIT_FOR_POSITIONER';
document.codeform.gaugeprice.value = eval('gauge["price"]');
document.codeform.gaugeweight.value = eval('gauge["weight"]');
accPrice = accPrice + eval('gauge["price"]');
accPriceSum = accPriceSum+"
Gauges:"+eval('gauge["price"]');
accessoryDescrip = accessoryDescrip + "
Gauges: (3x) 1/8" NPT gauges";
}
if (accessoryDescrip != "") {
document.getElementById('accessPriceText').style.display="";
document.getElementById('accessSummary').innerHTML = accessoryDescrip;
document.getElementById('accessPrice').innerHTML=accPrice;
}
// =========================================================== SET MODEL CODE =============================================
var pic = pospic + feedpic;
var mc= pos;
if (feed != "") {
var mc= pos +"-"+ feed;
}
document.getElementById('PN').innerHTML =mc;
document.codeform.id.value=mc;
document.getElementById('MClinks').innerHTML =mc;
document.getElementById('mainIMG').src = "/valve-positioners/models/"+pic+".jpg";
document.codeform.imgsrc.value="/valve-positioners/models/"+pic+".jpg";
// document.codeform.CADmc.value=CADmc;
// =========================================================== SET PRICING =============================================
var qty = document.codeform.qty.value;
// -=-=-=-=-=-=-=- Positioner -=-=-=-=-=-=-=-=-=-=-
var posPrice = eval(pos+".price");
var posWeight = eval(pos+".weight");
// -=-=-=-=-=-=-=- Feedback Unit -=-=-=-=-=-=-=-=-=-=-
if (feed != "") {
var feedPrice = eval(feed+".price");
var feedWeight = eval(feed+".weight");
}
// LABOR =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
var fullPrice = Math.ceil(posPrice + feedPrice);
var fullWeight = Math.ceil(posWeight + feedWeight);
document.getElementById('price').innerHTML = fullPrice;
document.codeform.price.value=fullPrice;
document.codeform.weight.value=fullWeight;
if (accPriceSum != "
") {
var priceSum = priceSum + accPriceSum;
}
document.getElementById('priceSummary').innerHTML = priceSum+"
TOTAL: $ "+fullPrice;
if (accPrice != 0) {
document.getElementById('priceSummary').innerHTML = priceSum+"
TOTAL: $ "+fullPrice +" (+ "+accPrice+" accessories) = $"+(fullPrice+accPrice);
}
document.getElementById('weightSummary').innerHTML = weightSum+"
TOTAL: "+fullWeight+" lbs.";
var totalPrice = (fullPrice + accPrice) * qty;
document.getElementById('totalPrice').innerHTML = totalPrice;
// =========================================================== SET DESCRIPTION =============================================
var fullSummary = step1summary+"
"+step2summary;
if (alertNote != "") {
// alert(alertNote+ 'oooooops');
var fullSummary = fullSummary + "
" + alertNote;
}
document.getElementById('fullSummary').innerHTML = fullSummary;
document.codeform.info.value=fullSummary;
}
// ========================================================== END OF MAIN FUNCTION ============================================================
// ============================================================= OTHER FUNCTIONS =========================================================
function addToCart() {
document.codeform.submit();
}
function selectFeedType(type) {
document.getElementById('no').className="tab";
document.getElementById('one').className="tab";
document.getElementById('two').className="tab";
document.getElementById(type).className="tabSelected";
document.getElementById('noSection').style.display="none";
document.getElementById('oneSection').style.display="none";
document.getElementById('twoSection').style.display="none";
document.getElementById(type+'Section').style.display="block";
if (type == "two") {
if (document.codeform.feed[0].checked) {
document.codeform.feed[3].checked = 1;
}
if (document.codeform.feed[1].checked) {
document.codeform.feed[4].checked = 1;
}
if (document.codeform.feed[2].checked) {
document.codeform.feed[5].checked = 1;
}
}
if (type == "one") {
if (document.codeform.feed[3].checked) {
document.codeform.feed[0].checked = 1;
}
if (document.codeform.feed[4].checked) {
document.codeform.feed[1].checked = 1;
}
if (document.codeform.feed[5].checked) {
document.codeform.feed[2].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+"CHECK").checked = 1;
} else {
document.getElementById(item+"BOX").style.display = "none";
document.getElementById(item+"HEAD").className = "accessHead";
document.getElementById(item+"CHECK").checked = 0;
}
}
function resetPosDivs() {
document.getElementById('pos_1').className="selection";
document.getElementById('pos_2').className="selection";
document.getElementById('pos_3').className="selection";
document.getElementById('pos_4').className="selection";
document.getElementById('feed_1').className="selection";
document.getElementById('feed_2').className="selection";
document.getElementById('feed_3').className="selection";
document.getElementById('feed_4').className="selection";
document.getElementById('feed_5').className="selection";
document.getElementById('feed_6').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";
}