function win(page,wid,hit)
{
    var  windo=eval('window.open("'+page+'","_blank","status=no,toolbar=no,resizable=yes,scrollbars=yes,menubar=no,width='+wid+',height='+hit+',top=100,left=100")');
    
//    window.showModalDialog(page,"","center:yes;resizable:yes;status:no;dialogWidth:"+wid+"px;dialogHight:"+hit+"px");
    return windo;
}
function onParentLoader()
{
    document.Search.submit();
}
var holidayDays = [];

function setScheduledDays(date) {
    var isHoliday = false;
    // Check for holidays
    if (holidayDays != null)
    {
        for (i = 0; i < holidayDays.length; i++) {
          if (date.getMonth() == holidayDays[i][0] - 1 && date.getDate() == holidayDays[i][1] && date.getFullYear() == holidayDays[i][2])
          {
            isHoliday = true;
          }
        }
    }   
    
    if (isHoliday) return [false, 'CLOSED'];
    else return [true, ''];

}

var holidayDays_2 = [];

function setScheduledDays_2(date) {
    var isHoliday = false;
    // Check for holidays
    if (holidayDays_2 != null)
    {
        for (i = 0; i < holidayDays_2.length; i++) {
          if (date.getMonth() == holidayDays_2[i][0] - 1 && date.getDate() == holidayDays_2[i][1] && date.getFullYear() == holidayDays_2[i][2])
          {
            isHoliday = true;
          }
        }
    }   
    
    if (isHoliday) return [false, 'CLOSED'];
    else return [true, ''];

}

var inp = '';
function changeCalendar(url,no_flights,dont_set_date)
{
    
	url = url+'/lb_country:'+jQuery('#lb_country').val()+'/journey_airport:'+jQuery('#journey_airport').val()+'/'+'journey_type:'+jQuery('#journey_type').val()
	
	if($("#transport_type").length > 0){
		url = url+'/transport_id:'+$("#transport_type").val();
	}
	
    $.getJSON(url,function(data){
        if(data == 0)
        { 
            alert(no_flights);
        }
        else
        {
            eval(holidayDays = data['dates']);
            if(holidayDays_2.length == 0) eval(holidayDays_2 = data['dates']);
            
            var set_date = new Date(data['first'][2],data['first'][0],data['first'][1]);
            
            $("#lb_journey_start_date_replace").val(data['first'][2]+'-'+data['first'][0]+'-'+data['first'][1]);
            
            var set_date = $.datepicker._defaults.dateFormat.replace("yy", data['first'][2]);
            set_date = set_date.replace("mm", data['first'][0]);
            set_date = set_date.replace("dd", data['first'][1]);

            if(!dont_set_date){ 
            	$("#lb_journey_start_date").val(set_date);
            	
            }
        }
    });
}
jQuery(document).ready(function() {
	
    if(jQuery('#lb_journey_start_date').length)
    {
        //changeCalendar(false);
        //jQuery('#lb_country').change(function(){changeCalendar(true)});
        //jQuery('#journey_airport').change(function(){changeCalendar(true)});
        startDate = new Date();
        endDate = new Date(startDate.getFullYear()+'/'+(startDate.getMonth()+10)+'/'+startDate.getDate());
        
        inp = jQuery("#lb_journey_start_date");

        inp.datepicker({   
            showOn: "both",
            buttonImageOnly: false,
            numberOfMonths: 1,
            showButtonPanel: false,
            minDate: startDate,
            showAnim: 'slideDown',
            showOptions: { speed: 50 },
            beforeShowDay: setScheduledDays,
            onSelect: function(date,inst){
                                return;
            }
        });

        jQuery('button.ui-datepicker-trigger').hide();
    }
    if(jQuery('#lb_journey_start_date_2').length)
    {
        //changeCalendar(false);
        //jQuery('#lb_country').change(function(){changeCalendar(true)});
        //jQuery('#journey_airport').change(function(){changeCalendar(true)});
        startDate = new Date();
        endDate = new Date(startDate.getFullYear()+'/'+(startDate.getMonth()+10)+'/'+startDate.getDate());
        
        inp = jQuery("#lb_journey_start_date_2");

        inp.datepicker({   
            showOn: "both",
            buttonImageOnly: false,
            numberOfMonths: 1,
            showButtonPanel: false,
            minDate: startDate,
            showAnim: 'slideDown',
            showOptions: { speed: 50 },
            beforeShowDay: setScheduledDays_2,
            onSelect: function(date,inst){
            					return;
            }
        });

        jQuery('button.ui-datepicker-trigger').hide();
    }

    activate_default_text();
    
    if(jQuery('#smfrm1').length == 1)
    {
        activatePaymentsObjects();
        lockSubmitButton(jQuery('#smfrm1'));
        
        jQuery('input.getDocuments').change(function(){
            if(jQuery('input.getDocuments:checked').val() == 2)
                jQuery('#affialiates').show();
            else
                jQuery('#affialiates').hide();
        });
        jQuery('input.getDocuments').change();
    }

    if(jQuery('#lb_country').length == 1)
    {
      //airportChecker('on');
    }
    
    load_tips();
   
});

