function ValidateData() {

	for (FormId=0; FormId<document.InfoForm.elements.length; FormId++) {
		FieldName = document.InfoForm.elements[FormId].name ;
		CheckValid = FieldName.replace(/QSTN-.*/, "");
		if (CheckValid == "") {
			FieldNum = 	FieldName.replace(/.*QSTN-/, "");
			FieldNum = 	FieldNum.replace(/_TYPE-.*/, "");

			FieldType = FieldName.replace(/.*_TYPE-/, "");
			FieldType = FieldType.replace(/_WDTH-.*/, "");

			FieldMin = 	FieldName.replace(/.*_IMIN-/, "");
			FieldMin = 	FieldMin.replace(/_RQRD.*/, "");

			FieldRequired = FieldName.replace(/.*_RQRD-/, "");
			
			Error = "";

			//VrcOption
			if (FieldType == "VrcOption" && FieldRequired == "*") {
				if (document.getElementById('QSTN-501_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').checked == false && document.getElementById('QSTN-502_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').checked  == false && document.getElementById('QSTN-503_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').checked == false) {
					Error = 'Please select an option for the VRC conditions';
				}
				if (Error != "") {
					document.getElementById('QSTN-501_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').className = "Field_Error";	
					document.getElementById('QSTN-502_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').className = "Field_Error";	
					document.getElementById('QSTN-503_TYPE-VrcOption_WDTH-1_IMIN-1_RQRD-*').className = "Field_Error";						
					alert(Error);
					return false;
				}
			}

			//Non VrcOption
			else {

				if ((FieldMin != "" && FieldRequired == "*" && document.InfoForm[FieldName].style.display != 'none') || (FieldType == "EmailField" && document.InfoForm[FieldName].value != "" && document.InfoForm[FieldName].style.display != 'none')) {

					switch (FieldType) {
						case "AdminType":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "AlctdStagePull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "CheckBoxYes":
							if (document.InfoForm[FieldName].checked == false) Error = 'You cannot continue with this registration if you do not check the disclaimer boxes for Competitor  / Driver / CoDriver ';
							break;

						case "CoDriverGradeVRCPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a choice for "Co-Driver Grade"';
							break ;

						case "CupPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "CurrencyField":
							var CrncyStr = document.InfoForm[FieldName].value;
							var CrncyPat = /^(\d{1,5}).(\d{2})$/;
							var matchArray = CrncyStr.match(CrncyPat);
							if (matchArray == null) Error = 'This Field contains an invalid Currency Amount';
							else {	
								Dollars = matchArray[1];
								Cents = matchArray[2];
								if (Dollars < 0  || Dollars > 99999) Error = 'This Field contains an invalid Currency Amount';
								else {
									if (Cents<0 || Cents > 99) Error = 'This Field contains an invalid Currency Amount';
								}
							}
							break;

						case "DateField":
							var FieldVal = 		document.InfoForm[FieldName].value;
							//Check Field not below minimum value
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires the format DD-MM-YYYY';
								else {
									//First check that is in format NNNN-NN-NN
									var ValidFormat = 	FieldVal.replace(/\d\d-\d\d-\d\d\d\d/, "") ;
									if (ValidFormat != "") Error = 'Please enter a valid date range in the format DD-MM-YYYY';
									else {
										//Check that YYYY MM DD is valid
										Year = 		FieldVal.replace(/\d\d-\d\d-/, "");
										Month = 	FieldVal.replace(/\d\d-/, "") ;
										Month = 	Month.replace(/-\d\d\d\d/, "") ;
										Day = 		FieldVal.replace(/-\d\d-\d\d\d\d/, "") ;
										if ((Year < 1900) || (Month < 1) || (Month > 12) || (Day < 1) || (Day > 31)) Error = 'Please enter a valid date range in the format DD-MM-YYYY'; 						
										else {
											var dayobj = new Date(Year, Month-1, Day);
											if ((dayobj.getMonth()+1!=Month)||(dayobj.getDate()!=Day)||(dayobj.getFullYear()!=Year)) Error = "Please enter a valid date range in the format DD-MM-YYYY";
										}
									}
								}
							break;
							
						case "DateFieldGreaterEvent":
							var FieldVal = 		document.InfoForm[FieldName].value;
							//Check Field not below minimum value
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires the format DD-MM-YYYY';
							else {
								//First check that is in format NNNN-NN-NN
								var ValidFormat = 	FieldVal.replace(/\d\d-\d\d-\d\d\d\d/, "") ;
								if (ValidFormat != "") Error = 'Please enter a valid date range in the format DD-MM-YYYY';
								else {
									//Check that YYYY MM DD is valid
									Year = 		FieldVal.replace(/\d\d-\d\d-/, "");
									Month = 	FieldVal.replace(/\d\d-/, "") ;
									Month = 	Month.replace(/-\d\d\d\d/, "") ;
									Day = 		FieldVal.replace(/-\d\d-\d\d\d\d/, "") ;
									if ((Year < 1900) || (Month < 1) || (Month > 12) || (Day < 1) || (Day > 31)) Error = 'Please enter a valid date range in the format DD-MM-YYYY'; 						
									else {
										var dayobj = new Date(Year, Month-1, Day);
										if ((dayobj.getMonth()+1!=Month)||(dayobj.getDate()!=Day)||(dayobj.getFullYear()!=Year)) Error = "Please enter a valid date range in the format DD-MM-YYYY";
										//Check that Date is greater than Hidden Date
										var HiddenFieldVal = document.InfoForm[FieldNum + 'HiddenDateFieldGreaterEvent'].value;
										HideDay = 		parseInt(HiddenFieldVal.replace(/\d\d\d\d-\d\d-/, ""));
										HideMonth = 	HiddenFieldVal.replace(/\d\d\d\d-/, "") ;
										HideMonth = 	HideMonth.replace(/-\d\d/, "") ;
										HideYear = 		HiddenFieldVal.replace(/-\d\d-\d\d/, "") ;
										var HideDate = new Date(HideYear, HideMonth-1, (HideDay+1));
										if (dayobj < HideDate) Error = "WARNING...The expiry date you have selected for this field predates the event.";	
									}
								}
							}
							break;						

						case "DateYYYYMMField":
							var FieldVal = 		document.InfoForm[FieldName].value;
							//Check Field not below minimum value
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires the format MM-YYYY';
								else {
									//First check that is in format NNNN-NN
									var ValidFormat = 	FieldVal.replace(/\d\d-\d\d\d\d/, "") ;
									if (ValidFormat != "") Error = 'Please enter a valid date range in the format MM-YYYY';
									else {
										//Check that YYYY MM DD is valid
										Month = 	FieldVal.replace(/\d\d\d\d-/, "") ;
										Year = 		FieldVal.replace(/-\d\d/, "") ;
										if ((Year < 1900) || (Month < 1) || (Month > 12)) Error = 'Please enter a valid date range in the format MM-YYYY'; 						
									}
								}
							break;

						case "DriveConfigPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "DriverGradeHRAPull":
							if (document.InfoForm[FieldName].value == "") Error = 'Please select a choice for the driver grade field';
							break ;

						case "DriverGradeVRCPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a choice for "Driver Grade"';
							break ;

						case "EmailField":
							var CheckField = document.InfoForm[FieldName].value;
							var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
							if (filter.test(CheckField)) ;
							else Error = 'Please enter a valid Email Address';
							break

						case "EventFeePull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "EventType":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "FileField":
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires a minimum of ' + FieldMin + ' characters';
							break ;

						case "FrwdCrspncByPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							else {
								if (document.InfoForm[FieldName].value == 1) {
									var FrwdCrspncToFieldName = document.InfoForm.elements[FormId + 1].name;
									if (document.InfoForm[FrwdCrspncToFieldName].value == 0) {
										FieldName = FrwdCrspncToFieldName;
										Error = 'Please make a valid selection for: "Please send my Correspondence to"';
									}
									else {
										if (document.InfoForm[FrwdCrspncToFieldName].value == 1 && document.getElementById('entrant_email').value == "") Error = 'You have selected to email correspondence to your Competitor but have not supplied a valid email address for your Competitor  on the previous page 1 of this registration.\n\nTo save this page and go back to registration page 1, change the option for: "Please forward my Correspondence by" to Post';
										if (document.InfoForm[FrwdCrspncToFieldName].value == 2 && document.getElementById('driver_email').value == "") Error = 'You have selected to email correspondence to your Driver but have not supplied a valid email address for your Driver on the previous page 1 of this registration.\n\nTo save this page and go back to registration page 1, change the option for: "Please forward my Correspondence by" to Post';
										if (document.InfoForm[FrwdCrspncToFieldName].value == 3 && document.getElementById('codriver_email').value == "") Error = 'You have selected to email correspondence to your CoDriver but have not supplied a valid email address for your CoDriver on the previous page 1 of this registration.\n\nTo save this page and go back to registration page 1, change the option for: "Please forward my Correspondence by" to Post';
									}
								}
							}
							break ;

						case "FrwdCrspncToPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "HRACategoryPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a choice for the "Vehicle Category" field';
							break ;

						case "NavigatorGradeHRAPull":
							if (document.InfoForm[FieldName].value == "") Error = 'Please select a choice for the navigator grade field';
							break ;

						case "OfficialAsgnPosPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "OfficialPrefPosPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "NumberField":
							var FieldVal = 	document.InfoForm[FieldName].value;
							//Check Field not below minimum value
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires a minimum of ' + FieldMin + ' characters';
							else {
								//Check that field contains number
								ValidField = FieldVal.replace(/\d+/, "") ;
								if (ValidField != "") Error = 'This field contains invalid characters' ;
							}
							break;

						case "NumberFieldNoZero":
							var FieldVal = 		document.InfoForm[FieldName].value;
							//Check Field not below minimum value
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires a minimum of ' + FieldMin + ' characters';
							else {
								//Check that field contains number
								ValidField = FieldVal.replace(/\d+/, "") ;
								if (ValidField != "") Error = 'This field contains invalid characters' ;
								else {
									if (parseInt(FieldVal) < 1) Error = 'This field requires a value above 0' ;
								}
							}
							break;

						case "OfclAdmin":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "PasswordField":
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires a minimum of ' + FieldMin + ' characters';
							if (document.InfoForm[FieldName].value.indexOf(' ') != -1) Error = 'This field does not allow spaces to be entered';
							break ;

						case "PaymentTypePull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "SeriesPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;
	
						case "TextField":
							if (document.InfoForm[FieldName].value.length < FieldMin) Error = 'This field requires a minimum of ' + FieldMin + ' characters';
							break ;

						case "TimeField":
							var timeStr = document.InfoForm[FieldName].value;
							var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
							var matchArray = timeStr.match(timePat);
							if (matchArray == null) Error = 'This Field contains an invalid Time Format';
							else {	
								hour = matchArray[1];
								minute = matchArray[2];
								second = matchArray[4];
								if (hour < 0  || hour > 23) Error = 'This Field contains an invalid Time Format';
								else {
									if (minute<0 || minute > 59) Error = 'This Field contains an invalid Time Format';
									else {
										if (second != null && (second < 0 || second > 59)) Error = 'This Field contains an invalid Time Format';
									}
								}
							}
							break;

						case "TypeOfCarBringPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;
							
						case "VchlClassPull":
							if (document.InfoForm[FieldName].value == 0) Error = 'Please select a Choice for this field';
							break ;

						case "YearCreatePull":
							if (document.InfoForm[FieldName].value < 1) Error = 'Please select a Year';
							break ;

					}

					if (Error == "") {
						if (document.InfoForm[FieldName].className == "Field_Error") document.InfoForm[FieldName].className = "Field_Ok";
					}
					else {
						document.InfoForm[FieldName].className = "Field_Error";	
						document.InfoForm[FieldName].focus();
						alert(Error);
						return false;
					}
				}
			}
		}
	}
	return true;
}