
var seasonPrice = 0;
var theTotal = 0;


function changeIt(textHere)
  {
  var seasonSection = textHere;
  window.document.seasonForm.perSeason.value = seasonSection;
  }

function totalIt()
 {
 window.document.seasonForm.seasonTotal.value = window.document.seasonForm.ticketQuantity.value * window.document.seasonForm.perSeason.value;
 window.document.seasonForm.Extra_BachTotal.value = window.document.seasonForm.Extra_Bach.value * window.document.seasonForm.ExtraPriceBach.value;
 window.document.seasonForm.Extra_NATTotal.value = window.document.seasonForm.Extra_NAT.value * window.document.seasonForm.ExtraPriceNAT.value;
 window.document.seasonForm.grandTotal.value = (window.document.seasonForm.seasonTotal.value - 0) + (window.document.seasonForm.Extra_BachTotal.value - 0) + (window.document.seasonForm.Extra_NATTotal.value - 0) + (window.document.seasonForm.Partnership.value - 0) + (window.document.seasonForm.Donation.value - 0) + 5;
 window.document.seasonForm.x_Amount.value = Math.round((window.document.seasonForm.grandTotal.value - 0) / (window.document.seasonForm.Payments.value - 0));
 // window.document.seasonForm.AmtLeftToPay.value = (window.document.seasonForm.grandTotal.value - 0) - (window.document.seasonForm.x_Amount.value - 0);
 }

function multIt(Quantity,Price,Result)
{
  Result = (Quantity - 0) * (Price - 0);
  totalIt();
}

function payPlan(FullAmount,PaymentPlan)
{
  window.document.seasonForm.x_amount.value = (FullAmount - 0) / (PaymentPlan - 0);
}

