$(document).ready(function(){
  
	/*	Drop down menu	*/
	
    $('#menu li ul').css({
       display: "none",
       left: "auto"
     });
     $('#menu li').hover(function() {
       $(this)
         .find('ul')
         .stop(true, true)
         .slideDown('fast');
     }, function() {
       $(this)
         .find('ul')
         .stop(true,true)
         .fadeOut('fast');
     });
	 
	 
	 /*	   Style for active link (drop down menu) - styles it blue when you're on that page   */ 
	
	$('#menu li .nav_active').css(
		{'color' : '#000000', 'font-size' : '13px'}
	);
	
	
	/*	Image hover fade	*/
	
	$('img.fade_img').hover(
		function() {
			$(this).animate({	opacity: 0.5}, 250);
		},
		function() {
			$(this).animate({	opacity : 1.0 }, 500);
		}
	);	
	
	
	/*	Nav slide right and back	*/
	
	$('#navigation li').hover(function(){
    $(this).animate({paddingLeft: '+=15px'}, 200);
  }, function(){
    $(this).animate({paddingLeft: '-=15px'}, 200);
  });
	
	
	/*	Scroll pane	*/
	
	$('#fine_print').jScrollPane({
	scrollbarWidth: 10,
	scrollbarMargin: 10,
	showArrows: false
  });
		
	
	/*	Zebra table	*/
	
	$('#table_zeb tbody tr:even').addClass('zebra');
  $('#table_zeb tbody tr').mouseover(function(){
    $(this).addClass('zebraHover');
  });
  $('#table_zeb tbody tr').mouseout(function(){
    $(this).removeClass('zebraHover');
  });
	
	
	$( '#bounce_navigation li' ).hover(function(){
		$( this )
			.stop( true )
			.animate(
				{height: '90px'},
				{duration: 600, easing: 'easeOutBounce'}
			)
	},function(){
		$( this )
			.stop( true )
			.animate(
				{height:'30px'},
				{duration:600, easing: 'easeOutCirc'}
			)
	});
	
	
	rotatePics(1);
});


function rotatePics(currentPhoto) {
  var numberOfPhotos = $('#photos img').length;
  currentPhoto = currentPhoto % numberOfPhotos;
	
  $('#photos img').eq(currentPhoto).fadeOut(function() {
		// re-order the z-index
    $('#photos img').each(function(i) {
      $(this).css(
        'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
      );
    });
    $(this).show();
    setTimeout(function() {rotatePics(++currentPhoto);}, 4000);
  });
}