function load_tips(){
	 jQuery('img[alt!=],img[title!=],td[alt!=],th[alt!=],span[alt!=],label[alt!=],a[alt!=],p[alt!=]').each(function(){
	        jQuery(this).bind('mouseover', function(){
	            showTooltip(this);
	        }).bind('mouseout', function(){
	            hideTooltip(this);
	        });
	 });
}

function activate_default_text()
{
    jQuery('input[default=true]').each(function(){
        jQuery(this).bind('focus', function(){
            if(jQuery(this).val() == jQuery(this).attr('default_text')){
                jQuery(this).val('');
            }
        });
        jQuery(this).bind('blur', function(){
            if(jQuery(this).val() == ''){
                jQuery(this).val(jQuery(this).attr('default_text'));
            }
        });
        if(jQuery(this).val() == ''){
            jQuery(this).val(jQuery(this).attr('default_text'));
        }
    });
}

function loaderActivity()
{
    jQuery('#main-loader').show();
    jQuery('#container').hide();

}

function journeyroomchanger(val){
    
    val = val.split('0');
    $('#showoffers').show();

/*    if(val[1]){
        
        var childs = val[1];
        
        if(childs == 1){
            $('#child_age').show();
            $('#child_age2').hide();
            $('#FilterChildage1').show();
            $('#FilterChildage2').val('').hide();
            $('#FilterChildage3').val('').hide();
        }
        else if(childs == 2){
            $('#child_age').show();
            $('#child_age2').show();
            $('#FilterChildage1').show();
            $('#FilterChildage2').show();
            $('#FilterChildage3').val('').hide();
        }
        else if(childs == 3){
            $('#child_age').show();
            $('#FilterChildage1').show();
            $('#FilterChildage2').show();
            $('#FilterChildage3').show();
        }
    }
    else
    {
        $('#child_age').hide();
        $('#child_age2').hide();
        $('#FilterChildage1').val('').hide();
        $('#FilterChildage2').val('').hide();
        $('#FilterChildage3').val('').hide();
    }*/
}

function activatePaymentsObjects()
{
	
    jQuery('input.payments').each(function(){
        jQuery(this).click(function(){
            jQuery('.payments:not(input)').each(function(){
                jQuery(this).hide();
                pays = jQuery(this).attr('payment').split(',');
                for(i=0;i<pays.length; i++)
                {
                    if(pays[i] == jQuery('input.payments:checked').val())
                    {
                        jQuery(this).show();
                        if(jQuery(this).attr('function'))
                        {
                            eval(jQuery(this).attr('function'));
                        }
                    }
                }
            });
        });
    });
    jQuery('input.payments:checked').click();
    jQuery('input.payments:checked').click();
}

function lockSubmitButton(ob)
{
    ob.submit(function(){
        if(!jQuery('input#checkBox:checked').length && jQuery('input#checkBox').length){ 
            if(jQuery('input.payments:checked').val() == 4 || jQuery('input.payments:checked').val() == 5)
            {
                alert(jQuery('input#checkBox').attr('error_transfer'));
            }
            else
            {
                alert(jQuery('input#checkBox').attr('error_bank'));
            }
            jQuery('div.submit-1').css('color','red');
            return false;
        }
        else if(jQuery('input.close_form:checked').length != jQuery('input.close_form').length)
        {
            if(jQuery('input.payments:checked').val() == 4 || jQuery('input.payments:checked').val() == 5)
            {
                alert(jQuery('input.close_form').attr('error_transfer'));
            }
            else
            {
                alert(jQuery('input.close_form').attr('error_bank'));
            }
            
            jQuery('input.close_form').parent('div').css('color','red');
            return false;
        }
        else
        {
            jQuery('#submit_button').hide();
            jQuery('#submit_loader').show();
        }
    });
}

