
function submitComment() {
  var project = document.getElementById("project").value;
  var version = document.getElementById("version").value;
  var comment = document.getElementById("comment").value;
  var url = "http://testpilot.library.vanderbilt.edu/includes/submittal.php";

  request.open("POST", url, true);
  request.onreadystatechange = showConfirmation;
  request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  request.send("project=" + escape(project) +
               "version=" + escape(version) + 
               "comment=" + escape(comment));
}

function showConfirmation() {
  if (request.readyState == 4) {
    if (request.status == 200) {
    var response = request.responseText;
    var mainDiv = document.getElementById("etrialscomment");
    var commentForm = document.getElementById("comment-form");

    pElement = document.createElement("p");
    textNode = document.createTextNode("Comment submitted! Thank you!");
    pElement.appendChild(textNode);

    mainDiv.replaceChild(pElement, commentForm);

  } else { 
    var message = request.getResponseHeader("Status");
    if ((message.length == null) || (message.length <= 0)) {
      alert("Error! Request status is " + request.status);
    } else {
      alert(message);
    }
  }
 }
}

function errorMsg()
{
  alert("Firefox is needed to install the search plugin.");
}
function addEngine(name,ext,cat)
{
  if ((typeof window.sidebar == "object") && (typeof
  window.sidebar.addSearchEngine == "function"))
  {
    //cat="Web";
    //cat=prompt('In what category should this engine be installed?','Web')
    window.sidebar.addSearchEngine(
      "http://testpilot.library.vanderbilt.edu/testpilot/tools/firefox/"+name+".src",
      "http://testpilot.library.vanderbilt.edu/testpilot/tools/firefox/"+name+"."+ext,
      name,
      cat );
  }
  else
  {
    errorMsg();
  }
}
