﻿function replaceText(string,objectName) {
	newString = string.replace(/\'/g, "");
	newString = newString.replace(/\"/g, "");
	newString = newString.replace(/\;/g, "");
	newString = newString.replace(/\,/g, "");
	//newString = newString.replace(/:/g, "<br />");
	newString = newString.replace(/\n/g, "<br />");  // line break
	
	if ( window.navigator.platform == "MacPPC") {
		if (window.navigator.appName == "Microsoft Internet Explorer") {
			newString = newString.replace(/\r/g, "<br />");  // line break
		}
	}
	document.registration[objectName].value = newString;
}



function checkForm() {

	// make sure they entered their name
	if (document.registration.first_name.value == "") {
		alert ("Please enter your first name.");
		document.registration.first_name.focus();
		return false;
	}
	
	if (document.registration.last_name.value == "") {
		alert ("Please enter your last name.");
		document.registration.last_name.focus();
		return false;
	}
	
	
	// make sure they entered their phone
	if (document.registration.phone.value == "") {
		alert ("Please enter your phone numnber.");
		document.registration.phone.focus();
		return false;
	}
	
	
	// make sure they entered their email
	if (document.registration.email.value == "") {
		alert ("Please enter your e-mail address.");
		document.registration.email.focus();
		return false;
	}
	
	// make sure they entered their state
	if (document.registration.address_state.selectedIndex == 0) {
		alert ("Please choose your state.");
		document.registration.address_state.focus();
		return false;
	}
	
	// make sure they chose a starting point
	if (document.registration.starting_point.selectedIndex == 0) {
		alert ("Please choose your ride starting point.");
		document.registration.starting_point.focus();
		return false;
	}
		
	// make sure they checked the agree button
	if (!document.registration.agreement.checked) {
		alert ("You have to agree to the Release Form above before submission.");
		document.registration.agreement.focus();
		return false;
	}
	
	
	
	// else everything is in order
	return true;

}