// Copyright 2003-2009 Emergent Music LLC  All rights reserved.

FLYFI.onClick_slideShow = function(event) {
    if (event) { event.preventDefault(); }
    window.location = '/help/#whyflyfi_0';
};

FLYFI.onClick_slides = function(event) {
    if (event) { event.preventDefault(); }
    $('#slideshow .kitten').hide();
    $('#slideshow_controls').show();
    $('#slideshow .slides').show();
    if (FLYFI.slideShowCarousel) {
        FLYFI.slideShowCarousel.startAuto(); // don't let it recompute widths when not showing
    }
};

FLYFI.onClick_kitten = function(event) {
    if (event) { event.preventDefault(); }
    if (FLYFI.slideShowCarousel) {
        FLYFI.slideShowCarousel.stopAuto(); // don't let it recompute widths when not showing
    }
    $('#slideshow .slides').hide();
    $('#slideshow_controls').hide();    
    $('#slideshow .kitten').show();
};

FLYFI.start_basePage = function(event) {
    if (FLYFI.isPostStart()) {
        $(window).trigger(FLYFI.MSG_PostStart);
    }
    if (FLYFI.isCoolStart()) {
        $(window).trigger(FLYFI.MSG_CoolStart);
    }
};

$(document).ready(function () {
    var slideShow = $('#slideshow');
    slideShow.find('div').click(FLYFI.onClick_slideShow);
    slideShow.find('.slideslink').click(FLYFI.onClick_slides);
    slideShow.find('.kittenlink').click(FLYFI.onClick_kitten);
    
    $(window).bind(FLYFI.MSG_Start, FLYFI.start_basePage);
});
