/**
 * Function that returns the donation value based on number of sensors to donate
 **/

function calculateTotal(frm){
   var quantity   = parseFloat(frm.quantity.value)
   var costper    = 49
   var total      = 0

   //Convert all values to integers or numbers
   quantity    = parseFloat(quantity)

   total = quantity*costper
   frm.total.value = total
}
/**
 * Function that returns the donation value based on number of sensors to donate
 **/


function calculateTotalK12_02(frm){
   var quantity   = parseFloat(frm.quantity.value)
   if (frm.sensor1[0].checked) {
    var sensor1    = parseFloat(frm.sensor1[0].value)
   }
   if (frm.sensor1[1].checked) {
    var sensor1    = parseFloat(frm.sensor1[1].value)
   }
   if (frm.sensor2[0].checked) {
    var sensor2    = parseFloat(frm.sensor2[0].value)
   }
   if (frm.sensor2[1].checked) {
    var sensor2    = parseFloat(frm.sensor2[1].value)
   }
   if (frm.sensor3[0].checked) {
    var sensor3    = parseFloat(frm.sensor3[0].value)
   }
   if (frm.sensor3[1].checked) {
    var sensor3    = parseFloat(frm.sensor3[1].value)
   }
   var costper    = 49
   var total      = 0

   //Convert all values to integers or numbers
   quantity    = parseFloat(quantity)

   total = quantity*costper+sensor1+sensor2+sensor3
   frm.total.value = total
}


function calculateTotalK12(frm){
   var quantity_sub      = parseFloat(frm.quantity_sub.value)
   var quantity_normal   = parseFloat(frm.quantity_normal.value)
   var costper_sub       = 5
   var costper_normal    = 49
   var total             = 0

   //Convert all values to integers or numbers
   quantity_sub    = parseFloat(quantity_sub)

   if (quantity_sub > 3) {
     quantity_sub = 3
     frm.quantity_sub.value = 3
   }
   total = quantity_sub*costper_sub+quantity_normal*costper_normal
   frm.total.value = total
}
