function validateForm(theform) {
	
	
	
	var errMsg = '';
	//
	// 	rules
	//
	
	myOption = -1;
	for (i=theform.rules.length-1; i > -1; i--) {
		if (theform.rules[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1 ) {
		errMsg = errMsg + ("- Please indicate that you have read the official contest rules.\n");
	}
	
	var user_input='';
	for (i=0;i<document.theform.rules.length;i++) {
		if (document.theform.rules[i].checked) {
			user_input = document.theform.rules[i].value;
		}
	}
	 
	if(user_input == 'No') {
	
		errMsg = errMsg + ("- Please indicate that you have read the official contest rules\n");
		
	}	
	
	
	
	myOption = -1;
	for (i=theform.agree.length-1; i > -1; i--) {
		if (theform.agree[i].checked) {
		myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- You must agree to the contest rules to proceed.\n");
	}
	
	var user_input='';
	for (i=0;i<document.theform.agree.length;i++) {
		if (document.theform.agree[i].checked) {
			user_input = document.theform.agree[i].value;
		}
	}
	 
	if(user_input == 'No') {
	
		errMsg = errMsg + ("- You must agree to the contest rules to proceed.\n");
		
	}	
	
	//
	// contact information
	//
	if (document.theform.fname.value == "") {
		errMsg = errMsg + ("- Please enter your first name.\n");
	}
	
	if (document.theform.lname.value == "") {
		errMsg = errMsg + ("- Please enter your last name.\n");
	}
	
	if (document.theform.email.value == "") {
		errMsg = errMsg + ("- Please enter your email address.\n");
	}
	
	myOption = -1;
	for (i=theform.sex.length-1; i > -1; i--) {
		if (theform.sex[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please select your gender.\n");
	}
	
	if (document.theform.city.value == ""){
		errMsg = errMsg + ("- Please enter your city.\n");
	}
	
	if (document.theform.Province.value == "") {
		errMsg = errMsg + ("- Please enter state or province.\n");
	}

	
	myOption = -1;
	for (i=theform.country.length-1; i > -1; i--) {
		if (theform.country[i].checked) {
			myOption = i; i = -1;
		}
	}
	 
	if (myOption == -1) {
		errMsg = errMsg + ("- Please enter your country.\n");
	}
	
	myOption = -1;
	for (i=theform.olderthan19.length-1; i > -1; i--) {
		if (theform.olderthan19[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please confirm if you were above the age of 19 on the indicated date.\n");
	}
	
	if (document.theform.years.value == ""){
		errMsg = errMsg + ("- Please enter the number of years you have been mountain biking.\n");
	}
//	myOption = -1;
//	for (i=theform.years.length-1; i > -1; i--) {
//		if (theform.years[i].checked) {
//		myOption = i; i = -1;
//	}
//	}
//	if (myOption == -1) {
//		errMsg = errMsg + ("- Please enter the number of years you have been mountain biking.\n");
//	}


	if (document.theform.days.value == ""){
		errMsg = errMsg + ("- Please enter number of days per week that you ride.\n");
	}
	
	myOption = -1;
	for (i=theform.PMBikeCamp.length-1; i > -1; i--) {
		if (theform.PMBikeCamp[i].checked) {
		myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please answer 'Have you ever participated in a mountain bike camp?'.\n");
	}
	
	var user_input='';
	for (i=0;i<document.theform.bikepark.length;i++) {
		if (document.theform.bikepark[i].checked) {
			user_input = document.theform.bikepark[i].value;
		}
	}
	 
	if(user_input == 'Yes') {
		if (document.theform.liftAccessBikePark.value=='') {
			errMsg = errMsg + ("- Please select which Lift Access Bike Park you attended\n");
		}
	}	
	
	//myOption = -1;
	//for (i=theform.fitness.length-1; i > -1; i--) {
	//	if (theform.fitness[i].checked) {
	//		myOption = i; i = -1;
	//	}
	//}
	//if (myOption == -1) {
	//	errMsg = errMsg + ("- Please select your fitness level.\n");
	//}
	if (document.theform.biketype.value == ""){
		errMsg = errMsg + ("- Please enter the brand of mountain bike(s) that you own.\n");
	}
	myOption = -1;
		for (i=theform.Discipline.length-1; i > -1; i--) {
			if (theform.Discipline[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please select your discipline.\n");
	}
	
	
	myOption = -1;
	var tripVal;
	for (i=theform.trip.length-1; i > -1; i--) {
		if (theform.trip[i].checked) {
			myOption = i;tripVal=theform.trip[i].value; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please answer 'In the last 2 years have you taken an overnight trip (60 miles/100 km or more) to go mountain biking.'\n");
	}
	else{
		if (tripVal=='Yes') {
			
			// trip 1 
			if (document.theform.tripcountry1.value == ""){
				errMsg = errMsg + ("- Please enter a country for your overnight trip.\n");
			}
			if (document.theform.tripstate1.value == ""){
				errMsg = errMsg + ("- Please enter a State/Province for your overnight trip.\n");
			}
			if (document.theform.tripstate1.value == "Other" && document.theform.tripstate1other.value == '' ){
				errMsg = errMsg + ("- Please enter a State/Province for your overnight trip.\n");
			}
			if (document.theform.triploc1.value == "" || (document.theform.triploc1.value == "Other" && document.theform.triploc1other.value=='')){
				errMsg = errMsg + ("- Please enter a destination for your overnight trip.\n");
			}
			if (document.theform.tripduration1.value == ""){
				errMsg = errMsg + ("- Please enter a duration for your first overnight trip.\n");
			}
			 

} // if tripval==yes
	} // if myoption == -1
	
	myOption = -1;
	var bikeparkVal='';
	for (i=theform.bikepark.length-1; i > -1; i--) {
		if (theform.bikepark[i].checked) {
			myOption = i; bikeparkVal = theform.bikepark[i].value;i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please answer 'Have you ever ridden in a lift-access bike park?'.\n");
	}
	else{
		if (bikeparkVal=='Yes'){
			
		}
	}
	
	if (document.theform.media.value=='' && document.theform.media.value=='') {
		errMsg = errMsg + ("- Please select where you first heard about this year's Ultimate BC Road Tip contest \n");
	}
	
	
	//night trip
	myOption = -1;
	for (i=theform.nighttrip.length-1; i > -1; i--) {
		if (theform.nighttrip[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		errMsg = errMsg + ("- Please answer 'How likely are you to take a trip of 1 or more nights in BC that will involve mountain biking in the next 12 months?'.\n");
	}
	
	if (document.theform.bikepark1.value == ""){
		errMsg = errMsg + ("- Please enter Skill testing question1.\n");
	}
	
	if (document.theform.bikepark2.value == ""){
		errMsg = errMsg + ("- Please enter Skill testing question2.\n");
	}
	
	if (document.theform.bikepark3.value == ""){
		errMsg = errMsg + ("- Please enter Skill testing question3.\n");
	}
	
	
	myOption = -1;
	for (i=theform.contact.length-1; i > -1; i--) {
		if (theform.contact[i].checked) {
			myOption = i; i = -1;
		}
	}
	
	if (myOption == -1) {
		errMsg = errMsg + ("- Please make a selection for 'May we contact you regarding future Bike Parks BC and MMR Camps promotions using the information you have provided?'.\n");
	}

	myOption = -1;
	for (i=theform.contact2.length-1; i > -1; i--) {
		if (theform.contact2[i].checked) {
			myOption = i; i = -1;
		}
	}
	
	if (myOption == -1) {
		errMsg = errMsg + ("- Please make a selection for 'May MARIN BIKES contact you regarding future promotions using the information you have provided?'.\n");
	}

if (errMsg == '') {
		 
		return true;
	}
	else {
		errMsg = 'There was a problem processing your form. The following fields were not filled in correctly:\n\n' + errMsg + '\n\n Please correct these items and resubmit';
		alert(errMsg);
		return false;
	}

}
