function noop() {
}

function goBack() {
  window.history.go(-1);
}

function goToAppStore(appId) {
  window.location = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=" + appId + "&mt=8";
}

function goHome() {
  window.location = "http://www.zealogic.com/index.html";
}

function goProducts() {
  window.location = "http://www.zealogic.com/products.html";
}

function goSupport(s) {
  var dest = "http://www.zealogic.com/apps/SupportCtr/Support.aspx";
  if (s) dest += ("?appId=" + s);
  window.location = dest;
}

function goContact() {
  window.location = "http://www.zealogic.com/contact.html";
}

function goApp(appName) {
  window.location = "http://www.zealogic.com/apps/" + appName + "/";
}

String.prototype.trim = function() {
  var _ret = this.replace(/^\s+/g, '');
  return _ret.replace(/\s+$/g, '');
}

function validate(form) {
  form.email.style.borderColor = "#c6deff";
  form.comments.style.borderColor = "#c6deff";

  if (form.email.value == "" || form.email.value == null || !isNaN(form.email.value)) {
    alert("Email address is required. Please enter it and resubmit.");
    form.email.style.borderColor = "#ff0000";
    form.email.focus();
    return false;
  }
  
  var emailVal = form.email.value.trim();
  var idx = emailVal.indexOf("@");
  if (idx <= 0 || idx == emailVal.length - 1) {
    alert("Email address format is incorrect (e.g. joe@mail.com). Please enter it and resubmit.");
    form.email.style.borderColor = "#ff0000";
    form.email.focus();
    return false;
  }
  else {
    idx = emailVal.indexOf("@", idx+1);
    if (idx != -1) {
      alert("Email address format is incorrect (e.g. joe@mail.com). Please enter it and resubmit.");
      form.email.style.borderColor = "#ff0000";
      form.email.focus();
      return false;
    }
  }

  if (form.comments.value.trim() == "" || form.comments.value == null) {
    alert("Comments/Suggestions/Feedback is required. Please enter it and resubmit.");
    form.comments.style.borderColor = "#ff0000";
    form.comments.focus();
    return false;
  }

  return true;
}
