
$(document).ready(function()
{ 
  
  $('a').each(function(){  
      
      var x= $(this).attr('href');
      var s=x.split('.');
      if(s[1]=='jpg' || s[1]=='gif' || s[1]=='png')
        $(this).attr('class','fancybox');
		$(this).attr('rel','group'); 
  
  });
  
  /* This is basic - uses default settings */ 
  $("a.fancybox").fancybox({
						   frameWidth: 750,
						   frameHeight: 500
						   }); 
  
  $('ul.sf-menu').superfish();    
  
   //$('a.fancybox').fancyBox();
   
   slideShow();
   
   $('.mtop').hover(function(){
      $(this).css({'background-position':'center 44px'})
   
   },
   function(){
      $(this).css({'background-position':'center top'})
   });
   
   
});


function slideShow() {
  
	$('div.gallerymain:first').fadeIn(2500);
	gallery();
	setInterval('gallery()',5000);
	
}

function gallery() 
{	
	var current = ($('div.gallerymain.show')?  $('div.gallerymain.show') : $('div.gallerymain:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('div.gallerymain:first') :current.next()) : $('div.gallerymain:first'));	
	
	
  //Hide the current image
  current.removeClass('show')
  .fadeOut(2500);
  
  //Set the fade in effect for the next image, show class has higher z-index
  next.addClass('show')
	.fadeIn(2500);
	
	
  
  
  
}




