$(document).ready(function() {

    function scrollToTabContent(tabSelector)
    {
        $(document.body).animate({
            scrollTop: $(tabSelector).offset().top - 220
        }, 1000);
    }

    function activateTravelDatesTab()
    {
        $('[href=\'#travel-dates-content-tab\']').tab('show');
        scrollToTabContent('#travel-dates-content-tab');
    }

    $('.nav-tabs > li > a').click(function() {
        scrollToTabContent($(this).attr('href'));
    });

    $('.st-slider-booking-btn').click(activateTravelDatesTab);

    if (location.hash === '#travel-dates-content-tab')
    {
        activateTravelDatesTab();
    }

});