	var total;

	function resetAll()
	{
		
		document.frm1.SeasonSub.value = 0;
		document.frm1.miniSub.value = 0;
		document.frm1.Concert1.value = 0;
		document.frm1.Concert2.value = 0;
		document.frm1.Concert3.value = 0;
		document.frm1.Concert4.value = 0;
		document.frm1.Concert5.value = 0;
		document.frm1.Concert6.value = 0;
		document.frm1.Concert7.value = 0;
		document.getElementById("Donor").childNodes[0].nodeValue = "N/A";
		document.frm1.Donation.value = 0;
		calculateTotal();
		document.frm2.AMOUNT.value = 0;
		document.frm2.DESCRIPTION.value = " ";	
		document.getElementById("miniSubOptions").style.display = "none";
	}

	function updateDonor()
	{
		if (document.frm1.Donation.value == 0)
		{
			donorName = "N/A";
		}
		if (document.frm1.Donation.value > 0 && document.frm1.Donation.value < 50)
		{
			donorName = "Contributor";
		}
		if (document.frm1.Donation.value >= 50 && document.frm1.Donation.value < 100)
		{
			donorName = "Devotee";
		}
		if (document.frm1.Donation.value >= 100 && document.frm1.Donation.value < 250)
		{
			donorName = "Patron";
		}
		if (document.frm1.Donation.value >= 250 && document.frm1.Donation.value < 500)
		{
			donorName = "Sponsor";
		}
		if (document.frm1.Donation.value >= 500 && document.frm1.Donation.value < 1000)
		{
			donorName = "Benefactor";
		}
		if (document.frm1.Donation.value >= 5000)
		{
			donorName = "Concert Sponsor";
		}
		document.getElementById("Donor").childNodes[0].nodeValue = donorName;	
	}

	function checkEmpty()
	{
		if (!document.frm1.SeasonSub.value)
		{
			document.frm1.SeasonSub.value = 0;
		}
		if (!document.frm1.miniSub.value)
		{
			document.frm1.SeasonSub.value = 0;
		}
		if (!document.frm1.Concert1.value)
		{
			document.frm1.Concert1.value = 0;
		}
		if (!document.frm1.Concert2.value)
		{
			document.frm1.Concert2.value = 0;
		}
		if (!document.frm1.Concert3.value)
		{
			document.frm1.Concert3.value = 0;
		}
		if (!document.frm1.Concert4.value)
		{
			document.frm1.Concert4.value = 0;
		}
		if (!document.frm1.Concert5.value)
		{
			document.frm1.Concert5.value = 0;
		} 
		if (!document.frm1.Concert6.value)
		{
			document.frm1.Concert6.value = 0;
		}
		if (!document.frm1.Concert7.value)
		{
			document.frm1.Concert7.value = 0;
		}
		if (!document.frm1.Donation.value)
		{
			document.frm1.Donation.value = 0;
		}
	}

	function checkNegative()
	{
		if (document.frm1.SeasonSub.value < 0)
		{
			alert("The number of the tickets for 2008-2009 Series Subscriptions may not be less than 0!");
			return 1;
		}
		if (document.frm1.miniSub.value < 0)
		{
			alert("The number of the tickets for 2008-2009 Series Mini-Subscription for 5 Concerts may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert1.value < 0)
		{
			alert("The number of the tickets for the Daedalus Quartet with Awadagin Pratt may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert2.value < 0)
		{
			alert("The number of the tickets for the Joseph Kalichstein concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert3.value < 0)
		{
			alert("The number of the tickets for the Pro Arte Quartet concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert4.value < 0)
		{
			alert("The number of the tickets for the Yehonatan Berick and Anton Nel concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert5.value < 0)
		{
			alert("The number of the tickets for the Juilliard Quartet concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert6.value < 0)
		{
			alert("The number of the tickets for the Geringas Baryton Trio concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Concert7.value < 0)
		{
			alert("The number of the tickets for the Malcolm Bilson concert may not be less than 0!");
			return 1;
		}
		if (document.frm1.Donation.value < 0)
		{
			alert("The amount for Donation may not be less than 0!");
			return 1;
		}
		return 0;
	}

	function checkEntries()
	{

		if (document.frm1.SeasonSub.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.miniSub.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert1.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert2.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert3.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert4.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert5.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert6.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Concert7.value == "NaN")
		{
			alert("Your entry is invalid.");
			return 1;
		}
		if (document.frm1.Donation.value == "NaN")
		{
			alert("Your Donation amount is invalid.");
			return 1;
		}
		return 0;
	}
	
	function checkRound()
	{
		document.frm1.SeasonSub.value = Math.round(document.frm1.SeasonSub.value);
		document.frm1.miniSub.value = Math.round(document.frm1.miniSub.value);
		document.frm1.Concert1.value = Math.round(document.frm1.Concert1.value);
		document.frm1.Concert2.value = Math.round(document.frm1.Concert2.value);
		document.frm1.Concert3.value = Math.round(document.frm1.Concert3.value);
		document.frm1.Concert4.value = Math.round(document.frm1.Concert4.value);
		document.frm1.Concert5.value = Math.round(document.frm1.Concert5.value);
		document.frm1.Concert6.value = Math.round(document.frm1.Concert6.value);
		document.frm1.Concert7.value = Math.round(document.frm1.Concert7.value);
		document.frm1.Donation.value = Math.round(document.frm1.Donation.value);
	}
	
	function calculateTotal()
	{
		total = eval(document.frm1.SeasonSub.value * 140) + eval(document.frm1.miniSub.value * 100) + eval(document.frm1.Concert1.value * 25) + eval(document.frm1.Concert2.value * 25) + eval(document.frm1.Concert3.value * 25) + eval(document.frm1.Concert4.value * 25) + eval(document.frm1.Concert5.value * 25) + eval(document.frm1.Concert6.value * 25) +  eval(document.frm1.Concert7.value * 25) + eval(document.frm1.Donation.value);
		if (total == "NaN")
		{
			total = 0;
		}
		document.getElementById("TotalDisplay").innerHTML = '<font face="Verdana" color="#ffffff">$' + total + ".00</font>";
	}
	
	function updateTotal()
	{	
		checkEmpty();
		temp = checkEntries();
		if (temp == 1) { return; }		
		temp = checkNegative();
		if (temp == 1) { return; }
		temp = checkRound();
		if (temp == 1) { return; }
		updateDonor();
		calculateTotal();
	}

	function orderTickets()
	{
		checkEmpty();
		temp = checkEntries();
		if (temp == 1) { return false; }		
		temp = checkNegative();
		if (temp == 1) { return false; }
		temp = checkRound();
		if (temp == 1) { return false; }
		updateDonor();
		calculateTotal();
		if (total == 0) {
			alert("Sorry, you cannot place an order with a zero total.");
			return false;
		}
		document.frm2.AMOUNT.value = total;			
		//CREATE DESCRIPTION
		
		if (document.frm1.SeasonSub.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.SeasonSub.value + "] 2008-2009 Series Subscription ";
		}
		if (document.frm1.miniSub.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.miniSub.value + "] 2008-2009 Series Mini-Subscription for 5 Concerts - " + document.frm2.chosenConcerts.value;
		}
		if (document.frm1.Concert1.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert1.value + "] Daedalus Quartet with Awadagin Pratt Ticket(s) ";
		}
		if (document.frm1.Concert2.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert2.value + "] Joseph Kalichstein concert Ticket(s) ";
		}
		if (document.frm1.Concert3.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert3.value + "] Pro Arte Quartet concert Ticket(s) ";
		}
		if (document.frm1.Concert4.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert4.value + "] Yehonatan Berick and Anton Nel concert Ticket(s) ";
		}
		if (document.frm1.Concert5.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert5.value + "] Juilliard Quartet concert Ticket(s) ";
		}
		if (document.frm1.Concert6.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert6.value + "] Geringas Baryton Trio concert Ticket(s) ";
		}
		if (document.frm1.Concert7.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| [" + document.frm1.Concert7.value + "] Malcolm Bilson concert Ticket(s) ";
		}
		if (document.frm1.Donation.value > 0)
		{
			document.frm2.DESCRIPTION.value = document.frm2.DESCRIPTION.value + "| $" + document.frm1.Donation.value + " Donation Amount ";
		}
		
		//alert(document.frm2.DESCRIPTION.value);
		//return false;
	}
//END ORDERING CODE