<!--

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function Update_MM_Total(){
  var a_Price = new Array();
  // Flow Capacity
  a_Price["01"] = 1454.00;
  a_Price["011"] = 0.00;
  a_Price["012"] = 1257.00;
  a_Price["013"] = 2695.00;
  a_Price["02"] = 1454.00;
  a_Price["021"] = 0.00;
  a_Price["022"] = 1257.00;
  a_Price["023"] = 2695.00;
  a_Price["03"] = 1657.00;
  a_Price["031"] = 0.00;
  a_Price["032"] = 1460.00;
  a_Price["033"] = 3101.00;
  a_Price["04"] = 1454.00;
  a_Price["041"] = 0.00;
  a_Price["042"] = 1257.00;
  a_Price["043"] = 2695.00;
  a_Price["05"] = 1753.00;
  a_Price["051"] = 0.00;
  a_Price["052"] = 1553.00;
  a_Price["053"] = 3287.00;
  a_Price["06"] = 2190.00;
  a_Price["061"] = 0.00;
  a_Price["062"] = 1992.00;
  a_Price["063"] = 2662.00;
  a_Price["07"] = 2195.00;
  a_Price["071"] = 0.00;
  a_Price["072"] = 1987.00;
  a_Price["073"] = 2669.00;
  a_Price["08"] = 2400.00;
  a_Price["081"] = 0.00;
  a_Price["082"] = 2203.00;
  a_Price["083"] = 3082.00;
  a_Price["09"] = 2508.00;
  a_Price["091"] = 0.00;
  a_Price["092"] = 2369.00;
  a_Price["093"] = 3281.00;
  a_Price["10"] = 0.00;
  a_Price["11"] = 0.00;
  a_Price["12"] = 0.00;
  a_Price["13"] = 0.00;
  a_Price["14"] = 0.00;
  a_Price["15"] = 0.00;
  // Number of Pumps
  a_Price["1"] = 1;
  a_Price["2"] = 2;
  a_Price["3"] = 3;
  a_Price["4"] = 4;  
  a_Price["5"] = 5;
  a_Price["6"] = 6;
  a_Price["7"] = 7;
  a_Price["8"] = 8;
  a_Price["9"] = 9;
  // Number of Feed Points
  a_Price["IO1"] = 0.00;
  a_Price["IO2"] = 0.00;
  a_Price["IO3"] = 0.00;
  a_Price["IO4"] = 0.00;
  a_Price["IO5"] = 0.00;
  a_Price["IO6"] = 0.00;
  a_Price["IO7"] = 0.00;
  a_Price["IO8"] = 0.00;
  a_Price["IO9"] = 0.00;
  // Voltage
  a_Price["V1"] = 0.00;
  a_Price["V2"] = 0.00;
  a_Price["V3"] = 0.00;
  a_Price["V4"] = 0.00;
  a_Price["V5"] = 0.00;
  // Control
  a_Price["CL"] = 0.00;
  a_Price["RA"] = 528.00;
  a_Price["RP"] = 244.00;
  // Set Point Control
  a_Price["SPY"] = 0.00;
  a_Price["SPN"] = 0.00;
  // Plumbing
  a_Price["P"] = 0.00;
  a_Price["C"] = 0.00;
  a_Price["K"] = 0.00;
  a_Price["S"] = 0.00;
  // Pressure Relief
  a_Price["PRY"] = 150.00;
  a_Price["PRN"] = 0.00;
  // Back Pressure
  a_Price["BPY"] = 150.00;
  a_Price["BPN"] = 0.00;
  // Pulsation Dampener 
  a_Price["PDY"] = 176.00;
  a_Price["PDN"] = 0.00;
  // Gauge Guard
  a_Price["GY"] = 73.00;
  a_Price["GN"] = 0.00;
  // Flow Meter
  a_Price["0"] = 0.00;
  a_Price["M"] = 0.00;
  a_Price["C"] = 0.00;
  a_Price["P"] = 0.00;
  a_Price["U"] = 0.00;  
  a_Price["V"] = 0.00;
  a_Price["G"] = 0.00;
  // Calibration Column
  a_Price["CAL1"] = 0.00;
  a_Price["CAL2"] = 3.60;  
  a_Price["CAL3"] = 8.30;  
  a_Price["CAL4"] = 8.30;  
  a_Price["CAL5"] = 12.50;  
  a_Price["CAL6"] = 0.00;  
  a_Price["CAL7"] = 0.00;  
  a_Price["CAL8"] = 0.00;
  // Post Dilution
  a_Price["R0"] = 0.00;
  a_Price["R1"] = 525.00;
  a_Price["R2"] = 585.00;
  a_Price["R3"] = 555.00;
  a_Price["R4"] = 630.00;
  a_Price["R5"] = 0.00;
  a_Price["R6"] = 0.00;
  a_Price["P1"] = 0.00;
  a_Price["P2"] = 0.00;
  a_Price["P3"] = 0.00;     
    		  
   var amt = 0;
   var pid = 0;
   var xpid = 0;
   var partNumber = '';
   var block = "PRODUCT[";
   var el = document.f_checkout.elements;
   //var call = 0;
   for (var i=0; i<el.length; i++) {
     if (el[i].name.substr(0,block.length)==block && el[i].checked){
	   pid = el[i].name.substr(block.length,6);
         if(a_Price[pid]) amt+= a_Price[pid];
       } 
   }

	

	if(document.f_checkout.flow.selectedIndex == -1 || document.f_checkout.flow.options[document.f_checkout.flow.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.flow.value.substr(block.length,2);
       if(a_Price[pid]) 
	   amt+= a_Price[pid];
	   xpid = pid;
	   partNumber+=pid + "-";
	   
    } 
   
	if(document.f_checkout.pumps.selectedIndex == -1 || document.f_checkout.pumps.options[document.f_checkout.pumps.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.pumps.value.substr(block.length,1);
	   if(pid > 3 && call != "1"){
	     //alert("Please call for a quote.");
		 //alert(call);
		 var call = "1";
		 }
	  
       if(a_Price[pid]) {
	   //alert(xpid);
	   xpid = xpid + pid;
	   //xpid = a_Price[xpid];
	   
	   amt+= a_Price[xpid];
	   }
	  partNumber+=pid + "-";
    } 

	if(document.f_checkout.feed.selectedIndex == -1 || document.f_checkout.feed.options[document.f_checkout.feed.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.feed.value.substr(block.length,3);
       if(a_Price[pid]) amt+= a_Price[pid];
	  partNumber+=pid + "-";
    } 

	if(document.f_checkout.volts.selectedIndex == -1 || document.f_checkout.volts.options[document.f_checkout.volts.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.volts.value.substr(block.length,2);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    } 
	if(document.f_checkout.control.selectedIndex == -1 || document.f_checkout.control.options[document.f_checkout.control.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.control.value.substr(block.length,2);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }    
	if(document.f_checkout.setpoint.selectedIndex == -1 || document.f_checkout.setpoint.options[document.f_checkout.setpoint.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.setpoint.value.substr(block.length,3);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }    
	if(document.f_checkout.plumbing.selectedIndex == -1 || document.f_checkout.plumbing.options[document.f_checkout.plumbing.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.plumbing.value.substr(block.length,1);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }   
    if(document.f_checkout.relief.selectedIndex == -1 || document.f_checkout.relief.options[document.f_checkout.relief.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.relief.value.substr(block.length,3);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    } 
    if(document.f_checkout.backpressure.selectedIndex == -1 || document.f_checkout.backpressure.options[document.f_checkout.backpressure.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.backpressure.value.substr(block.length,3);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }
    if(document.f_checkout.pulse.selectedIndex == -1 || document.f_checkout.pulse.options[document.f_checkout.pulse.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.pulse.value.substr(block.length,3);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }
	if(document.f_checkout.pulse.selectedIndex == -1 || document.f_checkout.guard.options[document.f_checkout.guard.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.guard.value.substr(block.length,2);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }
    if(document.f_checkout.flowmeter.selectedIndex == -1 || document.f_checkout.flowmeter.options[document.f_checkout.flowmeter.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.flowmeter.value.substr(block.length,1);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }  
    if(document.f_checkout.calibration.selectedIndex == -1 || document.f_checkout.calibration.options[document.f_checkout.calibration.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.calibration.value.substr(block.length,4);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }	
    if(document.f_checkout.post.selectedIndex == -1 || document.f_checkout.post.options[document.f_checkout.post.selectedIndex].value != "Select One:"){
	   pid = document.f_checkout.post.value.substr(block.length,2);
       if(a_Price[pid]) amt+= a_Price[pid];
	   partNumber+=pid + "-";
    }	
  
  partNumber = partNumber.slice(0,-1);    
  amt = "$" + Math.round(amt*100)/100;
  if(document.getElementById) document.getElementById('ec_total').innerHTML = amt;
  else document.all.ec_total.innerHTML = amt;
  if(document.getElementById) document.getElementById('ec_part').innerHTML = partNumber;
  else document.all.ec_part.innerHTML = partNumber;
  document.f_checkout.partnumber.value = partNumber;
  document.f_checkout.price.value = amt;

}
//-->
