/* Начало ## Создание объекта по обработке поля "Отель" */
/* Начало ### Расширение объекта searchList */
extSearchExpress.prototype = new searchList(); 
function extSearchExpress ()
{
	
	this.addParCity = '';
	var pathname = window.location.pathname.match(/cities_(parent_)*([\d]+)+_/);
	if(pathname[2])
	{
		this.addParCity = pathname[2]; 
	}
	this.full = 'no';
	this.more = 'none';
}

extSearchExpress.prototype.chooseStatusHotel = function() 
{ 
	var idStatus = document.getElementById;
	if (idStatus.value == 'yes')
	{
		this.addParCity == document.getElementById('currentCity');
	}
	else
	{
		idStatus.value = 'no';
	}
}

extSearchExpress.prototype.doSearchExpress = function (data_elem, domen)
{ 
	window.clearTimeout(searchCity1.timeoutID);
	formXmlHTTP = new HttpRequest(window);
	formXmlHTTP.setMethodRequest('POST');
	formXmlHTTP.setEndPoint(domen);
	//alert ('data_elem='+data_elem+'&addParCity='+this.addParCity+'&full='+this.full+'&more='+this.more);
	formXmlHTTP.load('data_elem='+data_elem+'&addParCity='+this.addParCity+'&full='+this.full+'&more='+this.more, false);
	formXmlHTTP.getResponse();
	searchCity1.mainXML = formXmlHTTP.getXML();
	searchCity1.mainXMLt = formXmlHTTP.getText();
	searchCity1.buildListAnswer (searchCity1.mainXML);
}
/* Конец ### Расширение объекта searchList */
var searchCity1 = new extSearchExpress();
searchCity1.currentWord = 'Введите отел...';
searchCity1.changeWord = 'Введите отель...';
searchCity1.startValue = 'Введите отель...';
searchCity1.setDomen(window.location.host+'/newDes/searchexpress_hotel.php');
searchCity1.absolute = true;
searchCity1.width = '235px';
searchCity1.setMainArena('con_exp_search1');
searchCity1.setCurrentElement (document.getElementById('search_city1'));
searchCity1.setIdInput('search_city1');

var timeOC;
function delayStart1()
{	
	window.clearTimeout(timeOC);
	timeOC = setTimeout('timeOutChar1 ()', 300);
}

function timeOutChar1 ()
{
	searchCity1.startSearch();
}

function clickCity1 ()
{
	clearInputSH('search_city1');
	var el = document.getElementById('search_city1');
	if (el)
	{
		if (el.addEventListener)
		{
	  		el.addEventListener('keyup', function() {delayStart1();}, false); 
		} 
		else if (el.attachEvent)
		{
		 	el.attachEvent('onkeyup', function() {delayStart1();});
		}
	}
	else
	{
		alert ('Error: Is Not found element or not completely loaded document');
	}
}

//var test1 = window.setInterval(delayStart1, 1400);

/* Конец ## Создание объекта по обработке поля "Отель" */

/** Additional functions**/

function checkCityAdd (idElem, par)
{
	clearInputSH(idElem, par);
	searchCity1.startSearch();
}


function clearInputSH (serId, fall)
{
	document.getElementById(serId).value = '';
}

function getAllHotel ()
{
	searchCity1.full = 'yes';
	searchCity1.doSearchExpress(searchCity1.currentWord, searchCity1.domen);
	searchCity1.full = 'no';
	return false;
}
