function getStyleObject(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		return getObjNN4(document,objectId);
	} else {
		return false;
	}
}

function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId, document);
    if(styleObject) {
	styleObject.display = newVisibility;
	return true;
    } else {
	return false;
    }
}

function sectionOneComplete(){
	if(document.getElementById && document.createTextNode)
	{
	  if(document.getElementById('section-01-complete'))
	  {
		document.getElementById('section-01-complete').className='complete';
	  }
	}
}

function sectionTwoComplete(){
	if(document.getElementById && document.createTextNode)
	{
	  if(document.getElementById('section-02-complete'))
	  {
		document.getElementById('section-02-complete').className='complete';
	  }
	}
}

function sectionThreeComplete(){
	if(document.getElementById && document.createTextNode)
	{
	  if(document.getElementById('section-03-complete'))
	  {
		document.getElementById('section-03-complete').className='complete';
	  }
	}
}





function CC(InString)
// Robert Thompson
// 5/24/01
// validates numbers of credit card number and returns number string formated in credit card form.
// does NOT verify if card number is good.

{ 

var outstring = "";
var tempstring = "";

// Strip off non-numeric characters:
for (index=0; index<InString.length; index++)
	if ((InString.charAt(index) >= "0") && (InString.charAt(index)) <= "9")
	tempstring += InString.charAt(index);

if ((tempstring.charAt(0) > "3") && (tempstring.charAt(0) < "7") && (tempstring.length==16))
	{
		outstring = tempstring.substring(0,4) + "-" 
		+ tempstring.substring(4,8) + "-" 
		+ tempstring.substring(8,12) + "-" 
		+ tempstring.substring(12,16);
		return outstring;
	}

if ((tempstring.charAt(0)=="3") && (tempstring.length==15))
	{
	outstring = tempstring.substring(0,4) + "-" 
	+ tempstring.substring(4,10) + "-" 
	+ tempstring.substring(10,15);
	return outstring;	
	} 
	
alert("Invalid Credit Card");
return "";
  
}


function CleanString(inString)
{
// R. Thompson 5/16/01
// removes everything but numbers from string
// compacts numbers to front of returned string
// builds readable phone number format

var numbercount=0;
var tempstring="";
var area="";
var exch="";
var pnumber="";
var ext="";
var outstring="";

// parse incoming string and strip non-digits
for (index = 0; index < inString.length; index++)
	{
 	// Check each character, if a number, append to tempstring else skip
 	if (inString.charAt(index)>="0" && inString.charAt(index)<="9") 
 		{
 		// number found
 		// following line is for debug only.
 		// window.document.write("index = ",index," . ", inString.charAt(index), "-->");
 		// append character to tempstring
 		
 		tempstring += inString.charAt(index);
		
		// following line is for debug only.
		// window.document.writeln(tempstring,"<br>");
		}
	}
// end "for"
// tempstring now holds cleaned number string
	
	// strip leading 1 or 0
	if (tempstring.charAt(0)<"2") tempstring=tempstring.substring(1,tempstring.length);
	
	// Build phone number
	
	area=tempstring.substring(0,3);
	exch=tempstring.substring(3,6);
	pnumber=tempstring.substring(6,10);
	if (tempstring.length>10) ext = " x " + tempstring.substring(10,tempstring.length);
	
	outstring= "(" + area +")" + " " + exch + "-" + pnumber +  ext;
	
	// Following line for debug only
	
	// window.document.writeln("<br>",inString,"<br>",tempstring,"<br>",outstring);
	
	return	outstring;
}

