$(function()
{
	$("ul.sf-menu").superfish({
	    delay:0,
	    animation:{opacity:'show',height:'show'},
	    speed:100,
	    autoArrows:true,
	    dropShadows:false
	}); 
    $('#slideshow').innerfade({
	    speed: 2000,
		timeout: 4000,
		type: 'sequence',
		containerheight: '287px'
    });
    var options = {
        direction:  'right',
        duration:   400,
        stageW:     '297px',
        stageH:     '294px'
    }
    $('.popeye').popeye(options);
    loadGallery();
});
function loadGallery() {
	$('.gallery_demo_unstyled').addClass('gallery_demo');
	$('ul.gallery_demo').galleria({
		history   : false,
		clickNext : false,
		insert    : '#main_image',
		onImage   : function(image,caption,thumb) {
			image.css('display','none').fadeIn(1000);
			caption.css('display','none').fadeIn(1000);
			var _li = thumb.parents('li');
			_li.siblings().children('img.selected').fadeTo(500,0.3);
			thumb.fadeTo('fast',1).addClass('selected');
			image.attr('title','Next image >>');
		},
		onThumb : function(thumb) {
			var _li = thumb.parents('li');
			var _fadeTo = _li.is('.active') ? '1' : '0.3';
			thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
			thumb.hover(
				function() { thumb.fadeTo('fast',1); },
				function() { _li.not('.active').children('img').fadeTo('fast',0.3); }
			)
		}
	});
}

