function AJAX_POST( filename, params )
{

  // Begin processing the AJAX request
  try
  {
    // Mozilla (FireFox) supports XMLHttpRequest whereas
    // Internet Explorer uses ActiveX for the same transaction.
    //
    // Rather than reply upon browser detection, simply try
    // to detect the object.
    xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new
    ActiveXObject( "Microsoft.XMLHTTP" );
  }
  catch( e )
  {
    // In the case of catching an exception, the 
    // browser either does not support AJAX requests
    // or for some reason is failing.
    //
    // This event may be handled in future versions
    // of openFace but is intentionally left blank
    // for now.
  }

  // Use the XMLHTTP object to open the external page
  //
  // The XMLHTTP object triggers an event everytime the status
  // of the request changes.  Due to scope limitations, it is
  // necessary that each individual function handle the
  // 'onreadystatechange' event.
  //
  // Note that there are five ( 5 ) ready state codes:
  //   0 = Uninitialized
  //   1 = Loading
  //   2 = Loaded
  //   3 = Interactive
  //   4 = Completed
  //
  xmlhttp.open( "POST", filename, true );
  xmlhttp.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
  xmlhttp.setRequestHeader( "Content-length", params.length );
  xmlhttp.setRequestHeader( "Connection", "close" );

  // Send the AJAX request
  //
  // Note that Mozilla (FireFox) will handle a send();
  // but Internet Explorer expects at very least a NULL
  // value to be passed as part of the function.
  // 
  // It's a good idea in general to always pass the
  // parameter something for cross-browser support.
  //
  xmlhttp.send( params );

}

function toggle_submit( id, middle, end )
{
  // Update the middle ground
  document.getElementById( id ).value = middle;

  // Restore the submit button
  setTimeout(function(){restore_submit(id, end)}, 1000 );
}

function restore_submit( id, end )
{
  document.getElementById( id ).value = end;
}

