function validateEmailFriend(){
	var okSoFar=true
	//this functions validate the To First Name field
	if (document.frmemailfriend.ToFirstName.value=="") {
		okSoFar=false
		alert("Please fill in the To First Name field!")
		document.frmemailfriend.ToFirstName.focus()
		return false;
           }
	
	if (document.frmemailfriend.FromFirstName.value=="") {
		okSoFar=false
		alert("Please fill in the From First Name field!")
		document.frmemailfriend.FromFirstName.focus()
		return false;
           }	
		
	//functions to test the From email validity
	//these functions test the Name fields
	if (document.frmemailfriend.Fromemail.value=="") {
		okSoFar=false
	    alert("You must enter a valid From email address.")
		document.frmemailfriend.Fromemail.focus()
		return false;
		}
		
		
    var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(document.frmemailfriend.Fromemail.value))) { 
       okSoFar=false
       alert("Please enter a valid From email address.")
       document.frmemailfriend.Fromemail.focus()
       document.frmemailfriend.Fromemail.select()
       return false;
	}
	
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (document.frmemailfriend.Fromemail.value.match(illegalChars)) {
	okSoFar=false
	alert("The From email address contains illegal characters.")
	document.frmemailfriend.Fromemail.focus()
	document.frmemailfriend.Fromemail.select()
    return false;
	}
	
	
	//functions to test the To email validity
	//these functions test the To fields
	if (document.frmemailfriend.Toemail.value=="") {
		okSoFar=false
	    alert("You must enter a valid To email address.")
		document.frmemailfriend.Toemail.focus()
		return false;
		}
		
		
    var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(document.frmemailfriend.Toemail.value))) { 
       okSoFar=false
       alert("Please enter a valid To email address.")
       document.frmemailfriend.Toemail.focus()
       document.frmemailfriend.Toemail.select()
       return false;
	}
	
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (document.frmemailfriend.Toemail.value.match(illegalChars)) {
	okSoFar=false
	alert("The To email address contains illegal characters.")
	document.frmemailfriend.Toemail.focus()
	document.frmemailfriend.Toemail.select()
    return false;
	}
		
	//-- If all fields OK go ahead and submit the form and put up a message.
  if (okSoFar==true) {
    //-- The statement below actually submits the form, if all OK.
    document.frmemailfriend.submit()
		}
 }