function changeCode(){
// clear variables
var baseweight = 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 actvoltage = "";
var actt = "";
var failpos = "";
var mountprice = 0;
var mountweight = 0;
var solprice = 0;
var limprice = 0;
var solweight = 0;
var limweight = 0;
var posweight = 0;
var siz = "";
var nqs = "no";
var infotext = "";
var bodymat = "Ductile Iron";
var sizedescrip = "";
var con = "";
var condescrip = "";
var conprice = 0;
var infoflo = "";
var sel = "";
var lim = "";
var con = "X";
var seldescrip = "";
var selprice = 0;
var posprice = 0;
var dis = "";
var disprice = 0;
var disdescrip = "Stainless Steel";
var soldescrip = "";
var solvoltage = "";
var limdescrip = "";
var posdescrip = "";
var posprice = 0;
var posweight = 0;
var pos = "";
var pospic = "";
var sol = "";
var solpic = "";
var limpic = "";
var solt = "";
var solc = "";
var solv = "";
var pact = "";
var DP = "150";
var cwcode = "";
var cwweight = 0;
var cwprice = 0;
var cwdescrip = "";
var chainlength = 0;
var chainweight = 0;
var chainprice = 0;
var chainppf = 0;
var chainwpf = 0;
var sewpi = 0;
var seppi = 0;
var sebase = 0;
var selength = 0;
var seweight = 0;
var seprice = 0;
var secode = "";
var boltprice = 100;
var flangeprice = 100;
var fkt = "SO"
document.codeform.price.value = "";
// document.codeform.act_type.value = "";
// get all user selections
document.getElementById('O8SC').style.color = "#000000";
document.getElementById('O6SC').style.color = "#000000";
document.getElementById('O8SO').style.color = "#000000";
document.getElementById('O6SO').style.color = "#000000";
document.getElementById('O8DA').style.color = "#000000";
document.getElementById('O6DA').style.color = "#000000";
document.getElementById('V4A').style.color = "#000000";
document.getElementById('V4B').style.color = "#000000";
document.getElementById('V4F').style.color = "#000000";
// document.getElementById('K4E').style.color = "#000000";
// document.getElementById('I4A').style.color = "#000000";
// document.getElementById('I4F').style.color = "#000000";
// document.getElementById('I4B').style.color = "#000000";
// document.getElementById('I4E').style.color = "#000000";
// Size ---------------------------------------------------------
if (document.codeform.size[0].checked) {var siz = "C"};
if (document.codeform.size[1].checked) {var siz = "D"};
if (document.codeform.size[2].checked) {var siz = "E"};
if (document.codeform.size[3].checked) {var siz = "G"};
if (document.codeform.size[4].checked) {var siz = "H"};
if (document.codeform.size[5].checked) {var siz = "J"};
if (document.codeform.size[6].checked) {var siz = "K"};
if (siz == "J" || siz == "K") {
document.getElementById('V4A').style.color = "#999999";
document.getElementById('V4B').style.color = "#999999";
document.getElementById('V4F').style.color = "#999999";
if (document.codeform.act_e[0].checked) {document.codeform.act_e[3].checked = 1;}
if (document.codeform.act_e[1].checked) {document.codeform.act_e[4].checked = 1;}
if (document.codeform.act_e[2].checked) {document.codeform.act_e[5].checked = 1;}
}
// Connection ---------------------------------------------------------
if (document.codeform.connection[0].checked) {var con = "N"; var conpic = "S"; var condescrip = "NPT (female)"};
if (document.codeform.connection[1].checked) {var con = "S"; var conpic = "S"; var condescrip = "Sched. 80 Glue Socket"};
if (document.codeform.connection[2].checked) {var con = "F"; var conpic = "F"; var condescrip = "ANSI 150 lb. Flange"};
// Seat Material ---------------------------
if (document.codeform.seal[0].checked) {var sel = "E"; var seldescrip = "EPDM"};
if (document.codeform.seal[1].checked) {var sel = "V"; var seldescrip = "VITON"};
// Body Material ---------------------------
if (document.codeform.body[0].checked) {var bod = "P"; var bodymat = "PVC"};
if (document.codeform.body[1].checked) {var bod = "C"; var bodymat = "CPVC"};
var sizedescrip = eval('PB'+bod+'SIZE_'+siz+'.siz_descrip');
// Actuators ---------------------------
if (document.codeform.act_type.value == "") {
document.getElementById("pre_act").style.display="block";
} else {
document.getElementById("pre_act").style.display="none";
// document.getElementById("acc").className="vis_tr";
}
// ************************************************************************ Pneumatic actuators
if (document.codeform.act_type.value == "P") {
var actt="P";
if (document.codeform.act_p[0].checked)
{var act = "08SC"; var actn = "OSR8"; var actpic = "08S"; var failpos = " (Fail to CLOSED)"; var psi = "80"; var solt = "E"; var actcad="08SC"};
if (document.codeform.act_p[1].checked)
{var act = "06SC"; var actn = "OSR6"; var actpic = "08S"; var failpos = " (Fail to CLOSED)"; var psi = "60"; var solt = "E"; var actcad="06SC"};
if (document.codeform.act_p[2].checked)
{var act = "08SO"; var actn = "OSR8"; var actpic = "08S"; var failpos = " (Fail to OPEN)"; var psi = "80"; var solt = "E"; var actcad="08SC"};
if (document.codeform.act_p[3].checked)
{var act = "06SO"; var actn = "OSR6"; var actpic = "08S"; var failpos = " (Fail to OPEN)"; var psi = "60"; var solt = "E"; var actcad="06SC"};
if (document.codeform.act_p[4].checked) {var act = "08D"; var actn = "ODA8"; var actpic = "08D"; var psi = "80"; var solt = "C"; var actcad="08D"};
if (document.codeform.act_p[5].checked) {var act = "06D"; var actn = "ODA6"; var actpic = "08D"; var psi = "60"; var solt = "C"; var actcad="06D"};
if (document.codeform.act_p[6].checked)
{var act = "E8SC"; var actn = "ESR8"; var actpic = "E8S"; var failpos = " (Fail to CLOSED)"; var psi = "80"; var solt = "E"; var actcad=""};
if (document.codeform.act_p[7].checked)
{var act = "E6SC"; var actn = "ESR6"; var actpic = "E8S"; var failpos = " (Fail to CLOSED)"; var psi = "60"; var solt = "E"; var actcad=""};
if (document.codeform.act_p[8].checked)
{var act = "E8SO"; var actn = "ESR8"; var actpic = "E8S"; var failpos = " (Fail to OPEN)"; var psi = "80"; var solt = "E"; var actcad=""};
if (document.codeform.act_p[9].checked)
{var act = "E6SO"; var actn = "ESR6"; var actpic = "E8S"; var failpos = " (Fail to OPEN)"; var psi = "60"; var solt = "E"; var actcad=""};
if (document.codeform.act_p[10].checked) {var act = "E8D"; var actn = "EDA8"; var actpic = "E8D"; var psi = "80"; var solt = "C"; var actcad=""};
if (document.codeform.act_p[11].checked) {var act = "E6D"; var actn = "EDA6"; var actpic = "E8D"; var psi = "60"; var solt = "C"; var actcad=""};
}
// ****************************************************************************************************************************** End Pneumatic actuators
// Electric actuators *************************************************************************************************************************************
if (document.codeform.act_type.value == "E") {
var actt="E";
if (document.codeform.act_e[0].checked)
{var act = "V4A"; var actn = "VEN4AC"; var actpic = "V4"; var actv = "A"; var actvoltage = " 120 VAC"; var actcad="V4"};
if (document.codeform.act_e[1].checked)
{var act = "V4B"; var actn = "VEN4DC"; var actpic = "V4"; var actv = "B"; var actvoltage = " 24 VDC"; var actcad="V4"};
if (document.codeform.act_e[2].checked)
{var act = "V4F"; var actn = "VEN4DC"; var actpic = "V4"; var actv = "F"; var actvoltage = " 12 VDC"; var actcad="V4"};
if (document.codeform.act_e[3].checked)
{var act = "R4A"; var actn = "REN4AC"; var actpic = "R4"; var actv = "A"; var actvoltage = " 120 VAC"; var actcad="R4"};
if (document.codeform.act_e[4].checked)
{var act = "R4B"; var actn = "REN4DC"; var actpic = "R4"; var actv = "B"; var actvoltage = " 24 VDC"; var actcad="R4"};
if (document.codeform.act_e[5].checked)
{var act = "R4F"; var actn = "REN4DC"; var actpic = "R4"; var actv = "F"; var actvoltage = " 12 VDC"; var actcad="R4"};
if (document.codeform.act_e[6].checked)
{var act = "B7A"; var actn = "EXPAC"; var actpic = "B7"; var actv = "A"; var actvoltage = " 120 VAC"; var actcad=""};
}
// **************************************************************************************************** End Electric actuators
// Manual Handle actuators ***********************************************************************************************************
if (document.codeform.act_type.value == "M") {
var actt="M";
if (document.codeform.act_m[0].checked) {var act = "M"; var actn = "MAN"; var actpic = "M"; var actcad="M"};
}
// ************************************************************************************************************** End Manual Handle actuators
// Solenoids ---------------------------
if (actt == "P") {
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"};
}
// Check for exceptions ----------------------------------------------------------
// Remove Solenoid valves from Manual & Electric Actuators
if ((act == "M" || act == "G" || actpic == "K4" || actpic == "O4" || 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 solv = ""; var solc = ""
}
// ---------------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.');
// }
// Remove Limit Switch for Electric Actuators -----------------------------------------------------------------------------------------
// if ((lim != "") && (actpic == "K4" || actpic == "O4" || 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 = "";
// }
// Remove Limit switches for Manual Actuators -----------------------------------------------------------------------------------------------
// if ((act == "M" || act == "G") && (lim != "")){
// alert('Limit switches are only for use with Pneumatic Actuators.\rThe limit switch will be reset to NONE.');
// document.codeform.limit[0].checked = 1;
// var lim = ""; var limpic = "";
// }
// Set model code & pic variables ---------------------------
var pmc = ""+act+sol+lim;
var pic = "P"+conpic+actpic+solpic+limpic;
var mc = siz+"PB"+bod+sel+con+act+sol+lim;
// Set Prices -----------------------------------------------
if (actt != "") { // ******************************** BEGIN SET PRICING
var baseprice = eval('PB'+bod+'SIZE_'+siz+'.price');
var baseweight = eval('PB'+bod+'SIZE_'+siz+'.weight');
var actmod = eval('PB'+bod+'SIZE_'+siz+'.'+actn+'.ACT');
var actprice = eval('ACT_'+actmod+'.price');
var actweight = eval('ACT_'+actmod+'.weight');
var actdescrip = eval('ACT_'+actmod+'.descrip')+failpos+actvoltage;
var mount = eval('PB'+bod+'SIZE_'+siz+'.'+actn+'.MOUNT');
var mountprice = eval('MOUNT_'+mount+'.price');
var mountweight = eval('MOUNT_'+mount+'.weight');
if (con =='F'){
var conprice = eval('PB'+bod+'SIZE_'+siz+'.Flange');
}
// 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 limprice = eval(lim+'_price');
var limweight = eval(lim+'_weight');
var limdescrip = eval(lim+'_descrip');
}
// Seal Material pricing & description
if (sel =='V'){
var selprice = eval('PB'+bod+'SIZE_'+siz+'.VITON');
// alert('BUNA_'+con+siz+' = '+selprice)
}
// TOTAL PRICE
var price = Math.round(baseprice+conprice+actprice+mountprice+solprice+limprice+selprice);
// TOTAL WEIGHT
var weight = baseweight+actweight+mountweight+solweight+limweight;
} // END PRICING
if (actt == "") { // ******************************** BEGIN NO ACTUATOR SELECTED
var actdescrip = "Not Selected Yet";
var mc = "Incomplete";
var pic = "invalid"+bod;
}
// DESCRIPTIONS
var infotext = "Body Material: "+bodymat+"
"+
" Size & Connection: "+sizedescrip+" "+condescrip+"
";
var infotext = infotext +" Seats: "+seldescrip+"
"+
" Actuator: "+actdescrip;
if (mc != "Incomplete") {
if (psi != "") {
var infotext = infotext +"
(sized for using "+psi+"psi supply air in applications up to "+DP+"psi DP)";
} else { var infotext = infotext +"
(sized for applications up to "+DP+"psi DP)";
}
}
var infotext = infotext + "
";
if (soldescrip != "") {
var infotext = infotext +"Actuator Solenoid: "+soldescrip+"
";}
if (limdescrip != "") {
var infotext = infotext +"Limit Switch: "+limdescrip+"
";}
if (mc == "Incomplete"){
document.getElementById("add").disabled=true;
document.getElementById("add").className="BUTTOND";
} else {
document.getElementById("add").disabled=false;
document.getElementById("add").className="BUTTON";
}
document.codeform.actmod.value = "["+act+"] = "+actdescrip;
if (actt=="") {document.codeform.actmod.value = "not selected";}
document.codeform.price.value = price;
document.getElementById('listprice').innerHTML = price;
document.codeform.modelcode.value = mc;
document.getElementById('PN').innerHTML = mc;
document.codeform.imgsrc.value = "/PBV/models/"+pic+".jpg";
document.codeform.id.value = mc;
document.codeform.info.value = infotext;
document.codeform.weight.value = weight;
document.codeform.prodname.value = 'PBV Series';
document.codeform.prodseries.value = 'Plastic Ball Valve';
var psummary = 'price = base:'+baseprice+'
act:'+actprice+'
con:'+conprice+'
mount:'+mountprice+'
sol:'+solprice+'
lim:'+limprice+'
pos:'+posprice+'
chainwheel:'+cwprice+'
chain:'+chainprice+'
stem extension:'+seprice;
var wsummary = 'weight = base:'+baseweight+'
act:'+actweight+'
mount:'+mountweight+'
sol:'+solweight+'
lim:'+limweight+'
pos:'+posweight+'
chainwheel:'+cwweight+'
chain:'+chainweight+'
stem ext:'+seweight+'
TOTAL: '+weight+' lbs.';
document.getElementById('infospan').innerHTML = "
| PBV Series Plastic 2-way Ball Valve "+infotext+" |
| "+psummary+" | "+wsummary+" |