// JavaScript Document
function validation_spam(){
 var errormessage = new String();
var vF = document.forms["validation"];
if(validation_spam_WithoutContent(vF["Name"].value)){errormessage += "\n\nPlease fill in the \"Name\" edit field";}
if(validation_spam_NotAlphanumeric(vF["Name"].value)){errormessage += "\n\n \"Name\" can only contain alphanumeric characters";}
if(validation_spam_WithoutContent(vF["Mail"].value)){errormessage += "\n\nPlease fill in the \"Mail\" edit field";}
if(validation_spam_NotEmail(vF["Mail"].value)){errormessage += "\n\nThe entry for \"Mail\" does not appear to be a valid email address";}
if(validation_spam_WithoutContent(vF["Comments"].value)){errormessage += "\n\nPlease fill in the \"Comments\" edit field";}
if(validation_spam_NotAlphanumeric(vF["Comments"].value)){errormessage += "\n\n \"The entry for Comments\" Due to Spam please do not use special characters. Only use Alphanumerics Characters. THANKS";}

if (errormessage.length > 2){
    alert("There are errors or ommissions in the form" + errormessage + "\n");
    return false;
    }
return true;
} 

function validation_spam_WithoutContent(ss){
  if (ss.length>0){return false;}
return true;
}

function validation_spam_WithoutCheck(ss){
  if(ss.checked){return false;}
return true;
}

function validation_spam_NotEmail(ss){
  var splitted = ss.match("^(.+)@(.+)$");
  if (ss.length == 0){return false;}
  if(splitted == null) return true;
  if(splitted[1] != null){
    var regexp_user=/^\"?[\w-_\.]*\"?$/;
    if(splitted[1].match(regexp_user) == null) return true;
  }
  if(splitted[2] != null){
    var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
    if(splitted[2].match(regexp_domain) == null){
	 var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
      if(splitted[2].match(regexp_ip) == null) return true;
    }
  return false;
  }
return true;
}

function validation_spam_NotAlphanumeric(ss){
  var charpos = ss.search("[^ A-Za-z0-9']");
  if(ss.length > 0 &&  charpos >= 0){return true;}
return false;
}