function airportChecker(action)
{
    if(action == 'on')
    {
     jQuery('#lb_country').change(function(){
        if(jQuery(this).val() == '66-21')
        {
            jQuery('#journey_airport').val('143');
            jQuery('#journey_airport option').each(function(){

                if(jQuery(this).val() != '143')
                {
                    jQuery(this).attr('disabled','1');
                }
            });
        }
        else if(jQuery(this).val() == '8-37')
        {
            jQuery('#journey_airport').val('143');
            jQuery('#journey_airport option').each(function(){

                if(jQuery(this).val() != '143' || jQuery(this).val() != '105')
                {
                    jQuery(this).attr('disabled','1');
                }
            });
        }
        else if(jQuery(this).val() == '66-19')
        {
            jQuery('#journey_airport').val('143');
            jQuery('#journey_airport option').each(function(){

                if(jQuery(this).val() != '143')
                {
                    jQuery(this).attr('disabled','1');
                }
            });
        }
        else if(jQuery(this).val() == '150-111')
        {
            jQuery('#journey_airport').val('143');
            jQuery('#journey_airport option').each(function(){
                
                if(jQuery(this).val() != '143')
                {
                    jQuery(this).attr('disabled','1');
                }
            });
        }
        else if(jQuery(this).val() == '66-18')
        {
            jQuery('#journey_airport').val('143');
            jQuery('#journey_airport option').each(function(){
                
                if(jQuery(this).val() != '143')
                {
                    jQuery(this).attr('disabled','1');
                }
            });
        }
        else
        {
            jQuery('#journey_airport option[disabled=1]').each(function(){ jQuery(this).removeAttr('disabled'); });
        }
     });
    jQuery('#lb_country').change();
    }
}


function showTooltip(element) {
    if (!window._tooltip) {
        window._tooltip = jQuery('<div id="tooltip"></div>');
        jQuery(document.body).append(window._tooltip);
    };
    var $el = jQuery(element);
    window._tooltip.html('').removeClass('pad');
    
    if($el.attr('alt')) var body = $el.attr('alt');
    else if($el.attr('title')) var body = $el.attr('title');

    if (body!='') {
        window._tooltip.addClass('pad').append(body);

    };
    jQuery(document).bind('mousemove', moveTooltip);
}

function moveTooltip(e) {
    if (window._tooltip != undefined) { 
        lf = (e.clientX + document.body.scrollLeft - window._tooltip[0].offsetWidth - 5);
        tp = (e.clientY + document.body.scrollTop + 25);
        if(lf < 5) lf = 5;
        if(lf > (jQuery(window).width()-window._tooltip[0].offsetWidth)) lf = jQuery(window).width()-window._tooltip[0].offsetWidth;
        if(jQuery(window).width()<window._tooltip[0].offsetWidth)window._tooltip[0].offsetWidth = jQuery(window).width();
        window._tooltip.css({
            left: lf + 'px',
            top: tp + 'px',
            display: "block"
        });
    }
}

function hideTooltip(e) {  
    if (window._tooltip != undefined) {
        jQuery(document).unbind('mousemove', moveTooltip);
        window._tooltip.hide();
    }
}

function goToOrder(ob,url_to, url, error_message, parentWin)
{
    jQuery(ob).hide();
    jQuery(ob).parents('td:first').append('<img src="/cake/img/ajax-loader.gif" style="margin-left:15px"> <font size="1" style="">kraunasi</font>');
    $.get(url_to, function(returned_data){
        if(returned_data != '0')
        {
            if(parentWin)
                window.parent.location.href=url.replace('replace',returned_data);
            else
                window.location.href=url.replace('replace',returned_data);
        }
        else
        {
            jQuery(ob).parents('tr:first').hide();
            alert(error_message);
        }
    });
}

getFormValues = function(form) {
     var str = "";
     var nL = form.elements.length;
     for (var i = 0; i < nL; i++) {
        if(form.elements[i].name)
        {
          if ((form.elements[i].type == 'radio') || (form.elements[i].type == 'checkbox')) {
               if (form.elements[i].checked) {
                    str += form.elements[i].name + "=" + escape(form.elements[i].value) + "&";
               }
          } else {
               str += form.elements[i].name + "=" + escape(form.elements[i].value) + "&";
          }
        }
     }
     return str;
}

