
function getTabData(url, pars) {
    if ( typeof(updater) != 'undefined') {
        updater.stop();
    }
    updater = new Ajax.PeriodicalUpdater('result_page', url, {parameters: pars, asynchronous:true, frequency: 4, onSuccess: mySuccess}); 
}

function mySuccess() {
    obj = document.getElementById('isSearchDone');
    if ( obj.value == 1) updater.stop();
}

function onSearch(cityId,productId,siteLinkPostfix) {
    obj = $("isSearchDone");
    if(obj) obj.value = 0;

    departureDay = $("departureDay").value;
    departureMonth = $("departureMonth").value;
    returnDay = $("returnDay").value;
    returnMonth = $("returnMonth").value;
    hotelTypeId = $("hotelTypeId").value;

    getTabData('/accommodation-in-'+siteLinkPostfix+'/checkAvailability/', 'cityId='+cityId+'&departureDay='+departureDay+'&departureMonth='+departureMonth+'&returnDay='+returnDay+'&returnMonth='+returnMonth+'&hotelTypeId='+hotelTypeId+'&productId='+productId);
}