$(document).ready(function() {

  $('.gal a[rel^=g]').fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
  });
  
  
  function rand(n) { return ( Math.floor(Math.random()* n + 1)); }

  $('.gal img').fadeTo(0, 0).each(function() {
		$(this).delay(rand(2000)).fadeTo(500, 1);							   					  
   }).mouseenter(function() { $(this).fadeTo(500, 0.8).addClass("over"); }).mouseleave(function() { $(this).fadeTo(500, 1).removeClass("over"); });

});
