function setEbyId(id, value) { document.getElementById(id).innerHTML = value }

var refDate;
function updateInfo () {
//alert("start of update");
	var theForm = document.signup_form;
	var cost, late_fee, event_date, event_name;
	switch (theForm.eventcode.value) {
//		case "F"	: cost = 40.00; late_fee = 2.50; event_date = "02/11/2011"; event_name = "February Fling (Solvang)"; break;
		case "M"	: cost = 40.00; late_fee = 2.50; event_date = "05/25/2012"; event_name = "Memorial Day Weekend (Hemet)"; break;
		case "J-A2"	: cost = 35.00; late_fee = 0.00; event_date = "06/08/2012"; event_name = "June Fling - A2 Sessions (St. Louis)"; break;
		case "J-C1"	: cost = 42.50; late_fee = 0.00; event_date = "06/08/2012"; event_name = "June Fling - A2 &amp; C1 Sessions (St. Louis)"; break;
		case "S"	: cost = 40.00; late_fee = 2.50; event_date = "10/07/2011"; event_name = "Silver Star (Hesperia)";
		case "N"	: cost = 40.00; late_fee = 2.50; event_date = "11/18/2011"; event_name = "November Shuffle (Hemet)"; break;
//		case "8"	: cost = 18.00; late_fee = 0.00; event_date = "12/31/2010"; event_name = "New Year's Eve 2010"; break; break;
		case ""		: cost =  0.00; late_fee = 0.00; event_date = null; event_name = "No event selected"; break;
		default		: cost =  0.00; late_fee = 0.00; event_date = null; event_name = "RS unspecified";
	}
//alert("selected event: " + theForm.eventcode.value + " = " + event_name);
	if (event_date) {
		if (refDate <= (new Date(event_date) - (14 * 24 * 60 * 60 * 1000)))	// Check if early bird discount applies
			late_fee = 0;
		else if (refDate >= new Date(event_date))
			alert("I'm sorry, but this event has already occured.  Please select another event.  Thank you."+refDate+" "+event_date);
	}
	theForm.r_eventname.value = event_name;
//alert("event cost: " + cost + "; late fee: " + late_fee + "; refDate: " + refDate);

	var entrants = 0;
	var firstName = theForm.r_fullname.value;
	if (firstName) entrants++;
	if (firstName && firstName.indexOf(" ") == -1) alert("WARNING: Only partial name entered for primary registrant.  Please enter FULL name.");
	if (theForm.partnername.value) entrants++;

	var theCost = (cost + late_fee) * entrants;
	theForm.eventcost.value = theCost ? "$" + theCost + (theCost % 1 != 0 ? "0" : ".00") : "";
//alert("total entrants: " + entrants + "; total event cost: " + theCost + " (cost = " + cost + "; late_fee = " + late_fee + ")");
	theForm.r_eventdate.value = event_date ? dateToStr(new Date(event_date),"01, 02 4, 05") : "";
//alert("eventdate: " + theForm.r_eventdate.value + "; eventcost: " + theForm.eventcost.value);
	setEbyId("dateText", event_date ? "This event starts on " + theForm.r_eventdate.value : "");
	setEbyId("costText", !theCost ? (cost == 0 ? "* No registration fee *" : "$" + ((cost + late_fee)*2) + ".00 / couple") : "<div style='border: solid thin black; padding: 3px 1px'><b>Total registration cost for this event: " + theForm.eventcost.value + "<\/b><br>Number of people included in this registration: " + numberToText(entrants).toUpperCase() + (!late_fee ? "" : "<br /><span style='color: red'>This registration does not include the earlybird discount.<\/span>") + "</div>");
//alert("event date: " + event_date);
}

//alert("\nYou can pay for any of these events by U.S. Mail.  You also have the option to pay electronically.\n\nTo sign-up for any event and submit all information electronically (i.e., no U.S. mail involved), use the following steps:\n\n1. Fill out the below form -- do NOT yet hit the SEND INFO button!\n\n(Note that the total amount due for this event will be shown at the bottom of this form.)\n\n2. Click on the PayPal seal at the bottom of the page and submit your payment via PayPal.com.  You can use an existing PayPal account -OR- you can easily create one (no fee to open a PayPal account) -- Yes, PayPal does accept credit cards for your payments.\n\n3. Once payment has been submited via PayPal, return to this window and PRINT this form for your records.\n\n4. Finally, send your information to Romney by using the SEND INFO button at the bottom of this page.\n\nThat's it and you'll be fully registered for the event.\n\n\nAnd thank you for attending another Romney Star's event.  See you in a square.");

