// JavaScript Document

//the response values
var responseValue;

//the handle for the xmlhttp object that will be created
var req;



function sendRequest(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		//req.onreadystatechange = processReqChange;
		req.open("GET", url, false);
		req.send("");
		
		processReqChange();
	}
}




function processReqChange() {

   if(req.readyState == 4) {
	   
      // Text returned FROM the PHP script
      var response = req.responseText;

      if(response) {
		  
         // UPDATE ajaxTest content
		 responseValue = response;
		 
	  } else {
		  
		responseValue = "no response from PHP";  

	  }

   } else {
	
		responseValue = "ReadyState: " + req.readyState;

   }

}