function setDonation(donation_level)
{
  var theDonation = 0;

  if (donation_level == "None")
  {
   theDonation = 0 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }

  if (donation_level == "Premiere")
  {
   theDonation = 5000 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }

  if (donation_level == "Principal")
  {
   theDonation = 3500 - 0;
window.document.seasonForm.Partnership.value = theDonation;
  }

  if (donation_level == "Preferred")
  {
   theDonation = 2500 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }

  if (donation_level == "Partner")
  {
   theDonation = 1500 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Corps")
  {
   theDonation = 1000 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Enthusiast")
  {
   theDonation = 750 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Contributor")
  {
   theDonation = 500 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Supporter")
  {
   theDonation = 250 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Patron")
  {
   theDonation = 100 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Friend")
  {
   theDonation = 50 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Crew")
  {
   theDonation = 200 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  if (donation_level == "Petite")
  {
   theDonation = 100 - 0;
   window.document.seasonForm.Partnership.value = theDonation;
  }
  
  totalIt();

}


function setPrice(Season,Price5,NAT,check,Shows,Nutcracker, extraticket)
  {
	window.document.seasonForm.perSeason.value = Season;
	window.document.seasonForm.ExtraPriceBach.value = Price5;
	window.document.seasonForm.ExtraTicket.value = extraticket;
	window.document.seasonForm.ticketQuantity.value = extraticket;
	totalIt();
	
	switch (Shows)
    {
	 case 6 :
	 window.document.seasonForm.ChooseXShows.value = "Please choose four ballets";
	 window.document.seasonForm.SeasonPackage.value = 4;
	 window.document.seasonForm.S_NAT.disabled = false;
	 break;
     case 5 :
	 window.document.seasonForm.ChooseXShows.value = "You will attend The Nutcracker, and Coppelia";
	 window.document.seasonForm.SeasonPackage.value = 2;
	 window.document.seasonForm.S_NAT.disabled = false;
	 break;
     case 4 :
	 window.document.seasonForm.ChooseXShows.value = "You will attend all shows. Please select New American Talent/Dance date below";
	 window.document.seasonForm.SeasonPackage.value = 5;
	 window.document.seasonForm.S_NAT.disabled = false;
	 break;
     case 3 :
	 window.document.seasonForm.ChooseXShows.value = "You will attend The Bach Project and New American Talent/Dance";
	 window.document.seasonForm.SeasonPackage.value = 2;
	 break;
	 case 2 :
	 window.document.seasonForm.ChooseXShows.value = "Please choose three ballets";
	 window.document.seasonForm.SeasonPackage.value = 3;
	 window.document.seasonForm.S_NAT.disabled = false;
	 break;
     default :
 	 window.document.seasonForm.ChooseXShows.value = ""; 
    } 
	
	if (NAT != 1)
	 {
	 window.document.seasonForm.natdate.options[0].value = "Omit";
	 window.document.seasonForm.natdate.options[0].text = "Omit This Option";
	 }
	else
	 {
	 window.document.seasonForm.natdate.options[0].value = "";
	 window.document.seasonForm.natdate.options[0].text = "-- Select One --";
	 }
	 
	 if (check == 1)
	 {
	 window.document.seasonForm.S_Bach.checked = true;
	 window.document.seasonForm.S_NAT.checked = true;
	 }
	 else if (check == 2)
	 {
	 window.document.seasonForm.S_Bach.checked = true;
	 window.document.seasonForm.S_NAT.checked = false;
	 }
	 else if (check == 3)
	 {
	 window.document.seasonForm.S_Bach.checked = false;
	 window.document.seasonForm.S_NAT.checked = false;
	 }
	 else
	 {
	 window.document.seasonForm.S_Bach.checked = false;
	 window.document.seasonForm.S_NAT.checked = false;
	 }
  } 

function KeepCount() {

var NewCount = 0;
 
if (document.seasonForm.S_Bach.checked)
 {
 NewCount = NewCount + 1;
 }
 
if (document.seasonForm.S_NAT.checked)
 {
 NewCount = NewCount + 1;
 }

document.seasonForm.ShowsChecked.value = NewCount;
} 

function submitForm()
{
	if (window.document.seasonForm.DaySelection.value == "")
	 {
	  alert("Please choose a day of the week for your tickets.");
	  window.document.seasonForm.DaySelection.focus();
	  return false;
	 }
	 
	if (window.document.seasonForm.NewVsRenew.value == "")
	 {
	  alert("Please choose if new or renewing.");
	  window.document.seasonForm.NewVsRenew.focus();
	  return false;
	 }
	 
	if (window.document.seasonForm.x_first_name.value == "")
	{
	  alert("Please enter your first name.");
	  window.document.seasonForm.x_first_name.focus();
	  return false;
	}

	if (window.document.seasonForm.x_last_name.value == "")
	{
	  alert("Please enter your last name.");
	  window.document.seasonForm.x_last_name.focus();
	  return false;
	}

	if (window.document.seasonForm.x_address.value == "")
	{
	  alert("Please enter your address.");
	  window.document.seasonForm.x_address.focus();
	  return false;
	}

	if (window.document.seasonForm.x_city.value == "")
	{
	  alert("Please enter your city.");
	  window.document.seasonForm.x_city.focus();
	  return false;
	}

	if (window.document.seasonForm.x_state.value == "")
	{
	  alert("Please enter your state.");
	  window.document.seasonForm.x_state.focus();
	  return false;
	}

	if (window.document.seasonForm.x_zip.value == "")
	{
	  alert("Please enter your zip code.");
	  window.document.seasonForm.x_zip.focus();
	  return false;
	}

	if (window.document.seasonForm.x_phone.value == "(512)")
	{
	  alert("Please enter your evening phone number.");
	  window.document.seasonForm.x_phone.focus();
	  return false;
	}

	if (window.document.seasonForm.DayPhone.value == "(512)")
	{
	  alert("Please enter your daytime phone number.");
	  window.document.seasonForm.DayPhone.focus();
	  return false;
	}

	if (window.document.seasonForm.x_email.value == "")
	{
	  alert("Please enter your email address.");
	  window.document.seasonForm.x_email.focus();
	  return false;
	}
	
	if (window.document.seasonForm.SeasonPackage.value == "")
	{
	  alert("Please choose a season package by clicking on the price of the package.");
	  window.document.seasonForm.DaySelection.focus();
	  return false;
	}
	
	if (((window.document.seasonForm.SeasonPackage.value - 0) != (window.document.seasonForm.ShowsChecked.value - 0)) && ((window.document.seasonForm.ChooseXShows.value == "Please choose four ballets") || (window.document.seasonForm.ChooseXShows.value == "Please choose three ballets")))
	{
	  alert("Please select correct number of performances for selected series.");
	  window.document.seasonForm.DaySelection.focus();
	  return false;
	}

	if (window.document.seasonForm.security_code.value == "")
	{
	  alert("Please enter the 5 digit security code before proceeding!");
	  window.document.seasonForm.security_code.focus();
	  return false;
	}
}

//function not used
function submitIt(seasonForm) 
{	
	if (window.document.seasonForm.DaySelection.value == "")
	 {
	  alert("Please choose a day.");
	  window.document.seasonForm.DaySelection.focus();
	  return false;
	 }
	 
	if (window.document.seasonForm.NewVsRenew.selectedIndex == 0)
	 {
	  alert("Please choose if new or renewing.");
	  window.document.seasonForm.NewVsRenew.focus();
	  return false;
	 }
	
	if (window.document.seasonForm.seatingSelection.value == "")
	 {
	  alert("Please choose a section.");
	  window.document.seasonForm.seatingSelection.focus();
	  return false;
	 }

	if (window.document.seasonForm.ticketQuantity.value < 1)
	 {
	  alert("Please enter a valid number of tickets.");
	  window.document.seasonForm.ticketQuantity.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_first_name.value == "")
	 {
	  alert("Please enter your first name");
	  window.document.seasonForm.x_first_name.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_last_name.value == "")
	 {
	  alert("Please enter your last name.");
	  window.document.seasonForm.x_last_name.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_address.value == "")
	 {
	  alert("Please enter your address.");
	  window.document.seasonForm.x_address.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_city.value == "")
	 {
	  alert("Please enter your city.");
	  window.document.seasonForm.x_city.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_state.value == "")
	 {
	  alert("Please enter your state.");
	  window.document.seasonForm.x_state.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_zip.value == "")
	 {
	  alert("Please enter your zip code.");
	  window.document.seasonForm.x_zip.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_phone.value == "")
	 {
	  alert("Please enter your evening phone number.");
	  window.document.seasonForm.x_phone.focus();
	  return false;
	 }

	if (window.document.seasonForm.x_email.value == "")
	 {
	  alert("An email address is required to receive a receipt.");
	  window.document.seasonForm.x_email.focus();
	  return false;
	 }
	
	if (window.document.seasonForm.security_code.value == "")
	{
	  alert("Enter the 5 digit security code before proceeding!");
	  window.document.seasonForm.security_code.focus();
	  return false;
	}

	return true;
}
