<!--

// This function validates the form used by site users who want to be notified of site updates 
function Validate()
{
//  alert ("Validating form 1");

  var IsValid = true;

  document.getElementById("NameERR").innerText = "";
  document.getElementById("EmailAddressERR").innerText = "";
  document.getElementById("ReferalERR").innerText = "";
  document.getElementById("Message").innerText = "";


  String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
  }
  String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
  }
  String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
  }

  var myString;


  // Check for a name
  myString = document.getElementById("Name").value;
  var iName = myString.trim();
  document.getElementById("Name").innerText = iName;

  if (iName.length == 0) {
    document.getElementById("NameERR").style.color = "#FF0000";
    document.getElementById("NameERR").style.fontSize="200%";
    document.getElementById("NameERR").innerText = "*";
    IsValid = false;
  }

  // Check for a valid email address
  var ValidEmail = false;
  for (i=0; i<document.getElementById("EmailAddress").value.length; i++) {
    if (document.getElementById("EmailAddress").value.charAt(i) == "@") {
      ValidEmail = true;
      break;
    }
  }
  if (ValidEmail == false) {
    document.getElementById("EmailAddressERR").style.color = "#FF0000";
    document.getElementById("EmailAddressERR").style.fontSize="200%";
    document.getElementById("EmailAddressERR").innerText = "*";
    IsValid = false;
  }

  myString = document.getElementById("EmailAddress").value;
  var iEmailAddress = myString.trim();
  document.getElementById("EmailAddress").innerText = iEmailAddress;

  if (iEmailAddress.length < 9) {
    document.getElementById("EmailAddressERR").style.color = "#FF0000";
    document.getElementById("EmailAddressERR").style.fontSize="200%";
    document.getElementById("EmailAddressERR").innerText = "*";
    IsValid = false;
  }



  // Check for source of referal
  if (document.getElementById("Referal").selectedIndex == 0 ) { // Nothing selected
    document.getElementById("ReferalERR").style.color = "#FF0000";
    document.getElementById("ReferalERR").style.fontSize="200%";
    document.getElementById("ReferalERR").innerText = "*";
    IsValid = false;
  }


  if (IsValid == false) {		
    document.getElementById("Message").innerText = "PLEASE CORRECT INDICATED FIELDS";
  }	


  return IsValid;


}

function Validate2()
{
//  alert ("Validating Contact US Form");

  var IsValid = true;

  document.getElementById("NameERR").style.color = "#FFFFFF";
  document.getElementById("EmailAddressERR").style.color = "#FFFFFF";
  document.getElementById("TelNoDayERR").style.color = "#FFFFFF";
  document.getElementById("MobileERR").style.color = "#FFFFFF";
  document.getElementById("ContactReasonERR").style.color = "#FFFFFF";
  document.getElementById("CommentsERR").style.color = "#FFFFFF";
  document.getElementById("Message").style.color = "#FFFFFF";


  // Check for a name
  if (document.getElementById("Name").value == "") {
    document.getElementById("NameERR").style.color = "#FF0000";
    IsValid = false;
  }
  // Check for a valid email address
  var ValidEmail = false;
  for (i=0; i<document.getElementById("EmailAddress").value.length; i++) {
    if (document.getElementById("EmailAddress").value.charAt(i) == "@") {
      ValidEmail = true;
      break;
    }
  }
  if (ValidEmail == false) {
    document.getElementById("EmailAddressERR").style.color = "#FF0000";
    IsValid = false;
  }



  if (document.getElementById("ContactReason").selectedIndex == 0 ) { // Nothing selected
    document.getElementById("ContactReasonERR").style.color = "#FF0000";
    IsValid = false;
  }


  if (IsValid == false) {
    document.getElementById("Message").style.color = "#FF0000";
    document.getElementById("Message").innerText = "PLEASE CORRECT INDICATED FIELDS";
  }	


  return IsValid;


}




