$(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed: 'normal', /* fast/slow/normal */
        padding: 40, /* padding for each side of the picture */
        opacity: 0.35, /* Value betwee 0 and 1 */
        showTitle: false, /* true/false */
        allowresize: false, /* true/false */
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
        callback: function(){
        }
    });
    
    // initialize scrollable  
    $("div.scrollable").scrollable({
        vertical: true,
        size: 3
    });
    
    // positions for each overlay
    var positions = [{
        top: 80
    }];
    
    // setup triggers
    $("a[rel]").each(function(i){
    
        $(this).overlay({
        
            // common configuration for each overlay
            oneInstance: false,
            closeOnClick: false,
            
            // setup custom finish position
            finish: positions[i]
        });
    });
    // make div#panes scrollable.
    $("#viewer, #viewerTwo, #viewerThree, #viewerFour, #viewerFive, #viewerSix, #viewerSeven, #viewerEight, #viewerNine, #viewerTen").scrollable({
        items: '#panes, #panesTwo, #panesThree, #panesFour, #panesFive, #panesSix, #panesSeven, #panesEight, #panesNine, #panesTen',
        size: 1,
        navi: 'ul.tabs, ul.tabsTwo, ul.tabsThree, ul.tabsFour, ul.tabsFive, ul.tabsSix, ul.tabsSeven, ul.tabsEight, ul.tabsNine, ul.tabsTen',
        activeClass: 'current',
        
        
        // each time scrolling occurs, the active player is unloaded
        onSeek: function(){
            $f().unload();
        }
    });
    /*
     select player containers with jQuery and make them playable with Flowplayer.
     could this be any simpler?
     */
    $("#panes a, #panesTwo a, #panesThree a, #panesFour a, #panesFive a, #panesSix a, #panesSeven a, #panesEight a, #panesNine a, #panesTen a").flowplayer("swf/flowplayer-3.1.1.swf");
    $f(".player", "swf/flowplayer-3.1.1.swf", {
        plugins: {
            controls: null
        },
        clip: {
            autoPlay: false,
            autoBuffering: true
        }
    
    });
});

