function createRequestObject() {
   var req;
   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
	  //alert('FIREFOX, SAFARI, OPERA...');
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
	  //alert('IE 5+');
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }
   return req;

}

function handleDivTag(divtag)
{
   var divtag;
   return divtag;
}

// Make the XMLHttpRequest object
var http = createRequestObject();


// Create the Divtag Handler -- Mainly an IE 6 Fix
var divhandler = new handleDivTag(null);

function sendRequest(act,id,lang,divtag) {
   // Open PHP script for requests
   http.open('get', '../includes/ajax.php?act='+act+'&id='+id+'&lang='+lang);
   http.onreadystatechange = handleResponse;
   divhandler.divtag = divtag;
   http.send(null);

}

function sendRequestPOST() {
   // Open PHP script for requests
   act=form1.act.value;
   divtag=form1.divtag.value;
   http.open('get', '../includes/ajax.php?act='+act);
   http.onreadystatechange = handleResponse;
   divhandler.divtag = divtag;
   http.send(null);

}
/*function sendRequestPost(act,divtag) {
   // Open PHP script for requests
   http.abort;
   http.open('post', 'ajax.php');
   http.setRequestHeader('Content-Type', 'application/x-www-form-
      urlencoded');
   divhandler.divtag = divtag;
   http.send('actPost='+act);

}*/


function handleResponse() {

   if(http.readyState == 4 && http.status == 200){
   
      // Text returned FROM the PHP script
      var response = http.responseText;

      if(response) {
         // UPDATE ajaxTest content
         document.getElementById(divhandler.divtag).innerHTML = response;
		 ///setTimeout(countPosts,20);  //call the interval			//			//			//			//			//
      }
	  
   }
   /*else if (http.readyState < 4) {
          document.getElementById(divhandler.divtag).innerHTML = "<em>Loading...</em>";
   }*/

}

