/**
*	Validate the passed email
*
*	@return boolean
*/

function validateEmail(email) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
return true;
}
return false;
}


/**
*	Validate that the value is set
*
*	@return boolean
*/
function validateExists(value) {
	if (value == null || value.length == 0) {
		return false;
	}
	return true;
}

/**
*	Validate the phone number, ensuring the first 10 characters are numbers
*	and allowing for extensions to be entered
*
*	@return boolean
*/
function validatePhone(value) {
	//strip out acceptable non-numeric characters
	var stripped = value.replace(/[\(\)\.\-\ ]/g, '');
	// set a reasonable upper limit
	if (stripped.length > 30) {
		return false;
	}
	var noExtPhone = stripped.substring(0, 10);
	if (isNaN(parseInt(noExtPhone)) || noExtPhone.length != 10) {
		return false;
	}

	return true;
}

/**
*	Validate the maximum length of the passed value
*
*	@return boolean
*/
function validateMaxLength(value, length) {
	if (value.length > length) {
		return false;
	}
	return true;
}

/**
*	Validate the minimum length of the passed value
*
*	@return boolean
*/
function validateMinLength(value, length) {
	if (value.length <= length) {
		return false;
	}
	return true;
}

/**
 * Validate the passed selection
 * 
 * @return boolean
 */
function validateSelection(/*object*/ selectElement) {
	if (selectElement) {
		return true;
	}
}

 
/**
*	Validate the zip code
*
*	@return boolean
*/
function validateZip(value) {
	zip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
    return zip.test(value);
}