// JS functions for the top level page.

function trim(s) {
  s = s.replace(/^[ 	]*/, "");
  s = s.replace(/[ 	]*$/, "");
  return s;
}

function checkInputFields() {
  var lname  = (document.f1.name.value = trim(document.f1.name.value)).length;
  var lurl   = (document.f1.url.value = trim(document.f1.url.value)).length;

  if (document.f1.file.value < 1) {
    alert("Nothing to Hash.  Need an Image file at least!");
    return false;
  }
  return true;
}

function clearHelp() {
  window.status="";

  document.getElementById("helpBox").innerHTML = topHelp = "<ol>" +
	  "<li> Click browse.  Upload your photo.  Enter details if you want." +
	  "<li> Hit \"Hash\" (or \"Shmash\" to update details for a previously uploaded photo)." +
	  "<li> We search for other people that look like you." +
	  "</ol>";

  return true;
}

function hashHelp() {
  window.status='Hash Thyself.  Find thy Zeta.';
  document.getElementById("helpBox").innerHTML = "hashHelp";
  return true;
}

function zetaHelp() {
  window.status='Thy Zeta is someone who looks like thee.';
  document.getElementById("helpBox").innerHTML = "Zeta Help";
  return true;
}

function shmashHelp() {
  window.status='Shmash thy record.  Explore\'st Hash space again for thy Zeta';
  document.getElementById("helpBox").innerHTML = "Shmash Help";
  return true;
}

function snapHelp() {
  window.status="Upload\'st a headshot smaller than 100KB";
  return true;
}


