function validateSendFriend() {
	var alertMsgHeader = "We could not submit your information request for the following reasons: \n\n";
	var alertMsg = "";
	
	var isValidOwnEmail = false;
	var isValidFriendsEmail = false;
	var thisForm = document.frmSendFriend;
	
	isValidOwnEmail = verifyEmail(thisForm.yourEmail.value);
	isValidFriendsEmail = verifyEmail(thisForm.friendsEmail.value);
	
	if(!isValidOwnEmail) {
		alertMsg += " - Please enter a valid email address for yourself.\n";
	}
	
	if(!isValidFriendsEmail) {
		alertMsg += " - Please enter a valid email address for your friend.\n";
	}
	
	if(thisForm.yourName.value == "") {
		alertMsg += " - Please enter your own name.\n";
	}
	
	if(thisForm.friendsName.value == "") {
		alertMsg += " - Please enter your friends name.\n";
	}
	
	if(alertMsg.length) {
		alert(alertMsgHeader+alertMsg);
		return false;
	} else {
		var returnDiv = document.getElementById('sendToAFriend');
		startAjax(thisForm,gbl_appConfig["rootURL"]+"xhr/diamond_sendToAFriend.cfm",returnDiv);
	}
}


function verifyEmail(checkEmail) {
	if ( checkEmail != "" )	{
		if ( (checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')) ) {
			return false;
		} else {
			var iChars = "*|,\":<>[]{}`\';()&$##% ";	// invalid chars (don't forget a space char)
			for (var i = 0; i < checkEmail.length; i++)	{
				if ( iChars.indexOf(checkEmail.charAt(i)) != -1 ) {
					return false;
				}
			}
			return true;	// place after the end 'for loop' bracket
		}
	} else {
		return false;
	}
}


function formValuesToString(oForm) {
	// Grab the base form information
	var values = '';
	var aToGrab = new Array();
	aToGrab[0] = 'input';
	aToGrab[1] = 'textarea';
	aToGrab[2] = 'select';
	for (var grabIndex = 0; grabIndex < aToGrab.length; grabIndex++) {
		var fields = oForm.getElementsByTagName(aToGrab[grabIndex]);					
		for (var i = 0; i < fields.length; i++) {
			thisField = fields[i];
			name = escape(thisField.name);						
			value = escape(thisField.value);						
			// If it is a non-checked checkbox, skip it
			if ( (thisField.type == 'checkbox' || thisField.type == 'radio') && !thisField.checked)	{
				continue;
			}
			else if (thisField.type == 'select') {
				value = escape(thisField[thisField.selectedIndex].value);
			}
			values += '&' + name + '=' + value;	
		}
	}
	return values;
}
