// JavaScript Document
var httpobject;

function getInfo(str,length)
{
	var pro_code=document.getElementById('pro_code').value;
 	if(str.length != 0)
 	{
		httpobject=GetHttpObject();
		if (httpobject !=null)
  		{
			var url="./js/dropdown/info.php";
			url=url+"?str="+str;
			url=url+"&length="+length;
			url=url+"&pro_code="+pro_code;
			httpobject.onreadystatechange=stateChanged;
			httpobject.open("GET",url,true);			
			httpobject.send(null);
 		}
 	}
 	else
 	{
  		document.getElementById("autoSuggestionsList").innerHTML=""; 
 	}
}

function stateChanged()
{
	if (httpobject.readyState==4)
	{
		document.getElementById("autoSuggestionsList").innerHTML=httpobject.responseText;
		document.getElementById("loader").innerHTML='&nbsp;';
	}
	else
	{
		document.getElementById("loader").innerHTML='<img src="images/ajax-loader.gif" alt="Loading" />';
	}
}

function GetHttpObject()
{
	if (window.ActiveXObject) 
  		return new ActiveXObject("Microsoft.XMLHTTP");
  	else if (window.XMLHttpRequest) 
  		return new XMLHttpRequest();
  	else 
  	{
  		alert("Your browser does not support AJAX.");
  		return null;
  	}
}

function setValue(str,CityID)
{
	document.getElementById("city_name").value=str;
	document.getElementById("city_id").value=CityID;
	document.getElementById("autoSuggestionsList").innerHTML="";
}

function changebg(direction,row) //function to change background color of cell mouse is over.
{
	if(direction=="over")
	{
		document.getElementById(row).style.backgroundColor="#ee6723";
		document.getElementById(row).style.color="#fff";
	}
	else
	{
		document.getElementById(row).style.backgroundColor="#fbd09d";
		document.getElementById(row).style.color="#000";
	}
}

