var xmlHttp;
var tempstr;
var statesArray;

function getArrayFromDB()
	{
		var str = "xyz"; //temp string needs to be there
		if(str.length==0)
			{
				return;
			}
		
		xmlHttp = GetXmlHttpObject();

		if(xmlHttp==null)
			{
				alert("Browser does not support HTTP Request");
			}
		
		var url = "getArray.asp";
		url = url+"?q="+str;
		url = url+"&sid="+Math.random();
		xmlHttp.onreadystatechange = stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);			
	}
	
function stateChanged()
	{
				
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				var tempstr = new String(xmlHttp.responseText);
				statesArray = tempstr.split("|");
				var arraylength = statesArray.length;

				oACDS = new YAHOO.widget.DS_JSArray(statesArray);
				oAutoComp = new YAHOO.widget.AutoComplete('statesinput','statescontainer', oACDS);
  				oAutoComp.queryDelay = 0;
  				oAutoComp.maxResultsDisplayed = arraylength;
				oAutoComp.prehighlightClassName = "yui-ac-prehighlight";
			    oAutoComp.typeAhead = false;
			    oAutoComp.useShadow = true;
			    oAutoComp.animVert = true;
			    oAutoComp.animHoriz = false;
				oAutoComp.animSpeed = 0.1;
				oAutoComp.allowBrowserAutocomplete = false;
											
			}  
	}
	
function GetXmlHttpObject()
	{
		var ObjXmlHttp = null;
		if(window.XMLHttpRequest)
			{
				objXmlHttp = new XMLHttpRequest();
			}
		else if(window.ActiveXObject)
			{
				objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
		return objXmlHttp;
	}


