function translate(word){
	if (word.length === 0 || word == ''){ 
		return false;
	} else {
		document.getElementById("q").focus();
	}
	document.getElementById("q").value = word.replace(/_/gi," ");
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp === null)
	{
		alert ("Browser does not support HTTP Request");
		return false;
	} 
	  
	var url= "lookup.php?w="+encodeURIComponent(word);
	xmlHttp.onreadystatechange = GetTranslation;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function GetTranslation()
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{
		document.getElementById("result").style.display = "block";
		document.getElementById("loadbar").style.display = "none";
		document.getElementById("result").innerHTML = xmlHttp.responseText;
		addElement(document.getElementById("q").value);
		document.getElementById("q").value = "";
		document.getElementById("dict_limitinfo").innerHTML = "100";
	}
	else
	{
		document.getElementById("result").style.display = "none";
		document.getElementById("loadbar").style.display = "block";
	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
	// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}