			var strTempString;

			function jfParseString(pstrSource, pstrDelimiter) {
				var intPosition;
				var strReturn;

				intPosition = pstrSource.indexOf(pstrDelimiter);

				if (intPosition == -1) {
					strReturn = pstrSource;
					strTempString = '';
					return strReturn;
				}
				else {
					strReturn = pstrSource.substr(0, intPosition);
					strTempString = pstrSource.substr(intPosition + 1, pstrSource.length);
					return strReturn;
				}

			}

			function jfValidateForm() {
				var boolErrorsFound = false;
				var intCounter;
				var strEmailList;
				var strEmailAddress;
				var intTownIndex;
				var strTownList = "";
				var intPropTypeIndex;
				var strPropTypeList = "";
				var boolPropTypeSelected = false;

				//-------------------------------------------------------------------------------------------------------
				// Validate the required fields
				//-------------------------------------------------------------------------------------------------------
				if (jfIsText(document.frmMain.txtFirstName.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtFirstName, 'Please enter the First Name');
					return;
				}

				if (jfIsText(document.frmMain.txtLastName.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtLastName, 'Please enter the Last Name');
					return;
				}

				if (jfIsEmail(document.frmMain.txtEmail.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtEmail, 'Please enter a valid email address');
					return;
				}

				if (jfIsText(document.frmMain.txtAddress1.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtAddress1, 'Please enter the Address');
					return;
				}

				if (jfIsText(document.frmMain.txtCity.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtCity, 'Please enter the City');
					return;
				}

				if (jfIsText(document.frmMain.txtState.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtState, 'Please enter the State');
					return;
				}

				if (jfIsText(document.frmMain.txtZipCode.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtZipCode, 'Please enter the Zip Code');
					return;
				}

				if (jfIsText(document.frmMain.txtHomePhone.value) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtHomePhone, 'Please enter the Home Phone');
					return;
				}

				if ((jfIsText(document.frmMain.txtEstCloseDate.value) == false) || (jfIsDateMDY(document.frmMain.txtEstCloseDate.value) == false)) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtEstCloseDate, 'Please enter a valid date in the format MM/DD/YYYY');
					return;
				}

				if (document.frmMain.chkBuyHome.checked == false) {
					if (document.frmMain.chkSellHome.checked == false) {
						boolErrorsFound = true;
						alert('Please specify whether you are interested in buying or selling.');
						document.frmMain.chkBuyHome.focus();
						return;
					}
				}

				//-------------------------------------------------------------------------------------------------------
				// Build the list of property types selected (if any)
				//-------------------------------------------------------------------------------------------------------
				for(intPropTypeIndex = 1 ; intPropTypeIndex <= document.frmMain.txtPropTypeCount.value ; intPropTypeIndex++) {
					ctlSource = eval('document.frmMain.chkPropType' + intPropTypeIndex);
					if (ctlSource.checked) {
						if (strPropTypeList != '') {
							strPropTypeList = strPropTypeList + ',';
						}

						strPropTypeList = strPropTypeList + ctlSource.value;

						boolPropTypeSelected = true;
					}
				}

				document.frmMain.txtPropTypeList.value = strPropTypeList;

				if (boolPropTypeSelected == false) {
					boolErrorsFound = true;
					alert('Please select the property type you are interested in');
					document.frmMain.chkPropType1.focus();
					return;
				}

				//-------------------------------------------------------------------------------------------------------
				// Build the list of towns selected (if any)
				//-------------------------------------------------------------------------------------------------------
				for(intTownIndex = 0 ; intTownIndex < document.frmMain.lstSelectedTowns.options.length ; intTownIndex++) {
					if (strTownList != '') {
						strTownList = strTownList + '^';
					}

					strTownList = strTownList + document.frmMain.lstSelectedTowns.options[intTownIndex].value;
				}

				document.frmMain.txtTownList.value = strTownList;

				if (jfCountSelectedOptions(document.frmMain.lstSelectedTowns) > 40) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.lstSelectedTowns, 'Please select no more than 40 towns.');
					return;
				}

				if (strTownList == '') {
					boolErrorsFound = true;
					alert('Please select the towns you are interested in');
					document.frmMain.lstAvailableTowns.focus();
					return;
				}

				//-------------------------------------------------------------------------------------------------------
				// Validate that the price range is numeric
				//-------------------------------------------------------------------------------------------------------
				document.frmMain.txtMinPrice.value = jfStringFilter(document.frmMain.txtMinPrice.value, "$,");
	
				if (jfIsNumeric(document.frmMain.txtMinPrice.value, 1) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtMinPrice, 'Please enter a valid numeric value for the lower limit of your price range');
					return;
				}
				else if (Number(document.frmMain.txtMinPrice.value) > 922337203685477) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtMinPrice, 'Lower limit of your price range cannot be more than $922,337,203,685,477');
					return;
				}

				document.frmMain.txtMaxPrice.value = jfStringFilter(document.frmMain.txtMaxPrice.value, "$,");

				if (jfIsNumeric(document.frmMain.txtMaxPrice.value, 1) == false) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtMaxPrice, 'Please enter a valid numeric value for the upper limit of your price range');
					return;
				}
				else if (Number(document.frmMain.txtMaxPrice.value) > 922337203685477) {
					boolErrorsFound = true;
					jfResetControl(document.frmMain.txtMaxPrice, 'Upper limit of your price range cannot be more than $922,337,203,685,477');
					return;
				}

				//-------------------------------------------------------------------------------------------------------
				// Validate the delimited list of email addresses
				//-------------------------------------------------------------------------------------------------------
				strEmailList = document.frmMain.txtAdditionalEmailAddresses.value;

				while (strEmailList != '') {
					strEmailAddress = jfParseString(strEmailList, ';');

					strEmailList = strTempString;

					if (strEmailAddress != '') {
						if (jfIsEmail(strEmailAddress) == false) {
							boolErrorsFound = true;
							alert(strEmailAddress + ' is an invalid email address.');
							document.frmMain.txtAdditionalEmailAddresses.focus();
							return;
						}
					}
				}

				if (jfValidateSearchConditions() == false) {
					boolErrorsFound = true;
				}

				// If no validation errors found, submit the form
				if (boolErrorsFound == false) {
					document.frmMain.txtDataAction.value = 'Insert';
					document.frmMain.submit();
				}
			}

			function jfValidateSearchConditions() {
				var boolErrorsFound = false;
				var lngSearchConditionCount;
				var intCounter;
				var ctlSearchConditionID;
				var ctlSearchType;
				var ctlConversionType;
				var ctlSupportsIn;
				var ctlValue;
				var ctlBeginRange;
				var ctlEndRange;

				lngSearchConditionCount = document.frmMain.txtSearchConditionCount.value;

				for (intCounter = 1; intCounter <= lngSearchConditionCount; intCounter++) {
					ctlSearchConditionID = eval('document.frmMain.txtSearchCondition' + intCounter);
					ctlSearchType = eval('document.frmMain.txtSearchType' + intCounter);
					ctlConversionType = eval('document.frmMain.txtConversionType' + intCounter);
					ctlSupportsIn = eval('document.frmMain.txtSupportsIn' + intCounter);

					if (ctlSearchType.value == 'Range') {
						ctlBeginRange = eval('document.frmMain.txtSearchConditionBegRange' + intCounter);
						if (jfIsText(ctlBeginRange.value) == true) {
							if ((jfIsNumeric(ctlBeginRange.value, 0) == false) && (ctlConversionType.value != 'varchar')) {
								boolErrorsFound = true;
								jfResetControl(ctlBeginRange, 'Please enter a numeric value.');
								break;
							}
						}

						ctlEndRange = eval('document.frmMain.txtSearchConditionEndRange' + intCounter);
						if (jfIsText(ctlEndRange.value) == true) {
							if ((jfIsNumeric(ctlEndRange.value, 0) == false) && (ctlConversionType.value != 'varchar')) {
								boolErrorsFound = true;
								jfResetControl(ctlEndRange, 'Please enter a numeric value.');
								break;
							}
						}
					}
					else if (ctlSearchType.value == 'Exact Match') {
						ctlValue = eval('document.frmMain.txtSearchConditionValue' + intCounter);
						if (jfIsText(ctlValue.value) == true) {
							if ((jfIsNumeric(ctlValue.value, 0) == false) && (ctlConversionType.value != 'varchar')) {
								boolErrorsFound = true;
								jfResetControl(ctlValue, 'Please enter a numeric value.');
								break;
							}
						}
					}
					else if (ctlSearchType.value == 'Contains') {
					
					}
					else if (ctlSearchType.value == 'Boolean') {
					
					}
					else if (ctlSearchType.value == 'At Least') {
						ctlValue = eval('document.frmMain.txtSearchConditionValue' + intCounter);
						if (jfIsText(ctlValue.value) == true) {
							if ((jfIsNumeric(ctlValue.value, 0) == false) && (ctlConversionType.value != 'varchar')) {
								boolErrorsFound = true;
								jfResetControl(ctlValue, 'Please enter a numeric value.');
								break;
							}
						}
					}
					else if (ctlSearchType.value == 'At Most') {
						ctlValue = eval('document.frmMain.txtSearchConditionValue' + intCounter);
						if (jfIsText(ctlValue.value) == true) {
							if ((jfIsNumeric(ctlValue.value, 0) == false) && (ctlConversionType.value != 'varchar')) {
								boolErrorsFound = true;
								jfResetControl(ctlValue, 'Please enter a numeric value.');
								break;
							}
						}
					}
				}

				// If no validation errors found, submit the form
				if (boolErrorsFound == false) {
					return true;
				}
				else {
					return false;
				}
			}
