function convertFeetToInches(feetInches) {
	// strip out anything not a number or a '
	var escaped = feetInches.replace(/[^\d\']/g, '');
	var validatedHeight = 0;

	if (escaped.indexOf("'") != -1) {
		validatedHeight = validatedHeight + parseInt(escaped.substring(0,escaped.indexOf("'")))*12;
		validatedHeight = validatedHeight + parseInt(escaped.substring(escaped.indexOf("'")+1));
	} else {
		validatedHeight = escaped;
	}



	return validatedHeight;
}

function formatPhoneIfValid(objField) {
	var fieldData = objField.value
	if (validatePhone(fieldData)) {
		objField.value = formatPhone(fieldData);
	}
}
function formatPhone(phoneNumber) {
	if (!validatePhone(phoneNumber)) {
		return phoneNumber;
	}
	// strip out anything non numeric
	var escaped = phoneNumber.replace(/[\(\)\.\-\ ]/g, '');

	return "(" + escaped.substring(0,3) + ") " + escaped.substring(3,6) + "-" + escaped.substring(6,10);
}
// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that
// (a) you leave this copyright notice intact, and
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site
//     with a link back to http://www.albionresarch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// ====================================================================
function URLEncode(plaintext)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};

function getNewElement(strElement, strClass, strId) {
	obj = document.createElement(strElement);
	obj.className = strClass;
	obj.id = strId;
	return obj;
}

function URLDecode(encoded) {
   // Replace + with ' '
   // Replace %xx with equivalent character
   var HEXCHARS = "0123456789ABCDEFabcdef";
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2)
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
			} else {
				plaintext += encoded.substr(i, 3)
			}
			i += 3;
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};
function validatePhone(phoneNumber) {
	// strip out anything non numeric
	var phoneNumberEscaped = phoneNumber.replace(/[\(\)\.\-\ ]/g, '');

	// check to make sure there aren't any invalid characters left
	if (isNaN(parseInt(phoneNumberEscaped))) {
		return false;
	}

	// check to make sure phone number is 10 digits
	if (phoneNumberEscaped.length == 10) {
		return true;
	} else {
		return false;
	}
}
function validEmail(emailaddr) {
	return (emailaddr!=null && emailaddr.indexOf("@") > 0);
}