// email generator that works with the rmgscinfo/tfmail system
// check form fields and submit if valid, else return to form
// 
// change the name of the pl as needed to reduce spam
//
function submitMail() {
	var rs = checkinput();
	if (rs == false) {
	   return false;
	} else {
	   document.contactform.action = "/cgi-bin/cxntxctus.pl";
	   document.contactform.target = "_self";	
	   document.contactform.submit();
	   alert("Email sent successfully. Thank You!");
	   return true;
	}
}

<!--
function checkinput(){	
  var name = document.forms[0].Name.value;
  var email = document.forms[0].Email.value;
  var comms = document.forms[0].Comments.value;
   
  if ((name == ";") || (name == "") ||(email == ";") || (email == "") || (comms == ";") || (comms == "")   ){
    alert("Invalid required information! Please complete Name, Email, and Comments.");
    return false;
	}  		
  if (!check_name(name)) {
	alert("Invalid Name!");
	document.forms[0].Name.focus(); 
	return false;
    }  
  if (!check_email(email)){
    alert("Invalid email!");
	document.forms[0].Email.focus(); 
	return false;
	}
  return true;
  }  //end checkinput function

function check_name(TheName) {
	var valid = 1
	var GoodChars = "qwertyuiopasdfghjklzxcvbnm .QWERTYUIOPASDFGHJKLZXCVBNM"
	var i = 0
	for (i =0; i <= TheName.length -1; i++) {
		if (GoodChars.indexOf(TheName.charAt(i)) == -1) {
        //alert(TheNumber.charAt(i) + " is no good.")
			return false;
		} // End if statement
	} // End for loop
  return true;
  } //end check_name function
 
// Email Validation. Written by PerlScriptsJavaScripts.com
function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
	  if(ok.indexOf(e.charAt(i))<0){ 
	  return (false);
	  }	
	} 
	if (document.images) {
	  re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	  re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	  if (!e.match(re) && e.match(re_two)) {
	    return (-1);		
	    } 
	  }
  } //end check_email function
//-->
