// global variables to keep track of the request
// and the function to call when done
var ajaxreq=false, ajaxCallback;
// ajaxRequest: Sets up a request for the GET method
function ajaxRequest(filename) {
   try {
    // Firefox / IE7 / Others
    ajaxreq= new XMLHttpRequest();
   } catch (error) {
    try {
      // IE 5 / IE 6
      ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (error) {
      return false;
    }
   }
   ajaxreq.open("GET",filename);
   ajaxreq.onreadystatechange = ajaxResponse;
   ajaxreq.send(null);
}
// ajaxResponse: Waits for response and calls a function
function ajaxResponse() {
   if (ajaxreq.readyState !=4) return;
   if (ajaxreq.status==200) {
      // if the request succeeded...
      if (ajaxCallback) ajaxCallback();
   } else alert("ajax.js says: Request failed: " + ajaxreq.statusText);
   return true;
}


// testing the post function

function ajaxRequestPost(data) {
filename = 'NFTE2.php';
//alert ('ajaxRequestPost  ' + filename);

   try {
    // Firefox / IE7 / Others
    ajaxreq= new XMLHttpRequest();	//ajaxreq holds the ajax object
   } catch (error) {
    try {
      // IE 5 / IE 6
      ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (error) {
      return false;
    }
   }
   ajaxreq.open("POST",filename);
   ajaxreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//     ajaxreq.setRequestHeader('Content-Type', 'text/xml');
   ajaxreq.onreadystatechange = ajaxResponse;
// ajaxreq.send(null);
   ajaxreq.send(data); //Posting data to PHP File
}

