$(function() {
  if ($('#testimonials')) {
    setInterval(function() {
      var active = $('#testimonials .testimonial.active');
      
      if ( active.length == 0 ) active = $('#testimonials .testimonial:last');
      
      var next = active.next().length ? active.next()
        : $('#testimonials .testimonial:first');
        
      active.fadeOut(2000, function() { active.removeClass('active'); });
      next.fadeIn(2000, function() { next.addClass('active'); });
      
    }, 5000);
  }

  if ($('#contact')) {
  	$('#submitted').val('1');
  }
  
  if ($('#work')) {
    $('.service').hover(function () {
      $(this).addClass('highlight');
      $('.service:not(#'+this.id+')').removeClass('highlight');
    }, function() {
      $(this).removeClass('highlight');
    });
    if (window.location.hash && $(window.location.hash)) {
      $(window.location.hash).addClass('highlight');
    }
  }
  
  if ($('#clients')) {
    $('.client').hover(function() {
      $(this).addClass('highlight');
    }, function() {
      $(this).removeClass('highlight');
    });
  }

});