function search_submit()
{
  // This function is used for submitting the
  // contents of the search box
  var q = document.getElementById( 'q' ).value;

  // Format any ampersands with URL friendly characters
  q = q.replace( /&/g,'%26' );

  // TODO Replace the %20 that the parser picks up with +

  // Redirect the user to the search
  window.location = "index.php?module=Search&q=" + q;
}

function search_listen( event )
{
  // The only purpose of this script is to ensure
  // that regardless of any other JavaScript pieces
  // running in the code, that the user can press
  // the enter key to submit his or her search.
  //
  // This is particularly important of the search
  // form as it has been purposefully designed 
  // without the submit button available.
  //
  if( navigator.appName.indexOf('Microsoft') != -1 )
  {
    // Handle the enter key for IE browsers
    if( window.event && window.event.keyCode == 13 )
      search_submit();
    else
      return true;
  }
  else
  {
    // Handle the enter key for other browsers
    if( event && event.which == 13 )
      search_submit();
    else
      return true;
  }

}