function calcPrice()
{
var pkg = window.document.FrontPage_Form1.series.value;
switch (pkg)
	{
	case "0":
		alert ("This is not a valid choice.  Please try again.");
		window.document.FrontPage_Form1.price.value = 0;
		break;
	case "Orch, Prev Tue Eve":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Prev Wed Eve":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Prev Fri Eve":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Prev Sat Eve":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Prev Sun Mat":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Prev Sun Eve":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Tues Mat":
		window.document.FrontPage_Form1.price.value = 344;
		break;
	case "Orch, Wed Mat":
		window.document.FrontPage_Form1.price.value = 344;
		break;

	case "Orch, Tues Eve":
		window.document.FrontPage_Form1.price.value = 376;
		break;
	case "Orch, Wed Eve":
		window.document.FrontPage_Form1.price.value = 376;
		break;
	case "Orch, Thurs Eve":
		window.document.FrontPage_Form1.price.value = 376;
		break;
	case "Orch, Sun Eve":
		window.document.FrontPage_Form1.price.value = 376;
		break;
	case "Orch, EARLY Sun Eve":
		window.document.FrontPage_Form1.price.value = 376;
		break;

	case "Orch, Sat Mat":
		window.document.FrontPage_Form1.price.value = 416;
		break;
	case "Orch, Sun Mat":
		window.document.FrontPage_Form1.price.value = 416;
		break;

	case "Orch, Thur Open":
		window.document.FrontPage_Form1.price.value = 456;
		break;
	case "Orch, Fri Eve":
		window.document.FrontPage_Form1.price.value = 456;
		break;
	case "Orch, Sat Eve":
		window.document.FrontPage_Form1.price.value = 456;
		break;

	case "Mix, Prev Tues Eve":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Prev Wed Eve":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Prev Fri Eve":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Prev Sat Eve":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Prev Sun Mat":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Prev Sun Eve":
		window.document.FrontPage_Form1.price.value = 328;
		break;
		
	case "Mix, Tues Mat":
		window.document.FrontPage_Form1.price.value = 328;
		break;
	case "Mix, Wed Mat":
		window.document.FrontPage_Form1.price.value = 328;
		break;

	case "Mix, Tues Eve":
		window.document.FrontPage_Form1.price.value = 360;
		break;
	case "Mix, Wed Eve":
		window.document.FrontPage_Form1.price.value = 360;
		break;
	case "Mix, Thur Eve":
		window.document.FrontPage_Form1.price.value = 360;
		break;
	case "Mix, Sun Eve":
		window.document.FrontPage_Form1.price.value = 360;
		break;
	case "Mix, EARLY Sun Eve":
		window.document.FrontPage_Form1.price.value = 360;
		break;

	case "Mix, Sat Mat":
		window.document.FrontPage_Form1.price.value = 400;
		break;
	case "Mix, Sun Mat":
		window.document.FrontPage_Form1.price.value = 400;
		break;

	case "Mix, Thur Open":
		window.document.FrontPage_Form1.price.value = 440;
		break;
	case "Mix, Fri Eve":
		window.document.FrontPage_Form1.price.value = 440;
		break;
	case "Mix, Sat Eve":
		window.document.FrontPage_Form1.price.value = 440;
		break;
	}
}



var session1 = 0;
var session2 = 0;
var session3 = 0;

function calcTotal()
{
// calcTotal calculates the total cost of the Subs Package and fills in the TOTAL field
	var one = parseInt(window.document.FrontPage_Form1.price.value);
	var two = parseInt(window.document.FrontPage_Form1.subscriptionNumber.value);
	var three = parseInt(window.document.FrontPage_Form1.parking.value);
	var six = parseInt(window.document.FrontPage_Form1.gift.value);
		if ( isNaN(six))
	       six = 0;
	var seven = parseInt(window.document.FrontPage_Form1.kiki_herb_tickets.value);
	if ( isNaN(seven))
	       seven = 0;
	var eight = parseInt(window.document.FrontPage_Form1.emergen_cee_tickets.value);
	if ( isNaN(eight))
	       eight = 0;	       
	var nine = parseInt(window.document.FrontPage_Form1.parking_kiki.value);
	var ten = parseInt(window.document.FrontPage_Form1.parking_emergence_see.value);
	var calc = (one * two) + three + six + (seven * 40) + (eight * 40) + nine + ten;
	window.document.FrontPage_Form1.TOTAL.value = calc;
}

