﻿function moveArrow(where, who, motore) {
    $('.middle-inside', '.middle-gradient').css('display', 'none');
    $('#' + motore).css('display', '');
    $('li', '#menu-sezioni').each(function (i) {
        $(this).attr('id', $(this).attr('id').replace(/Sel/g, ''));
    });
    $('#' + who).attr('id', who + 'Sel');
}

function showMotoreMini(who, motore) {
    $('.middle-inside', '#motore-laterale').css('display', 'none');
    $('#' + motore).css('display', '');
    $('li', '#menu-motore-laterale').each(function (i) {
        $(this).attr('id', $(this).attr('id').replace(/Sel/g, ''));
    });
    $('#' + who).attr('id', who + 'Sel');
}

function selTab(counter, whichTab) {
    if (document.getElementById(whichTab)) {
        var toSel = document.getElementById(whichTab);
        //alert(toSel.style.backgroundPosition);
        toSel.className = 'sel';
        toSel.style.backgroundPosition = '0 0';

        var toShow = document.getElementById(whichTab + 'Content');
        toShow.style.display = '';
    }
    if (whichTab.indexOf('Top') > -1) {
        toSel.className = 'HdrTop sel';
        unSelTabTop(counter, whichTab);
    }
    else {
        unSelTab(counter, whichTab);
    }
}

function unSelTab(counter, whichTab) {
    for (i = 1; i <= counter; i++) {
        if (document.getElementById('tab' + i)) {
            var getIDTab = document.getElementById('tab' + i);
            var getIDTabToShow = document.getElementById('tab' + i + 'Content');

            if (getIDTab.id != whichTab) {
                getIDTab.className = 'unsel';
                getIDTab.style.backgroundPosition = '0 -29px';
            }
            if (getIDTabToShow.id != (whichTab + 'Content')) {
                getIDTabToShow.style.display = 'none';
            }
        }
    }
}

function unSelTabTop(counter, whichTab) {
    for (i = 1; i <= counter; i++) {
        if (document.getElementById('tab' + i + 'Top')) {
            var getIDTab = document.getElementById('tab' + i + 'Top');
            var getIDTabToShow = document.getElementById('tab' + i + 'TopContent');

            if (getIDTab.id != whichTab) {
                getIDTab.className = 'HdrTop unsel';
                getIDTab.style.backgroundPosition = '0 -29px';
            }
            if (getIDTabToShow.id != (whichTab + 'Content')) {
                getIDTabToShow.style.display = 'none';
            }
        }
    }
}

function SetupRoundTrip(inputDate) {
    var getDateReturn = document.getElementById(inputDate);
    getDateReturn.style.display = '';
}

function SetupOneWay(inputDate) {
    var getDateReturn = document.getElementById(inputDate);
    getDateReturn.style.display = 'none';
}

$('.include-search').live('click', function () {
    if ($(this).prev().hasClass('jqTransformChecked')) {
        $(this).val('no');
    }
    else {
        $(this).val('yes');
    }
});

$(function () {
    $('#VacanzeLat-Destination').click(function () { $(this).val(''); });
    $('#VoliLat-DepartCity').click(function () { $(this).val(''); });
    $('#VoliLat-ArrivalCity').click(function () { $(this).val(''); });
    $('#HotelLat-destination').click(function () { $(this).val(''); });
    $('#VoliHotelLat-DepartCity').click(function () { $(this).val(''); });
    $('#VoliHotelLat-ArrivalCity').click(function () { $(this).val(''); });
    $('#OstelliLat-destination').click(function () { $(this).val(''); });
    $('#Lat-PickUpLocation').click(function () { $(this).val(''); });
});

$(function () {
    $('#Leonardo_Navigation-Logo').html('<a title="Visita Leonardo.it" href="http://www.leonardo.it" target="_blank"><span>Leonardo.it</span></a>').css('background-image', 'url("http://www.europelowcost.com/images/LeonardoLogoGrey.png")');
});

$(function () {
    $('#PanelDebug').draggable();
    $('.ui-blue-icon').click(function () { $('#hp_more_parameters').click(); });
    $('#hp_more_parameters').click(function () {
        $('.ui-blue-icon').toggleClass('ui-icon-minusthick');
        $('.more-parameters').toggle();
        return false;
    });
});
$(function () {
    for (var i = 0; i < 5; i++) {
        var date = new Date();
        var month = i + date.getMonth();
        var year = date.getFullYear();
        if (month >= 12) {
            month -= 12;
            year++;
        }
        date.setMonth(month);
        date.setFullYear(year);
        var value = (month < 10 ? '0' : '') + month + '/' + year;
        var text = $.datepicker.formatDate('MM yy', date);
        $('#ddl_months').append('<option value="' + value + '">' + text + '</option>');
    }
    $('#rbtn_months').click(function () {
        $('.months').css('display', '');
        $('.days').css('display', 'none');
    });
    $('#rbtn_days').click(function () {
        $('.months').css('display', 'none');
        $('.days').css('display', '');
    });
    $('#ddl_months').change(function () {
        if ($(this).val() != "") {
            $('.weekends').show();
        }
        else {
            $('.weekends').hide();
            $('#chk_weekend').removeAttr('checked');
            $('.weekend-dates').hide();
        }
    });
    $('#chk_weekend').click(function () {
        if ($(this).is(':checked')) {
            $('.weekend-dates').show();
        }
        else {
            $('.weekend-dates').hide();
        }
    });
});
