// JavaScript Document

function calcFees(){
  
  var adult1Joining=69;
  var adult2Joining=50;
  var child1Joining=39;
  var child2Joining=25;
  var adultMonthly=15;
  var childMonthly=8;
  
  var numAdults=document.getElementById('numAdults').value;
  var numChildren=document.getElementById('numChildren').value;
  
  // Calc joining fee
  if(numAdults>0){
    var priceJoiningAdults=(adult1Joining+(adult2Joining*(numAdults-1)));
  } else {
	var priceJoiningAdults=0;
  }
  if(numChildren>0){
    var priceJoiningChildren=(child1Joining+(child2Joining*(numChildren-1)));
  } else {
    var priceJoiningChildren=0;
  }
  
  // Calc monthly fee
  var priceMonthlyAdults=adultMonthly*numAdults;
  var priceMonthlyChildren=childMonthly*numChildren;
  
  var priceJoiningTotal=priceJoiningAdults+priceJoiningChildren;
  var priceMonthlyTotal=priceMonthlyAdults+priceMonthlyChildren;
  
  if(numAdults==1){
    document.getElementById('dispAdults').innerHTML=numAdults+' adult';
  } else {
	document.getElementById('dispAdults').innerHTML=numAdults+' adults';
  }
  if(numChildren==1){
    document.getElementById('dispChildren').innerHTML=numChildren+' child';
  } else {
	document.getElementById('dispChildren').innerHTML=numChildren+' children';
  }
  
  var priceDailyTotal = (priceMonthlyTotal*12)/365;
  
  document.getElementById('feeJoining').innerHTML=priceJoiningTotal.toFixed(2);
  document.getElementById('feeMonthly').innerHTML=priceMonthlyTotal.toFixed(2);
  document.getElementById('feeDaily').innerHTML=priceDailyTotal.toFixed(2);
}

function calcFeeshp(){
  
  var adult1Joining=69;
  var adult2Joining=50;
  var child1Joining=39;
  var child2Joining=25;
  var adultMonthly=15;
  var childMonthly=8;
  
  var numAdults=document.getElementById('numAdultshp').value;
  var numChildren=document.getElementById('numChildrenhp').value;
  
  // Calc joining fee
  if(numAdults>0){
    var priceJoiningAdults=(adult1Joining+(adult2Joining*(numAdults-1)));
  } else {
	var priceJoiningAdults=0;
  }
  if(numChildren>0){
    var priceJoiningChildren=(child1Joining+(child2Joining*(numChildren-1)));
  } else {
    var priceJoiningChildren=0;
  }
  
  // Calc monthly fee
  var priceMonthlyAdults=adultMonthly*numAdults;
  var priceMonthlyChildren=childMonthly*numChildren;
  
  var priceJoiningTotal=priceJoiningAdults+priceJoiningChildren;
  var priceMonthlyTotal=priceMonthlyAdults+priceMonthlyChildren;
  
  if(numAdults==1){
    document.getElementById('dispAdultshp').innerHTML=numAdults+' adult';
  } else {
	document.getElementById('dispAdultshp').innerHTML=numAdults+' adults';
  }
  if(numChildren==1){
    document.getElementById('dispChildrenhp').innerHTML=numChildren+' child';
  } else {
	document.getElementById('dispChildrenhp').innerHTML=numChildren+' children';
  }
  
  var priceDailyTotal = (priceMonthlyTotal*12)/365;
  
  document.getElementById('feeJoininghp').innerHTML=priceJoiningTotal.toFixed(2);
  document.getElementById('feeMonthlyhp').innerHTML=priceMonthlyTotal.toFixed(2);
  document.getElementById('feeDailyhp').innerHTML=priceDailyTotal.toFixed(2);
}