function subscriptionVariables(){
	var x
	var playPrices = new Array()
		playPrices[0] = 400  // 8 plays
		playPrices[1] = 300  // 6 plays
		playPrices[2] = 200  // 4 plays
		playPrices[3] = 100  // 3 plays

	for (x in playPrices){
		if (document.FrontPage_Form1.numberPlays[0].checked == true){
			//alert(playPrices[0] + parseInt(document.FrontPage_Form1.price.value));
			document.FrontPage_Form1.newPrice.value = playPrices[0] + parseInt(document.FrontPage_Form1.price.value);
			return false;
			}
		if (document.FrontPage_Form1.numberPlays[1].checked == true){
			//alert(playPrices[1] + parseInt(document.FrontPage_Form1.price.value));
			document.FrontPage_Form1.newPrice.value = playPrices[1] + parseInt(document.FrontPage_Form1.price.value);
			return false;
			}
		if (document.FrontPage_Form1.numberPlays[2].checked == true){
			//alert(playPrices[2] + parseInt(document.FrontPage_Form1.price.value));
			document.FrontPage_Form1.newPrice.value = playPrices[2] + parseInt(document.FrontPage_Form1.price.value);
			return false;
			}
		if (document.FrontPage_Form1.numberPlays[3].checked == true){
			//alert(playPrices[3] + parseInt(document.FrontPage_Form1.price.value));
			document.FrontPage_Form1.newPrice.value = playPrices[3] + parseInt(document.FrontPage_Form1.price.value);
			return false;
			}
		}
}

function calcTotal5(){
	var seating = document.FrontPage_Form1.newPrice.value;
	var subscriptions = document.FrontPage_Form1.subscriptionNumber.selectedIndex;
	var kiki = document.FrontPage_Form1.kiki_herb_tickets.selectedIndex * 40;
	var emergencee = document.FrontPage_Form1.emergen_cee_tickets.selectedIndex * 40;
	var kikiParking = document.FrontPage_Form1.parking_kiki.selectedIndex * 10;
	var emergenceeParking = document.FrontPage_Form1.parking_emergence_see.selectedIndex * 10;
	var donation = parseInt(document.FrontPage_Form1.gift.value);
	var generalParking = parseInt(document.FrontPage_Form1.parking.selectedIndex) * 80;

	var calculate = (seating * subscriptions) + kiki + emergencee + kikiParking + emergenceeParking + donation + generalParking;
	document.FrontPage_Form1.TOTAL.value = calculate;
	return false;
}


function backButtons(){
	if(document.getElementById('back-02')){
		changeObjectVisibility('section-02', 'none');
		changeObjectVisibility('section-01', 'block');
		changeObjectVisibility('section-03', 'none');
		changeObjectVisibility('section-04', 'none');
	}
	if(document.getElementById('back-03')){
		changeObjectVisibility('section-02', 'block');
		changeObjectVisibility('section-01', 'none');
		changeObjectVisibility('section-03', 'none');
		changeObjectVisibility('section-04', 'none');
	}
	if(document.getElementById('back-04')){
		changeObjectVisibility('section-02', 'none');
		changeObjectVisibility('section-01', 'none');
		changeObjectVisibility('section-03', 'block');
		changeObjectVisibility('section-04', 'none');
	}
}


function calcTotal2(){
	var one = parseInt(session1);
	var two = parseInt(session2);
	var three = parseInt(session3);
	var calc = one + two + three;
	window.document.FrontPage_Form1.TOTAL.value = calc;
}



function calcPrice1()
{
var session = window.document.FrontPage_Form1.c1_session.value;
switch (session)
	{
	case "(select a session)":
		session1 = 0;
		break;
	case "4-week":
		session1 = 1600;
		break;
	case "2-week":
		session1 = 900;
		break;
	case "both":
		session1 = 2400;
		break;
	}
}
calcTotal2();


function calcPrice2()
{
var session = window.document.FrontPage_Form1.c2_session.value;
switch (session)
	{
	case "(select a session)":
		session2 = 0;
		break;
	case "4-week":
		session2  = 1600;
		break;
	case "2-week":
		session2  = 900;
		break;
	case "both":
		session2  = 2400;
		break;
	}
}
calcTotal2();



function calcPrice3()
{
var session = window.document.FrontPage_Form1.c3_session.value;
switch (session)
	{
	case "(select a session)":
		session3 = 0;
		break;
	case "4-week":
		session3 = 1600;
		break;
	case "2-week":
		session3 = 900;
		break;
	case "both":
		session3 = 2400;
		break;
	}
}
calcTotal2();