var debug = false;
function GetXmlHttp() {	
	var xmlhttp = false;
	if (window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
  }
	else if (window.ActiveXObject)// code for IE
	{
		try 
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp=false;
			}
		}
	}
	return xmlhttp;
}


function PassAjaxResponseToFunction(url, callbackFunction, params)
{		
  var xmlhttp = new GetXmlHttp();
  //now we got the XmlHttpRequest object, send the request.
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = function () 
                                {
	                                if (xmlhttp && xmlhttp.readyState==4)
	                                {//we got something back..
		                                if (xmlhttp.status==200)
		                                {
			                                var response = xmlhttp.responseText;
			                                var functionToCall = callbackFunction+'(response,'+params+')';
			                                if(debug){
				                                alert(response);
				                                alert (functionToCall);
			                                }
			                                eval(functionToCall);
		                                } else if(debug){
			                                document.write(xmlhttp.responseText);
		                                }
	                                }
                                }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}





function AjaxResponse(url, obj_id)
{		
  var xmlhttp = new GetXmlHttp();
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = function () 
                                {
	                                document.getElementById(obj_id).innerHTML="<br><br><div class='DarkText' align='center'>Đang tải dữ liệu...</div><br><br>";
									if (xmlhttp && xmlhttp.readyState==4)
	                                {//we got something back..
		                                if (xmlhttp.status==200)
		                                {
			                                if(debug){
				                                alert(xmlhttp.responseText);
			                                }
			                                if(typeof obj_id == 'object'){
				                                obj_id.innerHTML = xmlhttp.responseText;
			                                } else {
				                                document.getElementById(obj_id).innerHTML = xmlhttp.responseText;
			                                }
		                                } else if(debug){
			                                document.Write(xmlhttp.responseText);
		                                }
	                                }
                                }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}



function AjaxResponsePage(url, objLoading_id, obj_id)
{		
  var xmlhttp = new GetXmlHttp();
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = function () 
                                {
	                                document.getElementById(objLoading_id).innerHTML="<b>Đang tải dữ liệu...</b>";
									if (xmlhttp && xmlhttp.readyState==4)
	                                {//we got something back..
		                                if (xmlhttp.status==200)
		                                {
			                                if(debug){
				                                alert(xmlhttp.responseText);
			                                }
			                                if(typeof obj_id == 'object'){
				                                obj_id.innerHTML = xmlhttp.responseText;												
			                                } else {
				                                document.getElementById(obj_id).innerHTML = xmlhttp.responseText;									
			                                }
		                                } else if(debug){
			                                document.Write(xmlhttp.responseText);
		                                }
	                                }
                                }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}
function ActiveData(url)
{		
 ///alert('ahdofa');
  var xmlhttp = new GetXmlHttp();
  //now we got the XmlHttpRequest object, send the request.
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = function () 
//                              alert("hfoafhoas");
							  {
									if (xmlhttp && xmlhttp.readyState==4)
	                                {//we got something back..
		                                if (xmlhttp.status==200)
		                                {
			                                if(debug){
				                               // alert(xmlhttp.responseText);									
			                                }
											else {
				                                //alert(xmlhttp.responseText);
//												alert(xmlhttp.responseText,"");
												//history(-1);
			                                }
		                                } else if(debug){
			                               // alert(xmlhttp.responseText);
											
		                                }
	                                }
                                }
	var d = new Date();
	var t = d.getTime();
	url = url + "&Time=" + t;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}
