/* HIDE ACCORDION PANELS */
    $('.accordion_panel').hide();


    $(document).ready(function () {

        /***** CHECK TO SEE IF THE SHADE WAS PREVIOUSLY LIFTED ******/

        /***** SLIDESHOW SHOW/HIDE ******/
        $('.ss_tab').click(function () {
            if ($(this).hasClass('active')) {
                $('.ss_container').animate({
                    marginTop: '-610px'
                }, 'slow', 'swing', function () {
                    $('#ss_title').css('display', 'inline');
                    $('#ss_title').css('left', '22px');
                });
                $(this).animate({
                    marginTop: '-2px'
                }, 'slow', 'swing');
                $(this).removeClass('active');
                $('.ss_selector#left_selector').animate({
                    marginRight: '0px'
                }, 'slow', 'swing');
                $('.ss_selector#right_selector').animate({
                    marginLeft: '0px'
                }, 'slow', 'swing');
                if ($('.left_ss').hasClass('active')) {
                    $('.left_ss').animate({
                        width: '215px'
                    }, 'slow');
                    $('.right_ss').animate({
                        left: '225px'
                    }, 'slow');
                }
                $('#hp_promo').fadeIn();
                $('.right_ss .ss_overlay').animate({
                    left: '0px'
                }, 'slow', 'swing');
                $('.left_ss .ss_overlay').animate({
                    right: '0px'
                }, 'slow', 'swing');
                $('.ss_selector').removeClass('active');
                $('.left_ss').removeClass('active');
                $('.right_ss').removeClass('active');

                _gaq.push(['_trackEvent', 'Slideshow Panel', 'Interaction', 'Close Slideshow']);

                var apiLeft = $("#scroller_left").data("scrollable");
                var apiRight = $("#scroller_right").data("scrollable");

                if (apiLeft) {
                    apiLeft.stop();
                }
                if (apiRight) {
                    apiRight.stop();
                }


            } else {
                $('.ss_container').animate({
                    marginTop: '0px'
                }, 'slow', 'swing');
                $(this).animate({
                    marginTop: '606px'
                }, 'slow', 'swing');
                $('.ss_container').addClass('active');
                $(this).addClass('active');
                _gaq.push(['_trackEvent', 'Slideshow Panel', 'Interaction', 'Open Slideshow']);
            }
        })



        /***** SELECTOR TABS ******/

        $('.ss_selector#left_selector').click(function () {
            $(this).addClass("active");
            $('.left_ss .ss_controls .progress_controls').addClass('active');
            $(this).animate({
                marginRight: '-210px'
            }, 'slow', 'swing');
            $('.left_ss').animate({
                width: '782px'
            }, 'slow');
            $('.right_ss').animate({
                left: '789px'
            }, 'slow');
            $('#ss_title').animate({
                left: '599px'
            }, 'slow');
            $('#ss_title').fadeOut();
            $('#hp_promo').fadeOut();
            $('.left_ss .ss_overlay').animate({
                right: '-368px'
            }, 'slow', 'swing');
            $('.right_ss .ss_overlay').animate({
                left: '0px'
            }, 'slow', 'swing');
            $('.left_ss').addClass('active');
            $('.right_ss').removeClass('active');
            $('.ss_selector#right_selector').animate({
                marginLeft: '0px'
            }, 'slow', 'swing', function () {
                $('.right_ss .ss_controls .progress_controls').removeClass('active');
            });
            $('.ss_selector#right_selector').removeClass('active');

            var apiLeft = $("#scroller_left").data("scrollable");
            var apiRight = $("#scroller_right").data("scrollable");

            if (apiLeft) {
                apiLeft.play();
            }
            else {
                $("#scroller_left").scrollable({ circular: true, easing: 'swing', speed: 700 }); // .autoscroll({ autoplay: true, interval: 2500, autopause: false, reverse: true });
            }

            if (apiRight) {
                apiRight.pause();
            }

            _gaq.push(['_trackEvent', 'Slideshow Panel', 'Interaction', 'Go Behind the Scenes']);
        });
        $('.ss_selector#right_selector').click(function () {
            $(this).addClass("active");
            $('.right_ss .ss_controls .progress_controls').addClass('active');
            $(this).animate({
                marginLeft: '-210px'
            }, 'slow', 'swing');
            if ($('.left_ss').hasClass('active')) {
                $('.left_ss').animate({
                    width: '215px'
                }, 'slow');
                $('.right_ss').animate({
                    left: '225px'
                }, 'slow');
            }
            $('#ss_title').fadeOut();
            $('#hp_promo').fadeOut();
            $('.right_ss .ss_overlay').animate({
                left: '-256px'
            }, 'slow', 'swing');
            $('.left_ss .ss_overlay').animate({
                right: '0px'
            }, 'slow', 'swing');
            $('.right_ss').addClass('active');
            $('.left_ss').removeClass('active');
            $('.ss_selector#left_selector').animate({
                marginRight: '0px'
            }, 'slow', 'swing', function () {
                $('.left_ss .ss_controls .progress_controls').removeClass('active');
            });
            $('.ss_selector#left_selector').removeClass('active');


            var apiLeft = $("#scroller_left").data("scrollable");
            var apiRight = $("#scroller_right").data("scrollable");

            if (apiRight) {
                apiRight.play();
            }
            else {
                $("#scroller_right").scrollable({ circular: true, easing: 'swing', speed: 700 }); //.autoscroll({ autoplay: true, interval: 2500, autopause: false, reverse: false });
            }

            if (apiLeft) {
                apiLeft.pause();
            }

            _gaq.push(['_trackEvent', 'Slideshow Panel', 'Interaction', 'See the Big Show']);
        });


    }
);


    $(document).ready(function() {

        /***** RIGHT-SIDE NAV *******/

        $('h3.accordion_header').click(function() {
            //see if the panel is open already
            if ($(this).children('span.accordion_arrow').hasClass('active')) {
                $('.accordion_panel').slideUp("slow", "swing");
                $('span.accordion_arrow').removeClass('active');
                $(this).next().addClass('tab_spacing');
            } else {
                //close the current panel and open the panel new panel
                $('.accordion_panel').slideUp("slow", "swing");
                $('span.accordion_arrow').removeClass('active');
                $('h3.accordion_header').removeClass('nextTab');
                $(this).children('span.accordion_arrow').addClass('active');
                $(this).next('.accordion_panel').slideDown("normal", "swing");
                $(this).next().addClass('tab_spacing');
            }
        });

        /**** IN-FIELD LABELS ******/
        $('.form_elements p label').inFieldLabels({ fadeOpacity: 0.1 });
    });

/***** SEND GOOGLE CLICK TO NOTIFY OF EMAIL ADDRESS CLICK  *****/
$(document).ready(function() {
    $('a[href*="mailto"]').click(function(event) {
    _gaq.push(['_trackEvent', 'Contact Email Links', 'Click', window.location.href]);
    });
});


/***** SEND GOOGLE CLICK TO NOTIFY OF PDF CLICK  *****/
$(document).ready(function() {
    $('a[href*="pdf"]').click(function(event) {
    _gaq.push(['_trackEvent', 'PDF', 'Download', this.href]);
    });
});

/***** SEND GOOGLE CLICK TO NOTIFY OF PDF CLICK  *****/
$(document).ready(function() {
    $('a[mediatype*="pdf"]').click(function(event) {
        _gaq.push(['_trackEvent', 'PDF', 'Download', this.href]);
    });
});



