/*
 * This file contains functions used on the ticketing forms and information pages
 *
 */


var ticketCost = [17, 16, 15, 10, 3]; /* Adult, Senior, Student, bulk discount threshold, discount per ticket */
var ticketCostHoliday = [7, 7, 5, 100, 0]; /* Adult, Senior, Student, bulk discount threshold, discount per ticket */

 function isBulkDiscount(qAdult, qSenior, qStudent)
 {
     return ((qAdult + qSenior + qStudent) >= ticketCost[3]);
 }

 function calculateTicketCost(show, qAdult, qSenior, qStudent)
 {
     var costToUse;
     if (show == 'holiday') {
         costToUse = ticketCostHoliday;
     } else {
         costToUse = ticketCost;
     }



     var cost = ( qAdult * costToUse[0] ) + 
                ( qSenior * costToUse[1] ) +
                ( qStudent * costToUse[2] );

     var qty  = qAdult + qStudent + qSenior;
     if (qty > costToUse[3]) { cost = cost - qty * costToUse[4]; }

     return cost;
 }

