$(document).ready(function () { 
  // Preload animations
  $('#top_nav li a img').stop().animate({"opacity":1}, "slow");
  $('#top_nav li a img').stop().animate({"opacity":0}, "slow");
  $('#top_nav li a.active img').stop().animate({"opacity":1}, "slow");

  // Hover animation action
  $("#top_nav li a[class!=active] img").hover(function(){
    $(this).stop().animate({"opacity":1}, "slow");
  }, function(){
    $(this).stop().animate({"opacity":0}, "slow");
  });

  // Hover drop-downs
  $('#top_nav li ul').stop().animate({"opacity":1}, "fast");
  $('#top_nav li ul').stop().animate({"opacity":0}, "fast");

  $("#top_nav ul > li").hover(function(){
    $(this).find("ul").css('display', 'block').stop().animate({"opacity":1}, "fast");
  }, function(){
    $(this).find("ul").css('display', 'none').stop().animate({"opacity":0}, "fast");
  });
  
  
  
  // Show random testimonials
  var $texts = $('#slider_info .info');
  var n = $texts.length;
  var random = Math.floor( Math.random()*n ); 
  $texts.hide().eq(random).show();
  // Fade in random if needed.
  // $infos.hide().eq(random).fadeIn();
});
