// JavaScript Document

// function to calculate the total cost field
function Total() {
   var tot = 0; 
   tot += (130.00 * document.order.qty1.value);
   tot += (110.00 * document.order.qty2.value);
   tot += (s * document.order.qty3.value);
   tot += (110.00 * document.order.qty4.value);
   tot += (160.00 * document.order.qty5.value);
//   tot += (120.00 * document.order.qty6.value);
   document.order.totalcost.value = tot;
}

// function to update cost when quantity is changed
function UpdateCost(number, unitcost) {
   costname = "cost" + number;
   qtyname = "qty" + number;
   premnil = "premtype3";
   groups = "qty4";
   var q = document.order[qtyname].value;
   var x = document.order[premnil].value;
   var empty = 0;
   if (x == "") {
   s = empty;
   }
   document.order[costname].value = q * unitcost;
   Total();
}

// function to update cost and price per ticket of premier flight tickets when quantity is changed
function UpdateCost2(number) {
   costname = "cost" + number;
   premname = "premtype" + number;
   qtyname = "qty" + number;
   var r = document.order[qtyname].value;
   var value1 = 250;
   var value2 = 200;
   var value3 = 160;
   if (r == "2") {
   s = value1;
   }
   if (r == "3") {
   s = value2;
   }
   if (r == "4") {
   s = value3;
   }
   if (r > "4") {
alert ('Please select either 2,3 or 4 persons');
   }
   if (r < "2") {
alert ('Please select either 2,3 or 4 persons');
   }

   document.order[premname].value = s;
   document.order[costname].value = r * s;
   Total();
}