function validateForm(thisForm) {
	with (thisForm){
		// Checks for empty fields.
		if (RecipientName.value.length == 0){
			alert ("Please enter the recipient's name.");
			RecipientName.focus();
			return false;
		}
		if (RecipientEmail.value.length == 0){
			alert ("Please enter the recipient's email address.");
			RecipientEmail.focus();
			return false;
		}
		if (SenderName.value.length == 0){
			alert ("Please enter your name.");
			SenderName.focus();
			return false;
		}
		if (SenderEmail.value.length == 0){
			alert ("Please enter your email address.");
			SenderEmail.focus();
			return false;
		}

		// Validates the format of the email address

		// The following pattern checks whether the input string is a valid email 
            // address in the form "name@domain.com". Actually, it does not have to be a
		// ".com" address. Any combination of letters following the last period are 
		// fine. Also, the email name can have a dash or be separated by one or more 
		// periods. The Domain name can also have multiple words separated by periods. 

		// [\w-]+    
		// One or more matches of any character (a-z, A-Z, 0-9, and underscore) or dash. On either side of the @ character this ensures the address is in the form name@domainname.
		// \.              
		// An escaped period. (Without the backslash, a period matches any single character except the newline character.) Using this ensures there is at least one period in the domain name.
		// *?            
		// A non-greedy, or minimal, match of zero or more matches of the preceding expression.
		// ([\w-]+\.)*?    
		// Combination of the three preceding expressions:
		// Zero or more non-greedy matches of the expression one or more matches of any character (a-z, A-Z, 0-9, and underscore) or dash, followed by only one period.

		re = /^([\w-]+\.)*?[\w-]+@[\w-]+\.([\w-]+\.)*?[\w]+$/;
		if (!re.test(RecipientEmail.value)){
			alert ("The format of the recipient's email address is incorrect.");
			RecipientEmail.focus();
			return false;
		}
		if (!re.test(SenderEmail.value)){
			alert ("The format of your email address is incorrect.");
			SenderEmail.focus();
			return false;
		}
		return true;
	}
		
}