// FANCYBOX
$(document).ready(function() {
	$("a[rel=lightbox]").fancybox({
		'transitionIn'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'  : '0.8',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
	return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});

// SLIDESHOW
$(function() {
    $('#slideshow').cycle({
        fx:     'fade',
        speed:  'fast',
        timeout: 5000,
        pager:  '#nav',
				pagerEvent: 'mouseover',
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#nav li:eq(' + (idx) + ') a';
        }
    });
    $('#direct').click(function() {
        $('#nav li:eq(2) a').triggerHandler('click');
        return false;
    });
});

// JQUERY CYCLE PLUGIN
var randomnumber=Math.floor(Math.random()*5);
$(document).ready(function() {
	$('.slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		startingSlide: randomnumber // zero-based 
	});
});
