$(document).ready(function(){

    $("#homeIntro h1").fitText(0.85);
    
    $(".workImages a").click( function(e) {
        e.preventDefault();
        var changeSrc = $(this).attr("href");
        
        $(this).parent().parent().parent().parent().find('.mainImage img:not(#loading)').fadeOut(500, function() {
            $(this).attr("src", changeSrc); 
        });
        $('.mainImage img:not(#loading)').load(function() {
            $(this).fadeIn(500);
        });
        $(this).parent().parent().find('.active').removeClass('active');
        $(this).parent().addClass('active');
    });
    
    $('#mainNav uls').waypoint(function(event, direction) {
       if (direction === 'down') {
          $('body > header').addClass('fixedtop');
          $('body').addClass('fixedtop');
       }
       else {
          $('body > header').removeClass('fixedtop');
          $('body').removeClass('fixedtop');
       }
    });
    $('#homePortfolio article').cycle({delay:  5000});
    $("#processResearch").click( function(e) {
        e.preventDefault();
        $('#ourProcess p').fadeOut(500);
        $('#researchText').fadeIn(500);
    });
    $("#processDesign").click( function(e) {
        e.preventDefault();
        $('#ourProcess p').fadeOut(500);
        $('#designText').fadeIn(500);
    });
    $("#processCode").click( function(e) {
        e.preventDefault();
        $('#ourProcess p').fadeOut(500);
        $('#codeText').fadeIn(500);
    });
    
});