function demoRedirectSubmit(tourl, form)
{
    str = getFormValues(form);
    $.ajax({
        type: "GET",
        url: tourl,
        data: str,
        success: function(locat){
             eval(window.parent.location = locat);
        }
    });

}

function changecountry(id,url,text,selected){

    $('#city').attr("disabled", true);
    $("#city").html('<option value="0">'+text+'</option>'); 
    $("#city").ajaxAddOption(url+"/"+id,{},false,

                    function(){
                        
                        if(selected){
                            $("#city").selectOptions(selected);
                        }
                        
                        $("#city").removeOption(0); 
                        $('#city').attr("disabled", false);
                    }
    );
}
function changeairport(id,url,text,url2,no_flights){
    
    $('#journey_airport').attr("disabled", true);
    $("#journey_airport").html('<option value="0">'+text+'</option>'); 
    $("#journey_airport").ajaxAddOption(url+"/"+id,{},false,
            
        function(){
            
            $("#journey_airport").removeOption(0); 
            $('#journey_airport').attr("disabled", false);
            changeCalendar(url2,no_flights);
        }
    );
}

function changeduration(id,url,text,selected){

    $('#lb_duration').attr("disabled", true);
    $("#lb_duration").html('<option value="0">'+text+'</option>'); 
    $("#lb_duration").ajaxAddOption(url+"/"+id,{},false,

                    function(){
                        
                        if(selected){
                            $("#lb_duration").selectOptions(selected);
                        }
                        
                        $("#lb_duration").removeOption(0); 
                        $('#lb_duration').attr("disabled", false);
                    }
    );
}

function addToTreamBlock(url, ID)
{
    $.ajax({
        url: url,
        data: '',
        success: function(text){
            jQuery('#tream_block_empty').hide('fast');
            jQuery('#tream_block').html(text);
            updateIframeHeight(1);
        }
    });
}

