function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var http = getXMLHTTPRequest();
var divname="";

function ajax_do(divn,filename) {
  var myurl = filename;
  divname=divn;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}

function ajax_do2(filename) {
  var myurl = filename;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse2;
  http.send(null);
}

function useHttpResponse() {
	
	
   if (http.readyState == 4) {
    if(http.status == 200) {
       var mytext = http.responseText;
       document.getElementById(divname).innerHTML = mytext;
		}
  } else{
  
    	if(divname=='wholeDiv'){
	  		lodingimagpath="themes/default/loading/loading5.gif";
	  		document.getElementById(divname).innerHTML = '<div align=right><img border=0 src="'+lodingimagpath+'"></div>';	  
  		}
  		else{
	    	lodingimagpath="themes/default/loading/loading5.gif";
  			document.getElementById(divname).innerHTML = '<div align=right style="height:20px"><img border=0 src="'+lodingimagpath+'"></div>';
  		}
	}  

}
function useHttpResponse2() {	
   if (http.readyState == 4) {
    if(http.status == 200) {
		//alert('2');
       //var mytext = http.responseText;
       //document.getElementById(divname).innerHTML = mytext;
		}
  } 
}



