// JavaScript Document
var zipLookup;
var searchString;
var maxResults = 8;

function getData(qry)
{
	while (qry.indexOf('%20') >= 0)
		qry = qry.replace(/%20/,' ');
	
	searchString = qry;
	
	DWREngine._execute(_cfscriptLocation, null, 'getSearchResults', searchString, getDataResult);
}

function getDataResult(queryArray)
{
	
	var key = Array();
	var value = Array();
	
	for (i=0; i < queryArray.length; i++)
	{
		if (i >= maxResults)
			break;
			
		key[i] = '';
		value[i] = queryArray[i]['VALUE'];
	}
	strQuery = selectedSuggestObject.name + '.showQueryDiv("' + searchString + '", key , value)';
	eval (strQuery);
}

function onPageLoad()
{
	zipLookup = new Suggest(); 
	searchString = "";
	
	zipLookup.setListStyle("listStyle");
	zipLookup.setListItemStyle("listItemStyle");
	zipLookup.setListItemKey("listItemKey");
	zipLookup.setListItemValue("listItemValue");
	zipLookup.setListWidth("200px");

	zipLookup.setShowKey(false);
	zipLookup.setQueryFieldHolds(1);
	
	onSuggestFieldFocus(zipLookup);
	zipLookup.InitQueryCode('zipLookup','quicksearchText');
}