function strtotime(str, now) {
    // Convert string representation of date and time to a timestamp  
    // 
    // version: 905.3122
    // discuss at: http://phpjs.org/functions/strtotime
    // +   original by: Caio Ariede (http://caioariede.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: David
    // +   improved by: Caio Ariede (http://caioariede.com)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Wagner B. Soares
    // %        note 1: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
    // *     example 1: strtotime('+1 day', 1129633200);
    // *     returns 1: 1129719600
    // *     example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200);
    // *     returns 2: 1130425202
    // *     example 3: strtotime('last month', 1129633200);
    // *     returns 3: 1127041200
    // *     example 4: strtotime('2009-05-04 08:30:00');
    // *     returns 4: 1241418600
    var i, match, s, strTmp = '', parse = '';

    strTmp = str;
    strTmp = strTmp.replace(/\s{2,}|^\s|\s$/g, ' '); // unecessary spaces
    strTmp = strTmp.replace(/[\t\r\n]/g, ''); // unecessary chars

    if (strTmp == 'now') {
        return (new Date()).getTime()/1000; // Return seconds, not milli-seconds
    } else if (!isNaN(parse = Date.parse(strTmp))) {
        return (parse/1000);
    } else if (now) {
        now = new Date(now*1000); // Accept PHP-style seconds
    } else {
        now = new Date();
    }

    strTmp = strTmp.toLowerCase();

    var __is =
    {
        day:
        {
            'sun': 0,
            'mon': 1,
            'tue': 2,
            'wed': 3,
            'thu': 4,
            'fri': 5,
            'sat': 6
        },
        mon:
        {
            'jan': 0,
            'feb': 1,
            'mar': 2,
            'apr': 3,
            'may': 4,
            'jun': 5,
            'jul': 6,
            'aug': 7,
            'sep': 8,
            'oct': 9,
            'nov': 10,
            'dec': 11
        }
    };

    var process = function (m) {
        var ago = (m[2] && m[2] == 'ago');
        var num = (num = m[0] == 'last' ? -1 : 1) * (ago ? -1 : 1);

        switch (m[0]) {
            case 'last':
            case 'next':
                switch (m[1].substring(0, 3)) {
                    case 'yea':
                        now.setFullYear(now.getFullYear() + num);
                        break;
                    case 'mon':
                        now.setMonth(now.getMonth() + num);
                        break;
                    case 'wee':
                        now.setDate(now.getDate() + (num * 7));
                        break;
                    case 'day':
                        now.setDate(now.getDate() + num);
                        break;
                    case 'hou':
                        now.setHours(now.getHours() + num);
                        break;
                    case 'min':
                        now.setMinutes(now.getMinutes() + num);
                        break;
                    case 'sec':
                        now.setSeconds(now.getSeconds() + num);
                        break;
                    default:
                        var day;
                        if (typeof (day = __is.day[m[1].substring(0, 3)]) != 'undefined') {
                            var diff = day - now.getDay();
                            if (diff == 0) {
                                diff = 7 * num;
                            } else if (diff > 0) {
                                if (m[0] == 'last') {diff -= 7;}
                            } else {
                                if (m[0] == 'next') {diff += 7;}
                            }
                            now.setDate(now.getDate() + diff);
                        }
                }
                break;

            default:
                if (/\d+/.test(m[0])) {
                    num *= parseInt(m[0], 10);

                    switch (m[1].substring(0, 3)) {
                        case 'yea':
                            now.setFullYear(now.getFullYear() + num);
                            break;
                        case 'mon':
                            now.setMonth(now.getMonth() + num);
                            break;
                        case 'wee':
                            now.setDate(now.getDate() + (num * 7));
                            break;
                        case 'day':
                            now.setDate(now.getDate() + num);
                            break;
                        case 'hou':
                            now.setHours(now.getHours() + num);
                            break;
                        case 'min':
                            now.setMinutes(now.getMinutes() + num);
                            break;
                        case 'sec':
                            now.setSeconds(now.getSeconds() + num);
                            break;
                    }
                } else {
                    return false;
                }
                break;
        }
        return true;
    };

    match = strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);
    if (match != null) {
        if (!match[2]) {
            match[2] = '00:00:00';
        } else if (!match[3]) {
            match[2] += ':00';
        }

        s = match[1].split(/-/g);

        for (i in __is.mon) {
            if (__is.mon[i] == s[1] - 1) {
                s[1] = i;
            }
        }
        s[0] = parseInt(s[0], 10);

        s[0] = (s[0] >= 0 && s[0] <= 69) ? '20'+(s[0] < 10 ? '0'+s[0] : s[0]+'') : (s[0] >= 70 && s[0] <= 99) ? '19'+s[0] : s[0]+'';
        return parseInt(this.strtotime(s[2] + ' ' + s[1] + ' ' + s[0] + ' ' + match[2])+(match[4] ? match[4]/1000 : ''), 10);
    }

    var regex = '([+-]?\\d+\\s'+
        '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?'+
        '|sun\.?|sunday|mon\.?|monday|tue\.?|tuesday|wed\.?|wednesday'+
        '|thu\.?|thursday|fri\.?|friday|sat\.?|saturday)'+
        '|(last|next)\\s'+
        '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?'+
        '|sun\.?|sunday|mon\.?|monday|tue\.?|tuesday|wed\.?|wednesday'+
        '|thu\.?|thursday|fri\.?|friday|sat\.?|saturday))'+
        '(\\sago)?';

    match = strTmp.match(new RegExp(regex, 'g'));
    if (match == null) {
        return false;
    }

    for (i in match) {
        if (!process(match[i].split(' '))) {
            return false;
        }
    }

    return (now.getTime()/1000);
}

result = '';
function getValues(frm)
{
    result = '';
    jQuery('#'+frm+' input[type=text],#'+frm+' input[type=hidden],#'+frm+' select').each(function(){
        result += '/'+jQuery(this).attr('id')+':'+jQuery(this).val(); 
    });
    jQuery('#'+frm+' input[type=checkbox]:checked').each(function(){
        result += '/'+jQuery(this).attr('id')+':'+jQuery(this).val(); 
    });
    jQuery('#'+frm+' input[type=radio]').each(function(){
        if(jQuery(this).val() == jQuery('input[name='+jQuery(this).attr('name')+']').val()) result += '/'+jQuery(this).attr('id')+':'+jQuery(this).val(); 
    });
    return result;
}

