

jQuery(document).ready(function () {

    // Slideshow
    jQuery(".slider").codaSlider({
        dynamicArrows: false,
        dynamicTabs: false,
        autoSlide: 1,
        crossLinking: 0,
        autoSlideInterval: 5000
    });

    $('h1').not('h1.small').each(function () {
        var h = $(this).html();
        var span = h.indexOf('<span>');
        if (span == -1) {
            var index = h.indexOf(' ');
            if (index == -1) {
                index = h.length;
            }
            $(this).html('<span>' + h.substring(0, index) + '</span>' + h.substring(index, h.length));
        }
    });

//    $('.box-title').each(function () {
//        var h = $(this).html();
//        var span = h.indexOf('<span>');
//        if (span == -1) {
//            var index = h.indexOf(' ');
//            if (index == -1) {
//                index = h.length;
//            }
//            $(this).html('<span>' + h.substring(0, index) + '</span>' + h.substring(index, h.length));
//        }
//    });

    Tabs_Init();

});

function Tabs_Init() {
    jQuery('.tabs li').click(function () {
        jQuery('.tab-content').hide();

        var id = jQuery(this).attr('id');

        jQuery('#content-' + id).show();

        jQuery('.tabs li').removeClass('current');
        jQuery(this).addClass('current');

        var tabNo = id.substr(id.lastIndexOf('-') + 1);
        $('#ctl00_ContentPlaceHolder1_hfCurrentTab').val(tabNo);
    });
}


function SetRecipesMenusActiveTab(tabNo) {
    jQuery('.tab-content').hide();

    var id = 'tab-' + tabNo.toString();

    jQuery('#content-' + id).show();

    jQuery('.tabs li').removeClass('current');
    jQuery('#' + id).addClass('current');
};

function goToByScroll(id) {
    $('html,body').animate({ scrollTop: $("#" + id).offset().top }, 'slow');
}
