function HandleSearch(elementId)
{
    var element = document.getElementById(elementId);
    var value = "";
    if ((element) &&
        (element.value))
    {
        value = element.value;
    }
    location = "/site-search.aspx?query=" + escape(value);
    return false;
}

function HandleKeyPressForFormElement(e, submissionButtonId)
{
  if (!e) var e = window.event;
  var numCharCode;
  var elTarget;
  if (e.keyCode)
  {
    numCharCode = e.keyCode;
  }
  else
  {
    numCharCode = e.which;
  }
  if (e.target)
  {
    elTarget = e.target;
  }
  else
  {
    elTarget = e.srcElement;
  }
  if (elTarget.tagName.toLowerCase() == "input")
  {
    var strType = elTarget.getAttribute('type').toLowerCase();
    switch (strType)
    {
      case "checkbox":
      case "radio":
      case "password":
      case "text":
        // the "Enter" key was pressed and the focus is in a form element that shouldn't submit the form.
        // click the correct button and cancel the "Enter" key action.
        if (numCharCode == 13)
        {
          var submissionButton = document.getElementById(submissionButtonId);
          if (submissionButton)
          {
            submissionButton.click();
          }
          return false;
        }
    }
  }
  return true;
}

