//jquery full background slider
jQuery(function($) {
    var open = false;

    $('#footerSlideButton').click(function () {
        if(open === false) {
            $('#footerSlideContent').animate({
                height: '300px'
            });

            $(this).css('backgroundPosition', 'bottom left');
            $('#footerSlideText').css('display', 'block');
            open = true;
        } else {
            $('#footerSlideContent').animate({
                height: '0px'
            });
            $(this).css('backgroundPosition', 'top left');
            open = false;

            $('#footerSlideText').css('display', 'none');

        }
    });
});




function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
    : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order

    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({
        opacity: 0.0
    })
    .addClass('active')
    .animate({
        opacity: 1.0
    }, 1000, function() {
        $active.removeClass('active last-active');
    });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
}); // !end full background slider


// concerts accordion slider

jQuery.fn.initMenu = function() {
    return this.each(function(){
        var theMenu = $(this).get(0);
        $('.acitem', this).hide();
        $('li.expand > .acitem', this).show();
        $('li.expand > .acitem', this).prev().addClass('active');
        $('li a', this).click(
            function(e) {
                e.stopImmediatePropagation();
                var theElement = $(this).next();
                var parent = this.parentNode.parentNode;
                if($(parent).hasClass('noaccordion')) {
                    if(theElement[0] === undefined) {
                        window.location.href = this.href;
                    }
                    $(theElement).slideToggle('normal', function() {
                        if ($(this).is(':visible')) {
                            $(this).prev().addClass('active');
                        }
                        else {
                            $(this).prev().removeClass('active');
                        }
                    });
                    return false;
                }
                else {
                    if(theElement.hasClass('acitem') && theElement.is(':visible'))
                    {
                        if($(parent).hasClass('collapsible')) {
                            $('.acitem:visible', parent).first().slideUp('normal',
                                function() {
                                    $(this).prev().removeClass('active');
                                }
                                );
                            return false;
                        }
                        return false;
                    }
                    if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
                        $('.acitem:visible', parent).first().slideUp('normal', function() {
                            $(this).prev().removeClass('active');
                        });
                        theElement.slideDown('normal', function() {
                            $(this).prev().addClass('active');
                        });
                        return false;
                    }
                }
            }
            );
    });
};


$(document).ready(function() {
    //$('.slide').initMenu();
}); // ! end concerts accordion slider


// function for toggle slide show

$(document).ready(function(){

    //$('#panel').show();
    $('a[rel*=toggle]').click(function(){
        $("#panel").slideToggle('normal')

        $(this).css("height", $(this).height() + "px");
        $(this).toggleClass("active");
        return false;
    });


}); // end function

// jquery for form field on contact
$(document).ready(function() {
    var max = 0;
    $('label').each(function(){
        if ($(this).width() > max)
            max = $(this).width();
    });
    $('label').width(max);
}); // end function

// append scrollbar to all DOM nodes with class="css-scrollbar"
$(function(){
    $('.css-scrollbar').scrollbar();
   // $('.fff').scrollbar();
})

// hide concerts content

$(document).ready(function(){

    $("'a[rel*=close]'").click(function(){
        $(this).parents(".left").animate({
            opacity: 'hide'
        }, "slow");
    });

});
