// JavaScript Document

function DisplayTicketFeeNum (TicketNumber) {
  var TempTicketFee = document.getElementById('TicketType').value;
  var TicketFee = TempTicketFee.split('|');
  var TicketNum = document.getElementById('TicketNum').value; // (user input pay amount)
  document.getElementById('txtticketfee').value = (TicketFee[1] * TicketNum); //(display room fee when item is selected)
}

function RoomPackageRate () {
  var FromDateField = document.getElementById('FromDate').value;
  var Nights = document.getElementById('Nights').value;
  var FromDateSplit = FromDateField.split('/');
  var FormattedDate = new Date();
  var FormattedDay = FromDateSplit[1];
  var FormattedMonth = FromDateSplit[0];
  FormattedDate.setDate(FormattedDay);
  FormattedDate.setMonth(FormattedMonth-1);
  FormattedDate.setYear(FromDateSplit[2]);

  var Date1From = new Date();
  Date1From.setDate(26);
  Date1From.setMonth(2);
  Date1From.setYear(2010);
  var Date1To = new Date();
  Date1To.setDate(4);
  Date1To.setMonth(3);
  Date1To.setYear(2010);
  var Date2From = new Date();
  Date2From.setDate(23);
  Date2From.setMonth(11);
  Date2From.setYear(2010);
  var Date2To = new Date();
  Date2To.setDate(2);
  Date2To.setMonth(0);
  Date2To.setYear(2011);
  
  var RoomType = document.getElementById('RoomType').value;
  var TotalRoomPrice=0;
  var i=0;
  
  if (RoomType == "2 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+90;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+115;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+75;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+95;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+120;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+80;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+105;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+90;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+120;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+105;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+155;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+115;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "5 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+144;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+169;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+129;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "6 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+160;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+185;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  return TotalRoomPrice;
}

function ReservationRequestRate (FormRoomType, FormFromDate, FormNights) {
  var FromDateField = FormFromDate;
  var Nights = FormNights;
  var FromDateSplit = FromDateField.split('/');
  var FormattedDate = new Date();
  var FormattedDay = FromDateSplit[1];
  var FormattedMonth = FromDateSplit[0];
  FormattedDate.setDate(FormattedDay);
  FormattedDate.setMonth(FormattedMonth-1);
  FormattedDate.setYear(FromDateSplit[2]);

  var Date1From = new Date();
  Date1From.setDate(26);
  Date1From.setMonth(2);
  Date1From.setYear(2010);
  var Date1To = new Date();
  Date1To.setDate(4);
  Date1To.setMonth(3);
  Date1To.setYear(2010);
  var Date2From = new Date();
  Date2From.setDate(23);
  Date2From.setMonth(11);
  Date2From.setYear(2010);
  var Date2To = new Date();
  Date2To.setDate(2);
  Date2To.setMonth(0);
  Date2To.setYear(2011);
  
  var RoomType = FormRoomType;
  var TotalRoomPrice=0;
  var i=0;
  
  if (RoomType == "2 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+90;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+115;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+75;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+95;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+120;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+80;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+105;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+90;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+120;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+105;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+155;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+115;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "5 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+144;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+169;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+129;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "6 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+160;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+185;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  return TotalRoomPrice;
}

function RoomRetailRate () {
  var FromDateField = document.getElementById('FromDate').value;
  var Nights = document.getElementById('Nights').value;
  var FromDateSplit = FromDateField.split('/');
  var FormattedDate = new Date();
  var FormattedDay = FromDateSplit[1];
  var FormattedMonth = FromDateSplit[0];
  FormattedDate.setDate(FormattedDay);
  FormattedDate.setMonth(FormattedMonth-1);
  FormattedDate.setYear(FromDateSplit[2]);

  var Date1From = new Date();
  Date1From.setDate(26);
  Date1From.setMonth(2);
  Date1From.setYear(2010);
  var Date1To = new Date();
  Date1To.setDate(4);
  Date1To.setMonth(3);
  Date1To.setYear(2010);
  var Date2From = new Date();
  Date2From.setDate(23);
  Date2From.setMonth(11);
  Date2From.setYear(2010);
  var Date2To = new Date();
  Date2To.setDate(2);
  Date2To.setMonth(0);
  Date2To.setYear(2011);
  
  var RoomType = document.getElementById('RoomType').value;
  var TotalRoomPrice=0;
  var i=0;
  
  if (RoomType == "2 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+155;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+115;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+135;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+160;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+120;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Luxury Villa")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+170;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+130;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "3 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+160;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+185;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+145;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "4 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+170;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+195;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+155;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "5 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+184;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+209;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+169;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  if (RoomType == "6 Bedroom Pool Home")
  {
  for (i=0;i<Nights;i++) {
    if (Date1From<=FormattedDate && FormattedDate<=Date1To) {
	  TotalRoomPrice=TotalRoomPrice+200;
	}
	else if (Date2From<=FormattedDate && FormattedDate<=Date2To) {
	  TotalRoomPrice=TotalRoomPrice+225;
	}
	else {
	  TotalRoomPrice=TotalRoomPrice+185;
	}
	FormattedDate.setDate(FormattedDate.getDate()+1);
  }
  }
  
  return TotalRoomPrice;
}