function postValues(frm)
{
    result = '';
    jQuery('#'+frm+' input[type=text],#'+frm+' input[type=hidden],#'+frm+' select').each(function(){
        if(jQuery(this).attr('id') != '')
        {
            if(result != '') result += ',';
            result += '"'+jQuery(this).attr('name')+'": "'+jQuery(this).val()+'"';
        }
    });
    jQuery('#'+frm+' input[type=checkbox]:checked').each(function(){
        if(jQuery(this).attr('id') != '')
        {
            if(result != '') result += ',';
            result += '"'+jQuery(this).attr('name')+'": "'+jQuery(this).val()+'"';
        }
    });
    jQuery('#'+frm+' input[type=radio]').each(function(){
        if(jQuery(this).val() == jQuery('input[name='+jQuery(this).attr('name')+']').val())
        {
            if(result != '') result += ',';
            result += '"'+jQuery(this).attr('name')+'": "'+jQuery(this).val()+'"';
        }
    });
    return result;
}


// Ergo draudimas

function beginErgo()
{
    if(document.getElementById('Ergo_draudimas_checkbox').checked && !jQuery('#Ergo_draudimas_checkbox').attr('disabled'))
    {
        if(!jQuery('#OrdersTravelersTravelPayerName').val()) jQuery('#OrdersTravelersTravelPayerName').val(jQuery('#OrdersTravelersNAME1').val());
        if(!jQuery('#OrdersTravelersTravelPayerSurname').val()) jQuery('#OrdersTravelersTravelPayerSurname').val(jQuery('#OrdersTravelersSURNAME1').val());
        if(!jQuery('#OrdersTravelersTravelPayerIDENTITYCODE').val()) jQuery('#OrdersTravelersTravelPayerIDENTITYCODE').val(jQuery('#OrdersTravelersIDENTITYCODE1').val());
        
        jQuery('#Ergo_draudimas_form').show();
    }
    else
    {
        jQuery('#Ergo_draudimas_form,#Ergo_draudimas_content').hide();
    }
}

function calculateErgo_result(data, clean)
{
    if(clean) jQuery('.form-error').removeClass('form-error');
    if(!data.error)
    {
        if(data.content) jQuery("#Ergo_draudimas").html(data.content);
    }
    else
    {
        alert(data.error);
    }
    eval(data.eval);
}

// PZU draudimas
function checkFormForEmpty(ob_id)
{
    result = true;
    jQuery(ob_id+' input[type=text]').each(function(){
        if(jQuery(this).val() == '') result = false;
    });
    
    return result;
}

function pageToTop()
{
    try {
        fSrc = document.getElementById('hiddenIframe').src.split('?');
        document.getElementById('hiddenIframe').src = fSrc[0] + '?action=top';
    } catch(e){};
}

function addToBag(ob, url, this_url, alert_error)
{
    if(ob.checked)
    {
        url = url.replace(/replace/, 'add');
        bag = jQuery('#my_travels_div a').text();
        c = bag.split('(');
        c2 = c[1].split(')');
        count = c2[0]-(-1);
        if(count == 21)
        {
            alert(alert_error);
            return true;
        }
        jQuery('#my_travels_div a').text(c[0]+"("+count+")");
        jQuery('#my_travels_div').show();
        jQuery('#my_travels_div_empty').hide();
    }
    else
    {
        url = url.replace(/replace/, 'delete');
        bag = jQuery('#my_travels_div a').text();
        c = bag.split('(');
        c2 = c[1].split(')');
        count = c2[0]-1;
        jQuery('#my_travels_div a').text(c[0]+"("+count+")");
        if(count == 0)
        {
            jQuery('#my_travels_div').hide();
            jQuery('#my_travels_div_empty').show();
        }
    }
    jQuery.getJSON(url,{'this_url': this_url}, function(res){
        if(res.eval){
            eval(res.eval);
        }
    });
}

function deleteFromBag(id, url)
{
    tr = jQuery('#'+id);
    hotel = jQuery('#'+id).parents('div.offers');
    table = jQuery('#'+id).parents('table.table-6');
//    hotel.hide('slow',function(){jQuery(this).remove();});
    c = jQuery(table).attr('id').split('_');
    count = c[1];
    count--;
    all_count = jQuery('tr.prices').length-1;

    if(count == 0)
    {
        hotel.fadeTo('medium',0,function(){jQuery(this).remove();});
    }
    else
    {
        tr.fadeTo('fast',0,function(){jQuery(this).remove();});
        jQuery(table).attr('id','prices_'+count)
    }
    jQuery('ul.block-list.list-5 li:first span').text(all_count);
    jQuery.getJSON(url, function(res){});

}
function main_loader(){
	$('div.filter-right-side').hide();
	$('div#loader').show();
}