$(document).ready(function() {

  $('#gallery').smartTab({
    transitionEffect    : 'fade',
    autoProgress        : true,
    progressInterval    : 10000,
    tabContainerClass   : 'galleryContainer'
  });


  $('.boxgrid.caption').hover(function(){
    $(".cover", this).stop().animate({top:'105px'},{queue:false,duration:160});
  }, function() {
    $(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
  });

  $('.content_right .boxgrid.caption').hover(function(){
    $(".cover2", this).stop().animate({top:'225px'},{queue:false,duration:160});
  }, function() {
    $(".cover2", this).stop().animate({top:'250px'},{queue:false,duration:160});
  });


  $("a.group").fancybox({
    'transitionIn'  : 'fade',
    'transitionOut' : 'fade',
    'speedIn'       : 600,
    'speedOut'      : 600,
    'overlayOpacity': 0.8,
    'overlayColor'  : '#000',
    'overlayShow'   : true
  });

  $('#gallery ul li:last').addClass('lasttab');
  $('#services > li:last').addClass('lastservice');

  $('.portfolio_slider').nivoSlider({
    controlNav    : true,
    directionNav  : true,
    effect        : 'boxRain',
    pauseTime     : 5000,
    animSpeed     : 800
  });

  $('<span>{+} View Project</span>').insertAfter('.portfolio_img img').hide();
    $('.portfolio a').hover(function(){
      $(this).find('span').stop().fadeTo("2000", .8);
    }, function(){
      $(this).find('span').stop().fadeTo("2000", 0);
  })

  $('.portfolio li:nth-child(3n)').addClass('lastInRow');

});
