/* Author: 

*/


$(document).ready(function() {
  $('#main_gallery') 
	.before('<div id="nav">') 
	.cycle({ 
    fx:     'fade', 
	next:   '#main_gallery', 
    prev:   '#prev2',
	speed:  'fast', 
    timeout: 0, 
    pager:  '#captions',
	pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#captions li:eq(' + (idx) + ') a';
        }
    });

    $('#direct').click(function() {
        $('#captions li:eq(2) a').triggerHandler('click');
        return false;
    });
});



// Keyboard control for Cycle (left and right keys)

$(document).keydown(function(e){
                if(e.which == 37){ $('#prev2').click();}
                else if(e.which == 39){ $('#main_gallery').click();}
        });


$(document).ready(function() {
  $('#slideshow') 
	.cycle({ 
    fx:     'fade', 
	next:   '#slideshow', 
    prev:   '#prev2',
	speed:  'fast', 
    timeout: 3000, 
    pager:  '#captions',
	pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#captions li:eq(' + (idx) + ') a';
        }
    });

    $('#direct').click(function() {
        $('#captions li:eq(2) a').triggerHandler('click');
        return false;
    });
});