function ValidCalcAdd()
{
//  alert ("Validating Advertising Cost Form");

  var IsValid = true;

  document.getElementById("RequiredURLERR").style.color = "#333333";
  document.getElementById("RequiredLocationERR").style.color = "#333333";
  document.getElementById("Message").style.color = "#333333";


// Validate Page Selection For Add
  if (document.getElementById("RequiredURL").selectedIndex == 0 ) { // Nothing selected
    document.getElementById("RequiredURLERR").style.color = "#FF6600";
    IsValid = false;
  }


// Validate Add Locationtion For Add
  if (document.getElementById("RequiredLocation").selectedIndex == 0 ) { // Nothing selected
    document.getElementById("RequiredLocationERR").style.color = "#FF6600";
    IsValid = false;
  }


  if (IsValid == false) {
    document.getElementById("Message").style.color = "#FF6600";
  }	

  return IsValid;

}




function Validate_Add_CRM()
{
//  alert ("Validating Add CRM Form");

  var IsValid = true;
  document.getElementById("adminMess").innerText = "";


  //Make these two lines visable again.
  document.getElementById("adminMessHR1").style.color = "#E5E5E5";
  document.getElementById("adminMessHR2").style.color = "#E5E5E5";
  document.getElementById("adminMess").style.color = "#FF0000";

  //Set these fields to white initially
  document.getElementById("crm_business_nameERR").style.color = "#FFFFFF";
  document.getElementById("crm_business_websiteERR").style.color = "#FFFFFF";
  document.getElementById("crmcont_contact_name1ERR").style.color = "#FFFFFF";
  document.getElementById("crmcont_email1ERR").style.color = "#FFFFFF";


  String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
  }
  String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
  }
  String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
  }

  var myString;


  // 1. Check for a Business Name
  myString = document.getElementById("crm_business_name").value;
  var x = myString.trim();
  document.getElementById("crm_business_name").innerText = x;
  if (document.getElementById("crm_business_name").value.length == 0) {
    document.getElementById("crm_business_name").focus();
    document.getElementById("crm_business_nameERR").style.color = "#FF0000";
    document.getElementById("adminMess").innerText = "Business Name Required";
    IsValid = false;
  }

  // 2. Check for a Business Website 
  myString = document.getElementById("crm_business_website").value;
  var x = myString.trim();
  document.getElementById("crm_business_website").innerText = x;
  if (document.getElementById("crm_business_website").value.length == 0) {
    document.getElementById("crm_business_websiteERR").style.color = "#FF0000";
    if (IsValid) {
       document.getElementById("adminMess").innerText = "Business Website Required (www.?????????????.???)";
       document.getElementById("crm_business_website").focus();
       IsValid = false;
    }
  }

  // 3. Check for a Business Contact Name 
  myString = document.getElementById("crmcont_contact_name1").value;
  var x = myString.trim();
  document.getElementById("crmcont_contact_name1").innerText = x;
  if (document.getElementById("crmcont_contact_name1").value.length == 0) {
    document.getElementById("crmcont_contact_name1ERR").style.color = "#FF0000";
    if (IsValid) {
       document.getElementById("adminMess").innerText = "Contact Name 1 Required";
       document.getElementById("crmcont_contact_name1").focus();
       IsValid = false;
    }
  }



  // Check for a valid email address
  var ValidEmail = false;
  for (i=0; i<document.getElementById("crmcont_email1").value.length; i++) {
    if (document.getElementById("crmcont_email1").value.charAt(i) == "@") {
      ValidEmail = true;
      break;
    }
  }

  if (!ValidEmail) {
     document.getElementById("crmcont_email1ERR").style.color = "#FF0000";
     if (IsValid) {
        document.getElementById("adminMess").innerText = "Contact (1) Email Address Invalid";
        document.getElementById("crmcont_email1").focus();
        IsValid = false;
     }
  }


  return IsValid;
}

//-->
