function isBlank(s) {
  if (s==null) {return true;}
  for (var i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if ((c != ' ') && (c != '\n') && (c != '\r')) return false;
  }
  return true;
}


function isEmail(string) {
    return (string.search(/^\w+((-\w+)|(\.\w+)|('\w+))*\@[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)+$/) != -1);
}

function trim(string) {
// removes spaces at the beginning of a string
    string = string.replace(/^\s*/, "");
// removes spaces at the end of a string
    string = string.replace(/\s*$/, "");

    return string;
}

function isReady(form) {

  if (isBlank(form.email.value)) {
    alert("Please enter your email address.");
    form.email.focus();
    return false;
  }
  else {
    // remove ALL spaces
    form.email.value = trim(form.email.value);
  }
  if (isEmail(form.email.value) == false) {
    alert("'"+form.email.value+"' is not a valid email address.\n"+
          "Please enter a valid email address.");
    form.email.focus();
    return false;
  }

}

function openMapper(id, neighborhood) {
   window.open ("/maps/locationinput.php?nabe="+ neighborhood+"&cid="+id,"mapinput","menubar=0,resizable=1,width=420,height=480");

}

