warning100='Please note that 100-gallon barrels will only go through gateways that are at least 37” wide. Please check you are able to get the barrel to its intended location before ordering.';
warningAd='Please Note: You have selected a pipe adaptor for use with a rainsaver but you have not chosen to include a rainsaver.';
showWarning=1;

function select_water_barrel() {

  addcost=0;
  addstring='';
  addcode='';
  var i=0;


for (i = 0; i < document.itemsform.barrelSize.length; i++) {
if (document.itemsform.barrelSize[i].checked) {
sizeOfBarrel=document.itemsform.barrelSize[i].value;
break;
   }
}


for (i = 0; i < document.itemsform.stand.length; i++) {
if (document.itemsform.stand[i].checked) {
withStand=document.itemsform.stand[i].value;
break;
   }
}


for (i = 0; i < document.itemsform.barrelNotch.length; i++) {
if (document.itemsform.barrelNotch[i].checked) {
withNotch=document.itemsform.barrelNotch[i].value;
break;
   }
}


for (i = 0; i < document.itemsform.barrelTop.length; i++) {
if (document.itemsform.barrelTop[i].checked) {
withLid=document.itemsform.barrelTop[i].value;
break;
   }
}


for (i = 0; i < document.itemsform.barrelTap.length; i++) {
if (document.itemsform.barrelTap[i].checked) {
typeOfTap=document.itemsform.barrelTap[i].value;
break;
   }
}


switch(withNotch) {

  case 'notched' :
    addcost=prcH;
    addstring='with notch, ';
    addcode='-H';
    break;

  case 'saver' :
    addcost=prcRS;
    addstring='with rainsaver, ';
    addcode='-RS';
    break;

  case 'notNotched' :
    addcost=0;
    addstring='no notch, ';
    addcode='';
    break;

  default :
    break;

}


if (document.itemsform.pipeadaptor) {

  if (document.itemsform.pipeadaptor.checked == true) {
  addstring=addstring+'with pipe adaptor, ';
  addcode=addcode+'-PA';
  addcost=addcost+prcPA;
  if ((withNotch!='saver')&&(showWarning>0)) alert(warningAd);
   }
 }


if (typeOfTap=='notap') addstring=addstring+'without tap';
else {
switch(typeOfTap) {

  case 'frogTap' :
    addcost=addcost+prcBTF;
    addstring=addstring+'with frog tap';
    addcode=addcode+'-BTF';
    break;
  case 'dragonTap' :
    addcost=addcost+prcBDTF;
    addstring=addstring+'with dragon tap';
    addcode=addcode+'-BDTF';
    break;
  case 'PlainTap' :
    addcost=addcost+prcPBTF;
    addstring=addstring+'with plain brass tap';
    addcode=addcode+'-PBTF';
    break;
  case 'woodTap7' :
    addcost=addcost+prcW7TF;
    addstring=addstring+'with 7-inch wood tap';
    addcode=addcode+'-W7TF';
    break;
  case 'woodTap8' :
    addcost=addcost+prcW8TF;
    addstring=addstring+'with 8-inch wood tap';
    addcode=addcode+'-W8TF';
    break;
  case 'woodTap10' :
    addcost=addcost+prcW10TF;
    addstring=addstring+'with 10-inch wood tap';
    addcode=addcode+'-W10TF';
    break;
  default:
    break;
    }
  }



  if( withStand=='withstand') {
    addcost=addcost+prcWBSTD;
    addstring=addstring+', with stand';
    addcode=addcode+'-WBSTD';
  }




switch(sizeOfBarrel) {

  case '40gal' :
    if (withLid=='liftOff') prod_code='WB40';
    else prod_code='BAR40';
    break;
  case '56gal' :
    if (withLid=='liftOff') prod_code='WB56';
    else prod_code='BAR56';
    break;
  case 'butt' :
    if (withLid=='liftOff') prod_code='WB100';
    else prod_code='BAR100';
    break;
  default:
    break;
   }


switch(prod_code) {
  case 'WB40' :
    purchase('40gal water butt with lid: '+addstring+' (WB40'+addcode+')', eval(prcWB40+addcost), 'WB40'+addcode, 0, document.itemsform.qtyWB.value);
    break;
  case 'WB56' :
    purchase('56gal water butt with lid: '+addstring+' (WB56'+addcode+')', eval(prcWB56+addcost), 'WB56'+addcode, 0, document.itemsform.qtyWB.value);
    break;
  case 'WB100' :
    if (showWarning>0) alert(warning100);
    purchase('100gal water butt with lid: '+addstring+' (WB100'+addcode+')', eval(prcWB100+addcost), 'WB100'+addcode, 0, document.itemsform.qtyWB.value);
    break;

  case 'BAR40' :
    purchase('40gal barrel: '+addstring+' (BAR40'+addcode+')', eval(prcBAR40+addcost), 'BAR40'+addcode, 0, document.itemsform.qtyWB.value);
    break;
  case 'BAR56' :
    purchase('56gal barrel: '+addstring+' (BAR56'+addcode+')', eval(prcBAR56+addcost), 'BAR56'+addcode, 0, document.itemsform.qtyWB.value);
    break;
  case 'BAR100' :
    if (showWarning>0) alert(warning100);
    purchase('100gal barrel: '+addstring+' (BAR100'+addcode+')', eval(prcBAR100+addcost), 'BAR100'+addcode, 0, document.itemsform.qtyWB.value);
    break;
  default:
    break;
  }

}


function select_pump_barrel() {

  var i=0;

for (i = 0; i < document.itemsform.PMPSize.length; i++) {
if (document.itemsform.PMPSize[i].checked) {
sizeOfBarrel=document.itemsform.PMPSize[i].value;
break;
   }
 }

for (i = 0; i < document.itemsform.pmpsaver.length; i++) {
if (document.itemsform.pmpsaver[i].checked) {
withsaver=document.itemsform.pmpsaver[i].value;
break;
   }
}


switch(withsaver) {

  case 'saver' :
    addcost=prcRS;
    addstring=' with rainsaver';
    addcode='-RS';
    break;

  case 'notched' :
    addcost=0;
    addstring='';
    addcode='';
    break;

  default :
    break;

}


if (document.itemsform.pmppipeadapt) {
  if (document.itemsform.pmppipeadapt.checked == true) {
  addstring=addstring+', with pipe adaptor';
  addcode=addcode+'-PA';
  addcost=addcost+prcPA;
  if ((withsaver!='saver')&&(showWarning>0)) alert(warningAd);
   }
 }


switch(sizeOfBarrel) {

  case '40gal' :
    purchase('40gal Pump Barrel'+addstring+' (PMP40'+addcode+')', eval(prcPMP40+addcost), 'PMP40'+addcode, 0, document.itemsform.qtyPMP.value);
    break;
  case '56gal' :
    purchase('56gal Pump Barrel'+addstring+' (PMP56'+addcode+')', eval(prcPMP56+addcost), 'PMP56'+addcode, 0, document.itemsform.qtyPMP.value);
    break;
  case 'butt' :
    if (showWarning>0) alert(warning100);
    purchase('100gal Pump Barrel'+addstring+' (PMP100'+addcode+')', eval(prcPMP100+addcost), 'PMP100'+addcode, 0, document.itemsform.qtyPMP.value);
    break;
  default:
    break;
   }

}