<!--

function LiveSearch(pExtra, pComponentId)
{
	this.cExtra       = pExtra;
	this.cComponentId = pComponentId;

	this.cMaxCount    = 10;
	this.cCounter     = 1;
	this.cResultTimer = false;
	this.cWaitTime    = 1000; // milli seconds
	this.cUrl         = 'index.phtml';
	this.cArrParams   = new Array();

	this.cIsSearching = false;

	this.cObjAjaxConnector = false;
	this.cXmlResults = '';

	this.checkForResults = function ()
	{
		if (this.cObjAjaxConnector.getHasResults() || this.cCounter >= this.cMaxCount)
		{
			clearInterval(this.cTimer);

			if (this.cObjAjaxConnector.getHasResults())
			{
				this.cXmlResults = this.cObjAjaxConnector.getResponse();
				//alert("XML Results: " + this.cXmlResults);
			}
			else
			{
				// Process Error
				alert('error - no results back');
			}
		}
		else
		{
			this.cCounter++;
		}
	};

	this.getResponseType = function()
	{
		return this.cObjAjaxConnector.getResponseType();
	};

	this.getParams = function()
	{
		return this.cArrParams;
	};

	this.buildParams = function()
	{
		this.cArrParams[0] = new Array('extra', this.cExtra);
		this.cArrParams[1] = new Array('command', 'dynamic');

		switch (this.cExtra)
		{
			case 'sightseeing':
				this.cArrParams[2] = new Array('from_day', document.getElementById('city_sightseeing_start_day[' + this.cComponentId + ']').value);
				this.cArrParams[3] = new Array('from_month', document.getElementById('city_sightseeing_start_month[' + this.cComponentId + ']').value);
				this.cArrParams[4] = new Array('from_year', document.getElementById('city_sightseeing_start_year[' + this.cComponentId + ']').value);
				this.cArrParams[5] = new Array('num_adults', document.getElementById('city_sightseeing_num_adults[' + this.cComponentId + ']').value);
				this.cArrParams[6] = new Array('num_children', document.getElementById('city_sightseeing_num_children[' + this.cComponentId + ']').value);
				this.cArrParams[7] = new Array('num_infants', document.getElementById('city_sightseeing_num_infants[' + this.cComponentId + ']').value);
				this.cArrParams[8] = new Array('destination', document.getElementById('city_sightseeing_tour[' + this.cComponentId + ']').value);
				//this.cArrParams[9] = new Array('airport', mAirport);
			break;

			case 'lounge':

				var mAirport = document.getElementById('lounge_airport_text[' + this.cComponentId + ']').value;
				mAirport = mAirport.substr(mAirport.indexOf('(') + 1, 3);

				this.cArrParams[2] = new Array('from_day', document.getElementById('lounge_day[' + this.cComponentId + ']').value);
				this.cArrParams[3] = new Array('from_month', document.getElementById('lounge_month[' + this.cComponentId + ']').value);
				this.cArrParams[4] = new Array('from_year', document.getElementById('lounge_year[' + this.cComponentId + ']').value);
				this.cArrParams[5] = new Array('from_time', document.getElementById('lounge_time[' + this.cComponentId + ']').value);
				this.cArrParams[6] = new Array('num_adults', document.getElementById('lounge_number_of_adults[' + this.cComponentId + ']').value);
				this.cArrParams[7] = new Array('num_children', document.getElementById('lounge_number_of_children[' + this.cComponentId + ']').value);
				this.cArrParams[8] = new Array('num_infants', document.getElementById('lounge_number_of_infants[' + this.cComponentId + ']').value);
				this.cArrParams[8] = new Array('airport', mAirport);
			break;
		}
	}

	this.getResponse = function ()
	{
		return this.cObjAjaxConnector.getResponse();
	};

	this.search = function()
	{
		this.cObjAjaxConnector = new AjaxConnector();
		this.cObjAjaxConnector.setParams(this.cArrParams);
		this.cObjAjaxConnector.process();
	};

	this.hasResults = function()
	{
		return this.cObjAjaxConnector.getHasResults();
	};
}

// -->
