$(window).load (function() {
    $("div.right").removeClass('hide');
    $(".carousel_main").jCarouselLite({
        btnNext: ".main_next",
        btnPrev: ".main_prev",
        speed: 800,
        visible: 10
    });
    var CarouselfullSize = $(document).width() - 60;
    $("#centerize").css("width", CarouselfullSize + 'px');
    var CarouseldivSize = CarouselfullSize - 21*2;
    $(".carousel_main").css("width", CarouseldivSize + 'px');

    $("div.hf_widget").removeClass('hide');
    var WidgetsInLine = ($("#hot_offers").width() - 10) / 219;
    if ((WidgetsInLine < 6) && (WidgetsInLine > 4)) {
        WidgetsToHide = 6 - parseInt(WidgetsInLine);
        for (i = 1; i <= WidgetsToHide; i++) {
            widgetNum = 6 - i;
            $("div.hf_widget:eq("+widgetNum+")").addClass('hide');
        }
    }

    $('#excursions table tr.odd').click(function() {
        href = $(this).attr('href');
        if (href != '' && href != undefined) {window.location = href;}
        return false;
    });

    $('#directions_header').click(function() {
        if ($('.right').hasClass('hide')) {
            $('.content').slideDown(400);
            $('.right').removeClass('hide', 400);
        } else {
            $('.content').slideUp(400);
            $('.right').addClass('hide', 400);
        }
        position_footer();
        return false;
    });

    $('.header').click(function() {
        $(this).next('.content').slideToggle(400);
        $(this).find('.right').toggleClass('hide', 400);
        position_footer();
        return false;
    });
    
    $("#myspoiler").hide();
    position_footer();
});
$(window).resize (function() {
    var CarouselfullSize = $(document).width() - 60;
    $("#centerize").css("width", CarouselfullSize + 'px');
    var CarouseldivSize = CarouselfullSize - 21*2;
    $(".carousel_main").css("width", CarouseldivSize + 'px');

    $("div.hf_widget").removeClass('hide');
    var WidgetsInLine = ($("#hot_offers").width() - 10) / 219;
    if ((WidgetsInLine < 6) && (WidgetsInLine > 4)) {
        WidgetsToHide = 6 - parseInt(WidgetsInLine);
        for (i = 1; i <= WidgetsToHide; i++) {
            widgetNum = 6 - i;
            $("div.hf_widget:eq("+widgetNum+")").addClass('hide');
        }
    }

    position_footer();
});

function count_click(id, url) {
    if (id != '') {
        $.get("/count_click.php", { id: id});
    }
    location.href=url;
    return true;
}
