﻿function SetSearchEngineCountryChangeCB(res){var cityDDL=document.getElementById('orasDestinatie');var categoryDDL=document.getElementById('hotel');if(res&&res.value){if(cityDDL){var cityList=res.value[0];if(cityList!=null&&cityList.length>0){ClearSelect(cityDDL);PopulateDropDown(cityDDL,cityList,0);cityDDL.disabled=false;ConvertSingleSelect('#orasDestinatie');}}
if(categoryDDL){var categoryList=res.value[1];if(categoryList!=null&&categoryList.length>0){ClearSelect(categoryDDL);PopulateDropDown(categoryDDL,categoryList,0);categoryDDL.disabled=false;ConvertSingleSelect('#hotel');}}}}
function SetSearchEngineCityHotelsCB(res){var categoryDDL=document.getElementById('hotel');if(res&&res.value){if(categoryDDL){var categoryList=res.value[0];if(categoryList!=null&&categoryList.length>0){ClearSelect(categoryDDL);PopulateDropDown(categoryDDL,categoryList,0);categoryDDL.disabled=false;ConvertSingleSelect('#hotel');}}}}
function SetSearchEngineCountryChange(){var countryDDL=document.getElementById('taraDestinatie');var cityDDL=document.getElementById('orasDestinatie');var categoryDDL=document.getElementById('hotel');if(countryDDL&&cityDDL&&categoryDDL){var newCountryId=-1;if(countryDDL.selectedIndex>=0){newCountryId=countryDDL.options[countryDDL.selectedIndex].value;}
ClearSelect(cityDDL);ClearSelect(categoryDDL);if(newCountryId>0){var objOption=document.createElement("option");objOption.text='Lista se incarca ...';objOption.value='-1';var catObjOption=document.createElement("option");catObjOption.text='Lista se incarca ...';catObjOption.value='-1';if(document.all&&!window.opera)
{cityDDL.add(objOption);categoryDDL.add(catObjOption);}
else
{cityDDL.add(objOption,null);categoryDDL.add(objOption,null);};cityDDL.selectedIndex=0;cityDDL.disabled=true;ConvertSingleSelect('#orasDestinatie');categoryDDL.selectedIndex=0;categoryDDL.disabled=true;ConvertSingleSelect('#hotel');if(typeof(AjaxPro)!='undefined'&&AjaxPro!=null){AjaxPro.timeoutPeriod=60000;}
if(typeof(AdvancedSearchEngine)!='undefined'&&AdvancedSearchEngine!=null){AdvancedSearchEngine.CountryChange(newCountryId,SetSearchEngineCountryChangeCB);}}
else{var objOption=document.createElement("option");objOption.text='Alegeti mai intai o tara';objOption.value='-1';if(document.all&&!window.opera)
{cityDDL.add(objOption);}
else
{cityDDL.add(objOption,null);};cityDDL.selectedIndex=0;cityDDL.disabled=true;ConvertSingleSelect('#orasDestinatie');}}}
function SetSearchEngineCityHotels(){var countryDDL=document.getElementById('taraDestinatie');var cityDDL=document.getElementById('orasDestinatie');var categoryDDL=document.getElementById('hotel');if(countryDDL&&cityDDL&&categoryDDL){var newCountryId=-1;if(countryDDL.selectedIndex>=0){newCountryId=countryDDL.options[countryDDL.selectedIndex].value;}
var newCityId=-1;if(cityDDL.selectedIndex>=0){newCityId=cityDDL.options[cityDDL.selectedIndex].value;}
ClearSelect(categoryDDL);if(newCityId>0||newCountryId>0){var objOption=document.createElement("option");objOption.text='Lista se incarca';objOption.value='-1';if(document.all&&!window.opera)
{categoryDDL.add(objOption);}
else
{categoryDDL.add(objOption,null);};categoryDDL.selectedIndex=0;categoryDDL.disabled=true;ConvertSingleSelect('#hotel');if(typeof(AjaxPro)!='undefined'&&AjaxPro!=null){AjaxPro.timeoutPeriod=30000;}
if(typeof(AdvancedSearchEngine)!='undefined'&&AdvancedSearchEngine!=null){AdvancedSearchEngine.CityChange(newCountryId,newCityId,SetSearchEngineCityHotelsCB);}}
else{var objOption=document.createElement("option");objOption.text='Alegeti mai intai o statiune';objOption.value='-1';if(document.all&&!window.opera)
{categoryDDL.add(objOption);}
else
{categoryDDL.add(objOption,null);};categoryDDL.selectedIndex=0;categoryDDL.disabled=true;ConvertSingleSelect('#hotel');}}}
