var http = false;

function postForm( url, formID, returnAction ) {
  // setup the http object //
  if( document.all ) {
    http = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
    http = new XMLHttpRequest();
  }

  var params = '';
  var field = null;
  // build params from form elements //
  var inputs = document.getElementById( formID ).getElementsByTagName('INPUT');
  for( var i = 0; i <= inputs.length-1; i++ ) {
    field = inputs[i];
    if( field.type == 'radio' || field.type == 'checkbox' ) {
      if( field.checked == true ) {
        params += inputs[i].name + '=' + inputs[i].value + '&';
      }
    } else {
      params += inputs[i].name + '=' + inputs[i].value + '&';
    }
  }
  if( params.length > 1 ) {
    params = params.substring( 0, params.length-1 );
  }

  http.open("POST", url, true);

  // Send the proper header information along with the request //
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  http.onreadystatechange = function() { // Call a function when the state changes //
    if( http.readyState == 4 && http.status == 200 ) {
      eval(returnAction);
    }
  }
  http.send(params);
}


function getPage( url, params, returnAction ) {
  // setup the http object //
  if( document.all ) {
    http = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
    http = new XMLHttpRequest();
  }

  http.open("GET", url + '?' + params, true);

  http.onreadystatechange = function() { // Call a function when the state changes //
    if( http.readyState == 4 && http.status == 200 ) {
      eval(returnAction);
    }
  }
  http.send(null);
}