<script type="text/javascript">
function createRequestObject(){

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }

   return req;
}

// Make the XMLHttpRequest array
var http_array = new Array();

function handleResponse(div){

	var i = 0;

	for(i=0;i<http_array.length;i++){
		
		if(http.readyState == 4 && http.status == 200){

		  // Text returned from PHP script
		  var response = http_array[i].responseText;	  
		  
		  if(response){
			 // delete array value
			 http_array.splice(i,1);
			 i--;
			 // Update ajaxTest content
			 document.getElementById(div).innerHTML = response;
		  }
		}
	}
}

function handleResponse_submit(div, submit_id){

	var i = 0;

	for(i=0;i<http_array.length;i++){
		
		if(http.readyState == 4 && http.status == 200){

		  // Text returned from PHP script
		  var response = http_array[i].responseText;	  
		  
		  if(response){
			 // delete array value
			 http_array.splice(i,1);
			 i--;
			 // Update ajaxTest content
			 document.getElementById(div).innerHTML = response;
		  }
		}
	}
	
	document.getElementById(submit_id).submit();
	
}

</script>
