function toggle( val ) {
  frm = document.cPriceForm;
	if( val == 1 ) {
    frm.env.disabled   = false;
    frm.mech.disabled  = false;
    frm.light.disabled = false
    }
  else {
    frm.mech.disabled  = true;
    frm.env.disabled   = true;
    frm.light.disabled = true;
  }
}

function calculate() {
  frm = document.cPriceForm;
  mult = 0;
  
  //residential selected
  if( frm.res[0].checked ) {
    unit = 0.14;
    mini = 199;
    mult = 1;
  }
  
  //commercial selected
  if( frm.res[1].checked ) {
    unit = 0.14;
    if( !frm.mech.checked && !frm.env.checked && !frm.light.checked ) {
      alert('You must select a Report Type for a commercial quote');
    }
    if( frm.env.checked ) {
      mult++;
    }
    if( frm.mech.checked ) {
      mult++;
    }
    if( frm.light.checked ) {
      mult++;
    }
    mini = 199 * mult;
  }  
  
  square = Number(frm.cSqFt.value);
  
  if( isNaN(square) || square < 1 ) {
    alert('Please enter a valid amount for the Square Footage.');
    price = '';
  }
  else {
    price = square * unit * mult
    if( price < mini ) {
      price = mini;
    }
  }
  
  frm.cPrice.value = price.toFixed(2);
}
