

(function($) {

  $(document).ready(function() {
			
	// ACTIVATE ROLLOVERS //
	
	$(".rollover").hover(
      function () {
        $(this).addClass("hover");
      }, 
      function () {
        $(this).removeClass("hover");
      }
  );
	
	// Disable some features on Chrome on PC
	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	var is_mac = navigator.userAgent.indexOf('Mac') > -1;
	
	if(is_chrome && !is_mac) {
		 $("#logo video").css('display', 'none');
	} else {
		
	}
	scrollWalkList();
	
	// ACTIVATE TOOLTIPS //
	
	// $(".list-img li a").tooltip({ relative: "true", position: 'bottom center', effect: "fade"});
	
	// INITIALIZE SLIDES //
	
	$('.list-img').tabs('div.panes > div', { rotate: 'true', effect: 'fade', fadeOutSpeed: '400'}).slideshow({interval: '12000', autoplay: 'true'});
	
	$("#feature").hover(
	  function () {
		   $(".list-img").data("slideshow").pause();
	  },
	  function () {
		   $(".list-img").data("slideshow").pause();
	  }
	);

	// SCROLL THE LIST OF WALKS //
	
	// This function resets itself with the first animate function
  function scrollWalkList() {
	  var listHeight = $('#walks-list ul').height();
	  var walksHeight = $('#walks-list').height() + 130;
	  var lis = $('#walks-list li').length;
	  var scrollAnimationLength = lis * 5000;
	  /*var fadeAnimationLength = 2000;
	  var fadeAnimationDelay = 3000;
	  var fadeAnimationEndDelay = 4000;
	  var fadeAnimationStagger = scrollAnimationLength - fadeAnimationLength - fadeAnimationDelay - fadeAnimationEndDelay;*/
	  $('#walks-list ul').animate({top: walksHeight}, 1, "linear").animate({top:  -listHeight}, scrollAnimationLength, "linear", scrollWalkList);
	  /*$('#walks-list li').each(function(index) { 
		  $(this).animate({opacity: 1}, fadeAnimationDelay, "linear").animate({opacity: 1}, (fadeAnimationStagger/lis)*(index + 1), "linear").animate({opacity:  0}, fadeAnimationLength);
	  });*/
	}
	
  });
  
})(jQuery);
