function changeCode(pushed){
// clear variables
var weight = 0;
var mc = "";
var err = "";
var ser = "";
var psi = "";
var price = "";
var baseweight = 0;
var baseprice = 0;
var basedescrip = "";
var actweight = 0;
var actprice = 0;
var actdescrip = "";
var actmod = "";
var actvoltage = "";
var failpos = "";
var mountprice = 0;
var mountweight = 0;
var solprice = 0;
var limprice = 0;
var solweight = 0;
var limweight = 0;
var siz = "";
var pos = "";
var pospic = "";
var solpic = "";
var nqs = "no";
var infotext = "";
var mtg = "";
var bod = "";
var bodmat = "";
var sizedescrip = "";
var condescrip = "";
var infoflo = "";
var seatmat = "";
var sealmat = "";
var serdescrip = "";
var soldescrip = "";
var solvoltage = "";
var limdescrip = "";
var posdescrip = "";
var posprice = 0;
var posweight = 0;
var limdescrip = "";
var pact = "";
var sol = "";
var lim = "";
var limpic = "";
var solt = "";
var solc = "";
var solv = "";
var brackauto = "N";
document.codeform.price.value = "";
// get all user selections
if (document.codeform.size[0].checked) {var siz = "E"; var ser = "2";var con = "1"; var sizedescrip = "1 inch"};
if (document.codeform.size[1].checked) {var siz = "G"; var ser = "2";var con = "1"; var sizedescrip = "1-1/2 inch"};
if (document.codeform.size[2].checked) {var siz = "H"; var ser = "2";var con = "1"; var sizedescrip = "2 inch"};
if (document.codeform.size[3].checked) {var siz = "I"; var ser = "2";var con = "1"; var sizedescrip = "2-1/2 inch"};
if (document.codeform.size[4].checked) {var siz = "J"; var ser = "2";var con = "1"; var sizedescrip = "3 inch"};
if (document.codeform.size[5].checked) {var siz = "K"; var ser = "2";var con = "1"; var sizedescrip = "4 inch"};
if (document.codeform.size[6].checked) {var siz = "E"; var ser = "2";var con = "3"; var sizedescrip = "1 inch"};
if (document.codeform.size[7].checked) {var siz = "G"; var ser = "2";var con = "3"; var sizedescrip = "1-1/2 inch"};
if (document.codeform.size[8].checked) {var siz = "H"; var ser = "2";var con = "3"; var sizedescrip = "2 inch"};
if (document.codeform.size[9].checked) {var siz = "J"; var ser = "2";var con = "3"; var sizedescrip = "3 inch"};
if (document.codeform.size[10].checked) {var siz = "K"; var ser = "2";var con = "3"; var sizedescrip = "4 inch"};
if (document.codeform.size[11].checked) {var siz = "C"; var ser = "1";var con = "1"; var sizedescrip = "1/2 inch"};
if (document.codeform.size[12].checked) {var siz = "D"; var ser = "1";var con = "1"; var sizedescrip = "3/4 inch"};
if (document.codeform.size[13].checked) {var siz = "E"; var ser = "1";var con = "1"; var sizedescrip = "1 inch"};
if (document.codeform.size[14].checked) {var siz = "G"; var ser = "1";var con = "1"; var sizedescrip = "1-1/2 inch"};
if (document.codeform.size[15].checked) {var siz = "H"; var ser = "1";var con = "1"; var sizedescrip = "2 inch"};
if (document.codeform.size[16].checked) {var siz = "I"; var ser = "1";var con = "1"; var sizedescrip = "2-1/2 inch"};
if (document.codeform.size[17].checked) {var siz = "J"; var ser = "1";var con = "1"; var sizedescrip = "3 inch"};
if (document.codeform.size[18].checked) {var siz = "K"; var ser = "1";var con = "1"; var sizedescrip = "4 inch"};
if (document.codeform.size[19].checked) {var siz = "C"; var ser = "1";var con = "3"; var sizedescrip = "1/2 inch"};
if (document.codeform.size[20].checked) {var siz = "D"; var ser = "1";var con = "3"; var sizedescrip = "3/4 inch"};
if (document.codeform.size[21].checked) {var siz = "E"; var ser = "1";var con = "3"; var sizedescrip = "1 inch"};
if (document.codeform.size[22].checked) {var siz = "G"; var ser = "1";var con = "3"; var sizedescrip = "1-1/2 inch"};
if (document.codeform.size[23].checked) {var siz = "H"; var ser = "1";var con = "3"; var sizedescrip = "2 inch"};
if (document.codeform.size[24].checked) {var siz = "J"; var ser = "1";var con = "3"; var sizedescrip = "3 inch"};
if (document.codeform.size[25].checked) {var siz = "K"; var ser = "1";var con = "3"; var sizedescrip = "4 inch"};
if (ser == "1"){var serdescrip = "Standard Port ";}
if (ser == "2"){var serdescrip = "Full Port ";}
// connection class
if (con == "1"){var condescrip = "ANSI RF 150 lb. Flange ";}
if (con == "3"){var condescrip = "ANSI RF 300 lb. Flange ";}
// body material
if (document.codeform.bod[0].checked) {var bod = "6"; var bodmat = "Stainless Steel"};
if (document.codeform.bod[1].checked) {var bod = "1"; var bodmat = "Carbon Steel"};
// Actuators ---------------------------
// Pneumatic actuators
if (document.codeform.actuator[1].checked) {var act = "6SC"; var actpic = "8S";
var failpos = " (Fail to CLOSED)"; var psi = "60"; var solt = "E"};
if (document.codeform.actuator[0].checked) {var act = "8SC"; var actpic = "8S";
var failpos = " (Fail to CLOSED)"; var psi = "80"; var solt = "E"};
if (document.codeform.actuator[3].checked) {var act = "6SO"; var actpic = "8S";
var failpos = " (Fail to OPEN)"; var psi = "60"; var solt = "E"};
if (document.codeform.actuator[2].checked) {var act = "8SO"; var actpic = "8S";
var failpos = " (Fail to OPEN)"; var psi = "80"; var solt = "E"};
if (document.codeform.actuator[5].checked) {var act = "6D"; var actpic = "8D"; var psi = "60"; var solt = "C";}
if (document.codeform.actuator[4].checked) {var act = "8D"; var actpic = "8D"; var psi = "80"; var solt = "C";}
// Pneumatic Act Type
if (document.codeform.pact[0].checked) {var pact = "0"};
if (document.codeform.pact[1].checked) {var pact = "E"};
var act = pact+act;
var actpic = pact+actpic;
if (pact == "" && psi != ""){
document.codeform.pact[0].checked = 1;
var pact = "0";
var act = pact+act;
var actpic = pact+actpic;
}
// Electric actuators
if (document.codeform.actuator[6].checked) {var act = "K4A"; var actpic = "K4"; var actvoltage = "120 VAC"; var pact = "V";};
if (document.codeform.actuator[7].checked) {var act = "O4E"; var actpic = "K4"; var actvoltage = "24 VAC"; var pact = "V";};
if (document.codeform.actuator[8].checked) {var act = "O4B"; var actpic = "K4"; var actvoltage = "24 VDC"; var pact = "V";};
if (document.codeform.actuator[9].checked) {var act = "B7A"; var actpic = "B7"; var actvoltage = "120 VAC"; var pact = "V";};
if (pact == "V"){
document.codeform.pact[0].checked = 0;
document.codeform.pact[1].checked = 0;
}
// Manual Handle actuators
if (document.codeform.actuator[10].checked) {var act = "M"; var actpic = "M"; var pact = "M";
document.codeform.pact[0].checked = 0;
document.codeform.pact[1].checked = 0;
};
// Actuator Mounting Type
if (document.codeform.brackauto.checked) {var brackauto = "Y"}
if (document.codeform.mtg[0].checked) {var mtg = "D"; var bracket="direct";};
if (document.codeform.mtg[1].checked) {var mtg = "B"; var bracket="bracket";};
// Solenoids ---------------------------
if (document.codeform.solenoid[0].checked) {var solc = ""};
if (document.codeform.solenoid[1].checked) {var solc = "3"};
if (document.codeform.solenoid[2].checked) {var solc = "4"};
if (document.codeform.solenoid[3].checked) {var solc = "5"};
if (document.codeform.solenoid[4].checked) {var solc = "6"};
if (document.codeform.solenoid[5].checked) {var solc = "2"};
if (document.codeform.solenoidv[0].checked) {var solv = "A"; var solvoltage="120 VAC"};
if (document.codeform.solenoidv[1].checked) {var solv = "B"; var solvoltage="24 VDC"};
if (document.codeform.solenoidv[2].checked) {var solv = "F"; var solvoltage="12 VDC"};
if (solc!=""){var sol=solt+solc+solv; var solpic=solt+"3";
if (solc=="2"){ var solpic=solt+"2";}
}
// Limit Switches ---------------------------
if (document.codeform.limit[0].checked) {var lim = ""};
if (document.codeform.limit[1].checked) {var lim = "YF"; var limpic = "YF"};
if (document.codeform.limit[2].checked) {var lim = "UA"; var limpic = "UB"};
if (document.codeform.limit[3].checked) {var lim = "UB"; var limpic = "UB"};
if (document.codeform.limit[4].checked) {var lim = "YO"; var limpic = "YW4"};
if (document.codeform.limit[5].checked) {var lim = "YH"; var limpic = "YW7"};
if (document.codeform.limit[6].checked) {var lim = "YE"; var limpic = "YW7"};
// Positioners ---------------------------
if (document.codeform.pos[0].checked) {var pos = ""; var pospic = ""};
if (document.codeform.pos[1].checked) {var pos = "P5"; var pospic = "POSP5"};
if (document.codeform.pos[2].checked) {var pos = "E5"; var pospic = "POSP5"};
if (document.codeform.pos[3].checked) {var pos = "E5XP"; var pospic = "POSP5"};
if (document.codeform.pos[4].checked) {var pos = "EP010"; var pospic = ""};
if (document.codeform.pos[5].checked) {var pos = "EP420"; var pospic = ""};
// Check for exceptions ----------------------------------------------------------
// Remove Solenoid valves from Manual & Electric Actuators
if ((act == "M" || actpic == "K4" || actpic == "B7") && (sol != "")){
alert('Solenoid Valves are only for use on Pneumatic Actuators.\rThe solenoid valve will be reset to NONE.');
document.codeform.solenoid[0].checked = 1;
var sol = ""; var solpic = ""; var solt = ""; var solc = ""; var solv = "";
}
// Alert for Explosion Proof Solenoid & non XP Limit Switch
if ((limpic == "UB" || limpic == "YF" ) && (solc == "2")){
alert('This assembly is NOT Explosion Proof.\n\nYou have chosen an Explosion Proof Solenoid,\nbut the limit switch you have selected is NOT.');
}
// Alert for Explosion Proof Limit Switch & non XP Solenoid
if ((limpic == "YW4" || limpic == "YW7") &&
(solc == "3" || solc == "4" || solc == "5" || solc == "6")){
alert('This assembly is NOT Explosion Proof.\n\nYou have chosen an Explosion Proof Limit Switch,\nbut the Solenoid you have selected is NOT.');
}
// Alert for Limit Switch & Electric Actuator
if ((lim != "") && (actpic == "K4" || actpic == "B7")){
alert('All electric actuators include position switches.\rThe Limit Switch will be reset to NONE.');
document.codeform.limit[0].checked = 1;
var lim = ""; var limpic = ""
}
// Change YF limit switch to UB for Manual Valves
//if ((act == "M") && (lim == "YF")){
// alert('YF limit switches are only for use with Pneumatic Actuators.\rUse UB limit switches for manual valves.\rThe limit switch will be set to UB.');
// document.codeform.limit[2].checked = 1;
// var lim = "UB"
// }
// Remove limit switch for Manual Valves
if ((act == "M") && (lim != "")){
alert('Limit switches are only available with Pneumatic Actuators.\rThe limit switch will be set to NONE.');
document.codeform.limit[0].checked = 1;
var lim = ""; var limpic = ""
}
// Check for positioner & Solenoid
if ((pos != "") && (sol != "")){
alert('Solenoid & Positioner.\rThe Solenoid will be set to NONE.');
document.codeform.solenoid[0].checked = 1;
var sol = ""; var solpic = ""; var solt = ""; var solc = ""; var solv = "";
}
// Check for positioner & Limit Switch
if ((pos != "") && (lim != "")){
alert('Limit Switches cannot be used with Positioners .\rThe Limit Switch will be set to NONE.');
document.codeform.limit[0].checked = 1;
var lim = ""; var limpic = "";
}
// Check for incorrect Positioner ---------------------------
if ((pos == "P5" || pos == "E5" || pos == "E5XP")){
if (pact == "M"){
alert('Incorrect Positioner.\rPositioners are not available with Manual Valves.\rThe Positioner will be set to NONE.');
document.codeform.pos[0].checked = 1;
var pos = ""; var pospic = "";
}
if (pact == "V"){
alert('Incorrect Positioner.\r' +pos+' Positioners are not available with Electric Actuators.\rThe Positioner will be set to EP420.');
document.codeform.pos[5].checked = 1;
var pos = "EP420"; var pospic = ""
}
}
if (pos == "EP010" || pos == "EP420"){
if (pact == "M"){
alert('Incorrect Positioner.\rPositioners are not available with Manual Valves.\rThe Positioner will be set to NONE.');
document.codeform.pos[0].checked = 1;
var pos = ""; var pospic = "";
}
if (pact == "0" || pact == "E"){
alert('Incorrect Positioner.\r'+pos+'Positioners are Only available with Electric Actuators.\rThe Positioner will be set to E5.');
document.codeform.pos[2].checked = 1;
var pos = "E5"; var pospic = "POSP5"
}
}
// force bracket if needed and set brackreq var to Y -------------------------------------------------------------------------
var brackreq = "N";
var bracktext="Direct Mount";
if ((ser == "1") && (siz == "C" || siz == "D" || siz == "E") && (act != "M")) {
document.codeform.mtg[1].checked = 1;
var mtg = "B";
var bracket="bracket";
// alert('bracket must be used for standard port sizes C,D,E');
var bracktext="Direct Mount (Bracket Required)";
var brackreq = "Y";
}
if (act == "B7A") {
if ((ser=="2") && (siz == "J" || siz == "K")) {
document.codeform.mtg[1].checked = 1;
var mtg = "B";
var bracket="bracket";
// alert('bracket must be used for 810F-12 actuator');
var bracktext="Direct Mount (Bracket Required)";
var brackreq = "Y";
}
if ((ser=="1") && (siz == "K")) {
document.codeform.mtg[1].checked = 1;
var mtg = "B";
var bracket="bracket";
// alert('bracket must be used for 810F-12 actuator');
var bracktext="Direct Mount (Bracket Required)";
var brackreq = "Y";
}
}
document.getElementById('brack').innerHTML = bracktext;
// remove bracket in code for Manual Handles -------------------------------------------------------------------------
if (act=="M"){var mtg = "";}
// remove bracket if NOT REQUIRED -------------------------------------------------------------------------
// alert('auto = '+brackauto+' ; req = '+brackreq+' ; mtg = '+mtg);
if (brackauto == "Y" && brackreq == "N" && mtg == "B"){
if (pushed == "B") {alert('DIRECT MOUNT PREFFERED !\n\nTo select bracket mounting when not required. please de-select this preference.');}
document.codeform.mtg[0].checked = 1;
var mtg = "D";
var bracket="direct";
var bracktext="Direct Mount";}
// alert('auto = '+brackauto+' ; req = '+brackreq+' ; mtg = '+mtg);
// Set model code & pic variables ---------------------------
var pic = "4"+ser+actpic+solpic+limpic+pospic;
var mc = siz+"4"+ser+bod+con+"T"+mtg+act+sol+lim+pos;
// Set Prices -----------------------------------------------
var baseprice = eval('baseprice_'+ser+bod+con+siz);
var baseweight = eval('baseweight_'+ser+bod+con+siz);
if (act=="06SO" || act=="06SC"){
var actprice = eval('F'+ser+'X'+con+'0SR6_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'0SR6_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'0SR6_'+siz+'[3]')+" "+failpos}
if (act=="08SO" || act=="08SC"){
var actprice = eval('F'+ser+'X'+con+'0SR8_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'0SR8_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'0SR8_'+siz+'[3]')+" "+failpos}
if (act=="06D"){
var actprice = eval('F'+ser+'X'+con+'0DA6_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'0DA6_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'0DA6_'+siz+'[3]')+" "+failpos}
if (act=="08D"){
var actprice = eval('F'+ser+'X'+con+'0DA8_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'0DA8_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'0DA8_'+siz+'[3]')+" "+failpos}
if (act=="E6SO" || act=="E6SC"){
var actprice = eval('F'+ser+'X'+con+'ESR6_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'ESR6_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'ESR6_'+siz+'[3]')+" "+failpos}
if (act=="E8SO" || act=="E8SC"){
var actprice = eval('F'+ser+'X'+con+'ESR8_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'ESR8_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'ESR8_'+siz+'[3]')+" "+failpos}
if (act=="E6D"){
var actprice = eval('F'+ser+'X'+con+'EDA6_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EDA6_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EDA6_'+siz+'[3]')+" "+failpos}
if (act=="E8D"){
var actprice = eval('F'+ser+'X'+con+'EDA8_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EDA8_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EDA8_'+siz+'[3]')+" "+failpos}
if (act=="K4A"){
var actprice = eval('F'+ser+'X'+con+'EN4A_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EN4A_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EN4A_'+siz+'[3]')+" "+actvoltage}
if (act=="O4E"){
var actprice = eval('F'+ser+'X'+con+'EN4E_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EN4E_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EN4E_'+siz+'[3]')+" "+actvoltage}
if (act=="O4B"){
var actprice = eval('F'+ser+'X'+con+'EN4B_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EN4B_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EN4B_'+siz+'[3]')+" "+actvoltage}
if (act=="B7A"){
var actprice = eval('F'+ser+'X'+con+'EXPA_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'EXPA_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'EXPA_'+siz+'[3]')+" "+actvoltage}
if (act=="M"){
var actprice = eval('F'+ser+'X'+con+'MAN_'+siz+'[1]'); var actweight = eval('F'+ser+'X'+con+'MAN_'+siz+'[2]'); var actdescrip = eval('F'+ser+'X'+con+'MAN_'+siz+'[3]');
var mountprice = 0;
var mountweight = 0;
var mtg = "";
}
// solenoid pricing, weight, & description
if (sol !=''){
var solbeg2 = sol.substring(0, 2);
var solprice = eval('sol_'+solbeg2+'_price');
var solweight = eval('sol_'+solbeg2+'_weight');
var soldescrip = (eval('sol_'+solbeg2+'_descrip'))+" "+solvoltage;
}
// limit switch pricing, weight, & description
if (lim !=''){
// var limorig = lim;
// var lim = lim.substring(0, 2);
var limprice = eval(lim+'_price');
var limweight = eval(lim+'_weight');
var limdescrip = eval(lim+'_descrip');
// var lim = limorig;
// alert(lim+' = $'+limprice+' : '+limweight+' lbs. : '+limdescrip);
}
// positioner pricing, weight, & description
if (pos !=''){
var posprice = eval(pos+'_price');
var posweight = eval(pos+'_weight');
var posdescrip = eval(pos+'_descrip');
// if ((siz == "O" || siz == "P" || siz == "Q" || siz == "R" || siz == "S" || siz == "T" || siz == "V") && (act == "K4A")){
if ( (act == "K4A") && ((eval('F'+ser+'X'+con+'EN4A_'+siz+'[0]')) == "UNIC60" || (eval('F'+ser+'X'+con+'EN4A_'+siz+'[0]')) == "UNIC100")){
var posprice = eval(pos+'_L_price');
var posweight = eval(pos+'_L_weight');
var posdescrip = eval(pos+'_L_descrip');
// alert(pos+' = $'+posprice+' : '+posweight+' lbs. : '+posdescrip);
}}
// mounting bracket pricing, weight, & description
if (mtg != "") {
var mountprice = eval(siz+mtg+'MK_price');
var mountweight = eval(siz+mtg+'MK_weight');
if (mtg=='D'){ var mountdescrip = '(actuator mounted directly to valve body)';}
if (mtg=='B'){ var mountdescrip = '(actuator mounted to valve with bracket & coupling)';}
} else {
var mountprice = eval(siz+'NMK_price');
var mountweight = eval(siz+'NMK_weight');
}
// alert(siz+mtg+'MK $ '+mountprice+' : '+mountweight+' lbs. ');
// TOTAL PRICE
var price = Math.round(baseprice+actprice+mountprice+solprice+limprice+posprice);
// TOTAL WEIGHT
var weight = baseweight+actweight+mountweight+solweight+limweight+posweight;
// DESCRIPTIONS
var infotext = " Port Type: "+serdescrip+"
"+
" Body Material: "+bodmat+"
"+
" Size & Connection: "+sizedescrip+" "+condescrip+"
"+
" Seats: TFM | Stem Seals: TFM
"+
" Actuator: "+actdescrip;
if (psi != "") {
var infotext = infotext +"
(sized for using "+psi+"psi supply air in applications up to 300psi DP)";}
if (act!="M"){
var infotext = infotext + "
"+mountdescrip+"
";}
if (soldescrip != "") {
var infotext = infotext +"Actuator Solenoid: "+sol+" "+soldescrip+"
";}
if (limdescrip != "") {
var infotext = infotext +"Limit Switch: "+limdescrip+"
";}
if (posdescrip != "") {
var infotext = infotext +"Positioner: "+posdescrip+"
";}
if (siz == ""){var pic = "08S"; var price = ""; var mc = "Select Size"}
document.codeform.price.value = price;
document.codeform.modelcode.value = mc;
document.codeform.bodmod.value = serdescrip+", "+sizedescrip+" "+condescrip;
document.codeform.actmod.value = "["+act+"] = "+actdescrip;
document.codeform.imgsrc.value = "/4000/models/"+pic+".jpg";
document.codeform.id.value = mc;
document.codeform.info.value = infotext;
document.codeform.weight.value = weight;
document.codeform.prodname.value = '4'+ser+' Series';
document.codeform.prodseries.value = 'ANSI Flanged 2-way Ball Valve';
var psummary = 'price = base:'+baseprice+'
act:'+actprice+'
mount:'+mountprice+'
sol:'+solprice+'
lim:'+limprice+'
pos:'+posprice;
var wsummary = 'weight = base:'+baseweight+'
act:'+actweight+'
mount:'+mountweight+'
sol:'+solweight+'
lim:'+limweight+'
pos:'+posweight;
// document.getElementById('infospan').innerHTML = infotext;
// document.getElementById('calcspan').innerHTML = "
| "+psummary+" | "+wsummary+" |