$(function(){
  $(".scroll").click(function() {
    $.scrollTo($($(this).attr("href")), {
      duration: 750
    });
    return false;
  });
  $(".project-detail-link").click(function() {
    $.scrollTo($($(this).attr("href")), {
      duration: 750
    });
    return false;
  });
});

$(function(){
  $('.client').tipTip();
  $('.social').tipTip();
  
  $("#projectList .cell a img.top").hover(
    function() {
      $(this).stop().animate({"opacity": "0"}, "normal");
    },
    function() {
      $(this).stop().animate({"opacity": "1"}, "normal");
    });
  $("#projectThumbList .cell a img.top").hover(
    function() {
      $(this).stop().animate({"opacity": "0"}, "normal");
    },
    function() {
      $(this).stop().animate({"opacity": "1"}, "normal");
    });
});

// ISOTOPE FILTER
$(window).bind('load', function () {
  
  $list = $('#projectList');
  
  $('#filter a').click(function(){
    var filterName = $(this).attr('data-filter');
    $list.isotope({ filter : filterName });
    return false;
  });
  
  var currentLayout = 'fitRows';
  
  // switches selected class on buttons
  $('.option-set a').click(function(){
    var $this = $(this);
    
    // don't proceed if already selected
    if ( !$this.hasClass('selected') ) {
      $this.parents('.option-set').find('.selected').removeClass('selected');
      $this.addClass('selected');
    }
    
  });
  
  $(function(){
    $list.isotope({
      layoutMode : 'fitRows',
      masonry : {
        columnWidth: 220
      },
      getSortData : {
        related : function( $elem ) {
          return $elem.attr('data-related');
        },
        width : function( $elem ) {
          return $elem.width();
        }
      }
    });
  });
});

// NIVO SLIDER
$(window).load(function() {
  $('#slider').nivoSlider();
});

// WINDOWS PIN
$(function(){
  $('head').pinify({   
    applicationName: 'Switch Apps',
    favIcon: '/media/TemplateImages/favicon.ico',
    navColor: 'Orange',
    startUrl: '/home',
    tooltip: 'Switch Apps',
    window: 'width=800;height=600',
    tasks: [{
    'name': 'Switch Apps',
    'action': 'http://www.switchapps.com/',
    'icon': 'http://www.switchapps.com/media/TemplateImages/favicon.ico'
  },
                   {
                     'name': 'Our work',
                     'action': 'http://www.switchapps.com/our-work',
                     'icon': 'http://www.switchapps.com/media/TemplateImages/favicon.ico'
                   }]
                   });
});
