
	//=========================================================================
	// This function performs validity checks on the Tell-A-Friend form and 
	// displays an informative message to the user if any error occurred.
	// If no error has occured the form will be submitted to the server.
	//=========================================================================
	function frmTellAFriend_onsubmit() {
	var hReturnInfo;
	var bReturnValue = true;
	var iIndex;
	var sItemName, sQuantity;
	var sOrderItems = '';
	var sOrderRooms = '';
	
		//Clear the error messages and the marked fields.
		ResetErrorDisplay(false); 

		//Perform validity checks on the second half of the form.
		
		try {

			//Check if the user entered his full name.
			if (IsEmpty(document.getElementById('txtFullNameTAF').value).ReturnCode > 0)
				throw new UserError('txtFullNameTAF', 'Please enter your full name.', 3)

			//Check if the user entered a valid e-mail address. 
			hReturnInfo = IsValidEMailAddress(document.getElementById('txtEMailTAF').value, false); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('txtEMailTAF', hReturnInfo.ErrorDescription ,3);		
      
			//Check if the user entered at least one friend's name.
			if (IsEmpty(document.getElementById('txtFriendNameTAF').value).ReturnCode > 0)
				throw new UserError('txtFriendNameTAF', 'Please enter your friend\'s full name.', 3)

			//Check if the user entered at least one friend's valid e-mail address. 
			hReturnInfo = IsValidEMailAddress(document.getElementById('txtFriendEMailTAF').value, false); 
			if (hReturnInfo.ReturnCode == 1)
				throw new UserError('txtFriendEMailTAF', 'Please enter your friend\'s e-mail address.' ,3);
			if (hReturnInfo.ReturnCode == 2)
				throw new UserError('txtFriendEMailTAF', 'The e-mail address you entered is invalid.' ,3);
      
		}
		
		//If an exption was throwen an error message will be displayed.
		catch (hUserError) {
			hUserError.DisplayError();
			bReturnValue = false;
		}	
		
		return bReturnValue;
	}