	// general purpose function to see if a suspected numeric input
	// is a positive or negative number
	function isNumber(inputVal) {
	if(inputVal == '') { return false; }
		oneDecimal = false
		inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (i == 0 && oneChar == '-') {
				continue
			}
			if (oneChar == '.' && !oneDecimal) {
				oneDecimal = true
				continue
			}
			if (oneChar < '0' || oneChar > '9') {
				return false
			}
		}
		return true
	}
	
	// ------------------------------------------------
	
	function validateEmail(email) {
		invalidChars = ' /:,;'

		for (i=0; i<invalidChars.length; i++) {// does it contain any invalid characters?
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) > -1) {
				return false
			}
		}
		atPos = email.indexOf('@',1)  // there must be one '@' symbol
		if (atPos == -1) {
			return false
		}
		if (email.indexOf('@',atPos+1) != -1) {  // and only one '@' symbol
			return false
		}
		periodPos = email.indexOf('.',atPos)
		if (periodPos == -1) {  // and at least one '.' after the '@'
			return false
		}
		if (periodPos+3 > email.length) {  // must be at least 2 characters after the '.'
			return false
		}
		return true;
	}


 // ----------------------------------------------------------------------


	function validateForm(theForm) {

		var selRECIPIENT_TITLE = theForm.abbrv.options[theForm.abbrv.selectedIndex].value;
		if(selRECIPIENT_TITLE == '') {
			alert('Please select from Title');
			theForm.abbrv.focus();
			return false;
		}

		if(theForm.f_name.value == '') {
			alert('Please complete the First Name field');
			theForm.f_name.focus();
			return false;
		}

		if(theForm.l_name.value == '') {
			alert('Please complete the Surname field');
			theForm.l_name.focus();
			return false;
		}

		if(theForm.recipient_addr1.value == '') {
			alert('Please complete the Street Address field');
			theForm.recipient_addr1.focus();
			return false;
		}

		if(theForm.recipient_sub.value == '') {
			alert('Please complete the Suburb field');
			theForm.recipient_sub.focus();
			return false;
		}

		var selState = theForm.recipient_state.options[theForm.recipient_state.selectedIndex].value;
		if(selState == '') {
			alert('Please select from State');
			theForm.recipient_state.focus();
			return false;
		}

		if(theForm.recipient_pcode.value == '') {
			alert('Please complete the Postal Code field');
			theForm.recipient_pcode.focus();
			return false;
		}

		if((!isNumber(theForm.recipient_pcode.value)) && (theForm.recipient_pcode.value != '')) {
			alert('Only numbers are allowed in the Postal Code field');
			theForm.recipient_pcode.focus();
			return false;
		}

		// - Check for hotmail.com.au Address entries
		if(theForm.email.value.indexOf('@hotmail.com.au') > 0) {
			alert('Hotmail Addresses DO NOT have .au at the end');
			theForm.email.focus();
			return false;
		}

		if((!validateEmail(theForm.email.value)) || (theForm.email.value == '')) {
			alert('Please enter a valid Email Address for the field Email Address');
			theForm.email.focus();
			return false;
		}

		var selHowdidyouhearaboutus = theForm.st_house_ref.options[theForm.st_house_ref.selectedIndex].value;
		if(selHowdidyouhearaboutus == '') {
			alert('Please select how you heard about us');
			theForm.st_house_ref.focus();
			return false;
		}

//  this bit goes in the form tag
//  onSubmit='return validateForm(this);'
//   this bit is for validating a select box
//   var selCity = document.form1.City.options[document.form1.City.selectedIndex].value;

	// alert('Done');         // remove after testing
	// return false;          // remove after testing
	return true;
	}