<!-- Begin

function Form_Validator(theForm)
{
  // Validation script for field 'site_name' (Site Name)
  if (theForm.site_name.value == "")
  {
    alert("Please enter a value for the \"Site Name\" field.");
    theForm.site_name.focus();
    return (false);
  }
  if (theForm.site_name.value.length < 1)
  {
    alert("Please enter at least 1 characters for the \"Site Name\" field.");
    theForm.site_name.focus();
    return (false);
  }
  if (theForm.site_name.value.length > 35)
  {
    alert("Please enter at most 35 characters for the \"Site Name\" field.");
    theForm.site_name.focus();
    return (false);
  }
  // Allow at colon forwardslash dash underscore alphanumerics
  ValidCharacters = ""
  ValidCharacters = ValidCharacters + "."
  ValidCharacters = ValidCharacters + ":"
  ValidCharacters = ValidCharacters + "/"
  ValidCharacters = ValidCharacters + "-"
  ValidCharacters = ValidCharacters + "_"
  ValidCharacters = ValidCharacters + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ValidCharacters = ValidCharacters + "0123456789"
  ValidCharacters = ValidCharacters + "?"
  ValidCharacters = ValidCharacters + "="
  ValidCharacters = ValidCharacters + "&"
  ValidCharacters = ValidCharacters + "+"
  ValidCharacters = ValidCharacters + ","
  ValidCharacters = ValidCharacters + "%"
  ValidCharacters = ValidCharacters + "~"
  ValidCharacters = ValidCharacters + "#"
  ValidCharacters = ValidCharacters + "{"
  ValidCharacters = ValidCharacters + "}"
  ValidCharacters = ValidCharacters + "|"
  ValidCharacters = ValidCharacters + "\\"
  ValidCharacters = ValidCharacters + "!"

  // URL clear : site_url
  if (theForm.site_url.value.length == 11)
  {
    // indicates url = http://www. so blank it out
    theForm.site_url.value = ""
  }
  // Character field validation
  // Validation script for field 'site_url' (Site URL)
  if (theForm.site_url.value == "")
  {
    alert("Please enter a value for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }
  if (theForm.site_url.value.length < 5)
  {
    alert("Please enter at least 5 characters for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }
  if (theForm.site_url.value.length > 200)
  {
    alert("Please enter at most 200 characters for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }
  var ok = "yes";
  var temp;
  for (var i=0; i < theForm.site_url.value.length; i++)
  {
    temp = "" + theForm.site_url.value.substring(i, i+1);
    if (ValidCharacters.indexOf(temp) == "-1") ok = "no";
  }
  if (ok == "no")
  {
    msg = "Invalid data entered for the \"Site URL\" field.\nOnly the following characters are allowed:\n\"" + ValidCharacters + "\"";
    alert(msg);
    theForm.site_url.focus();
    return (false);
  }

  // URL field validation
  // Validation script for field 'site_url' (Site URL)
  if (theForm.site_url.value == "")
  {
    alert("Please enter a value for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }
  if (theForm.site_url.value.length < 10)
  {
    alert("Please enter at least 10 characters for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }
  if (theForm.site_url.value.length > 200)
  {
    alert("Please enter at most 200 characters for the \"Site URL\" field.");
    theForm.site_url.focus();
    return (false);
  }

  // if (theForm.site_url.value.indexOf("http://") == -1)
  // if (theForm.site_url.value.substring(0,7) != "http://")
  if (theForm.site_url.value.substring(0,7) != "http://" && theForm.site_url.value.substring(0,8) != "https://")
  {
    alert("Invalid data entered for \"Site URL\"\nWell formed URLs are preceded by \"http://\"");
    theForm.site_url.focus();
    return (false);
  }

  if (theForm.site_url.value.indexOf(".",theForm.site_url.value.indexOf("http://")+2) == -1)
  {
    alert("Invalid data entered for \"Site URL\"");
    theForm.site_url.focus();
    return (false);
  }

  // Allow at colon forwardslash dash underscore alphanumerics
  ValidCharacters = ""
  ValidCharacters = ValidCharacters + "."
  ValidCharacters = ValidCharacters + ":"
  ValidCharacters = ValidCharacters + "/"
  ValidCharacters = ValidCharacters + "-"
  ValidCharacters = ValidCharacters + "_"
  ValidCharacters = ValidCharacters + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ValidCharacters = ValidCharacters + "0123456789"
  ValidCharacters = ValidCharacters + "?"
  ValidCharacters = ValidCharacters + "="
  ValidCharacters = ValidCharacters + "&"
  ValidCharacters = ValidCharacters + "+"
  ValidCharacters = ValidCharacters + ","
  ValidCharacters = ValidCharacters + "%"
  ValidCharacters = ValidCharacters + "~"
  ValidCharacters = ValidCharacters + "#"
  ValidCharacters = ValidCharacters + "{"
  ValidCharacters = ValidCharacters + "}"
  ValidCharacters = ValidCharacters + "|"
  ValidCharacters = ValidCharacters + "\\"
  ValidCharacters = ValidCharacters + "!"

  // URL clear

  if (theForm.reciprocal_url.value.length == 11)
  {
    // indicates url = http://www. so blank it out
    theForm.reciprocal_url.value = ""
  }

  // Character field validation
  // Validation script for field 'reciprocal_url' (Reciprocal Link URL)
  if (theForm.reciprocal_url.value == "")
  {
    alert("Please enter a value for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  if (theForm.reciprocal_url.value.length < 5)
  {
    alert("Please enter at least 5 characters for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  if (theForm.reciprocal_url.value.length > 200)
  {
    alert("Please enter at most 200 characters for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  var ok = "yes";
  var temp;
  for (var i=0; i < theForm.reciprocal_url.value.length; i++)
  {
    temp = "" + theForm.reciprocal_url.value.substring(i, i+1);
    if (ValidCharacters.indexOf(temp) == "-1") ok = "no";
  }

  if (ok == "no")
  {
    msg = "Invalid data entered for the \"Reciprocal Link URL\" field.\nOnly the following characters are allowed:\n\"" + ValidCharacters + "\"";
    alert(msg);
    theForm.reciprocal_url.focus();
    return (false);
  }

  // URL field validation
  // Validation script for field 'reciprocal_url' (Reciprocal Link URL)
  if (theForm.reciprocal_url.value == "")
  {
    alert("Please enter a value for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  if (theForm.reciprocal_url.value.length < 10)
  {
    alert("Please enter at least 10 characters for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  if (theForm.reciprocal_url.value.length > 200)
  {
    alert("Please enter at most 200 characters for the \"Reciprocal Link URL\" field.");
    theForm.reciprocal_url.focus();
    return (false);
  }

  // if (theForm.reciprocal_url.value.indexOf("http://") == -1)
  // if (theForm.reciprocal_url.value.substring(0,7) != "http://")
  if (theForm.reciprocal_url.value.substring(0,7) != "http://" && theForm.reciprocal_url.value.substring(0,8) != "https://")
  {
    alert("Invalid data entered for \"Reciprocal Link URL\"\nWell formed URLs are preceded by \"http://\"");
    theForm.reciprocal_url.focus();
    return (false);
  }

  if (theForm.reciprocal_url.value.indexOf(".",theForm.reciprocal_url.value.indexOf("http://")+2) == -1)
  {
    alert("Invalid data entered for \"Reciprocal Link URL\"");
    theForm.reciprocal_url.focus();
    return (false);
  }

  // Allow at period dash underscore alphanumerics
  ValidCharacters = ""
  ValidCharacters = ValidCharacters + "@"
  ValidCharacters = ValidCharacters + "."
  ValidCharacters = ValidCharacters + "-"
  ValidCharacters = ValidCharacters + "_"
  ValidCharacters = ValidCharacters + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ValidCharacters = ValidCharacters + "0123456789"

  // Character field validation
  // Validation script for field 'email' (Contact Email Address)
  if (theForm.contact_email.value == "")
  {
    alert("Please enter a value for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.length < 5)
  {
    alert("Please enter at least 5 characters for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.length > 40)
  {
    alert("Please enter at most 40 characters for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  var ok = "yes";
  var temp;
  for (var i=0; i < theForm.contact_email.value.length; i++)
  {
    temp = "" + theForm.contact_email.value.substring(i, i+1);
    if (ValidCharacters.indexOf(temp) == "-1") ok = "no";
  }

  if (ok == "no")
  {
    msg = "Invalid data entered for the \"Contact Email Address\" field.\nOnly the following characters are allowed:\n\"" + ValidCharacters + "\"";
    alert(msg);
    theForm.contact_email.focus();
    return (false);
  }

  // Email field validation
  // Validation script for field 'email' (Contact Email Address)
  if (theForm.contact_email.value == "")
  {
    alert("Please enter a value for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.length < 5)
  {
    alert("Please enter at least 5 characters for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.length > 40)
  {
    alert("Please enter at most 40 characters for the \"Contact Email Address\" field.");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.indexOf("@",1) == -1)
  {
    alert("Invalid e-mail address entered for \"Contact Email Address\"\nWell formed email addresses include one and only one \"@\" character");
    theForm.contact_email.focus();
    return (false);
  }

  if (theForm.contact_email.value.indexOf(".",theForm.contact_email.value.indexOf("@")+2) == -1)
  {
    alert("Invalid e-mail address entered for \"Contact Email Address\"\nWell formed email addresses include a period \".\" character \nat least two places after the \"@\" character");
    theForm.contact_email.focus();
    return (false);
  }

  // Validation script for field 'site_description' (Description)
  if (theForm.site_description.value == "")
  {
    alert("Please enter a value for the \"Description\" field.");
    theForm.site_description.focus();
    return (false);
  }

  if (theForm.site_description.value.length < 1)
  {
    alert("Please enter at least 1 characters for the \"Description\" field.");
    theForm.site_description.focus();
    return (false);
  }

  if (theForm.site_description.value.length > 150)
  {
    alert("Please enter at most 150 characters for the \"Description\" field.");
    theForm.site_description.focus();
    return (false);
  }

  // Validation script for field 'comments' (Comments)
  if (theForm.comments.value != "")
  {
  // if user typed a value then check the value
  if (theForm.comments.value.length < 1)
  {
    alert("Please enter at least 1 characters for the \"Comments\" field.");
    theForm.comments.focus();
    return (false);
  }

  if (theForm.comments.value.length > 150)
  {
    alert("Please enter at most 150 characters for the \"Comments\" field.");
    theForm.comments.focus();
    return (false);
  }

  // End checking value
  }

  return (true);

}

//-->
