// object oriented ajax by monix 
// Date : December 16, 2008

function ajax_engine ()
{
	this.xmlHttp = null;
	this.elementid = "txtHint";
	this.url ="";
	
	this.showHint = function (str)
	{
		if (str.length==0)
		{ 
			document.getElementById(this.elementid).innerHTML="";
			return;
		}
		
		this.xmlHttp = this.GetXmlHttpObject();
		if (this.xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
		
		this.url = this.url + "?sid="+Math.random()+"&q="+str;		 
		
		var tempelementid = this.elementid;
		
		this.xmlHttp.onreadystatechange=function()
		 {
			if (this.readyState==4 || this.readyState=="complete")
			{
				document.getElementById(tempelementid).innerHTML=this.responseText;
			}
		 };
		 
		this.xmlHttp.open("GET",this.url,true);
		this.xmlHttp.send(null);
	}
	
	
	this.GetXmlHttpObject = function ()
	{
		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;
	}
}// JavaScript Document