function GetXmlHttpObject() {
		var objXMLHttp=null
		if (window.XMLHttpRequest) {
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject) {
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
	}

	function post(url,id,parameters)
	{
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Trinh duyet cua ban khong ho tro!")
			return false
		}
		

		
		xmlHttp.onreadystatechange = function()
		{
			document.getElementById(id).innerHTML = "<center>Đang tải ....</center>";
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				document.getElementById(id).innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.open('POST', url, true);
		xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		xmlHttp.setRequestHeader('Content-length', parameters.length);
		xmlHttp.setRequestHeader('Connection', 'close');
		xmlHttp.send(parameters);
		
	}


	function get(url,id)
	{
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Xin lỗi, tiến trình không thực hiện được do trình duyệt của bạn không hỗ trợ AJAX !")
			return false
		}
		xmlHttp.onreadystatechange = function()
		{
			document.getElementById(id).innerHTML = "<center>Đang tải ....</center>";
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				document.getElementById(id).innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.open('GET', url, true);
		xmlHttp.send(null);
		
	}		

	
	
	function getajax(ketqua,url)
	{
		get(url,ketqua);
	}
	
	function postajax(ketqua,url,db)
	{
		post(url,ketqua,db);
	}

	function rqqa(str)
	{
	   var a=top.location.href;
	   a= a.substr(a.indexOf("#")+1,a.length);
	   
	   if (str!=""&&str!=undefined)
	   {
		  a = a + ",";
		if (a.indexOf(str)>=0){
		  str=str + "=";
		  if (a.indexOf(str)>=0){
		  a = a.substr(a.indexOf(str)+str.length,a.length);  
		  a = a.substr(0,a.indexOf(","));
		  }
		  else
		  {
			  a="";
		  }
		}
		else
		{
		a="khongco";
		}
	   }
	   return a;
	}
