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,parameters)
	{
		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 "";
		}
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
			return 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)
	{
		var source;
		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 "";
		}
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				source = xmlHtml.responseText;
				return xmlHttp.responseText;
			}
		}
		xmlHttp.open('GET', url, true);
		xmlHttp.send(null);
	}		

	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="";
		}
	   }
	   return a;
	}
	
	

function Translate()
{
	document.getElementById("noidung").innerHTML="<br/><br/><center><img src='loading.gif' border='0'/> wait for seconds....</center>";
	tf=document.frm.tf.value;
	tt=document.frm.tt.value;
	vanban=encodeURIComponent(document.frm.vanban.value);
	data="tf="+tf+"&tt="+tt+"&text="+vanban;
	xmlhtml=GetXmlHttpObject();
	if(xmlhtml!=null)
	{
		xmlhtml.onreadystatechange = function()
		{
			if(xmlhtml.readyState==4 && xmlhtml.status==200)
			{
			source=xmlhtml.responseText;
				document.getElementById("noidung").innerHTML=source;
			}
		}
		xmlhtml.open("POST","translate.php",true)
		xmlhtml.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		xmlhtml.setRequestHeader('Content-length', data.length);
		xmlhtml.setRequestHeader('Connection', 'close');
		xmlhtml.send(data);
	}
	return false;
}
