$(document).ready(function(){

    $("#war").hide();

    $(".warEagle").hover(function(){
        $("#war").animate({
            opacity: 'toggle' }, 200);
    });

function speechBubble(){
  var pos = $("#bioPic").offset();
  var width = $("#bioPic").width();
  $("#war").css( { "left": (pos.left + width) - 60 + "px", "top":pos.top - 120 + "px" } );
}

// makes sure the script doesn't fire before web fonts are loaded so the image doesn't position above where it should
setTimeout(function(){
speechBubble() }, 1000);

$(window).resize(function(){
    speechBubble();
});

$('.projectImages').nivoSlider({
    effect:'slideInRight',
    manualAdvance:true,
    animSpeed:250
});

$('li a').bind('click',function(event){
    var $anchor = $(this);

    $('html, body').stop().animate({
        scrollTop: $($anchor.attr('href')).offset().top
    }, 700);

    event.preventDefault();
});

$('a#toTheTop').bind('click',function(event){
    var $anchor = $(this);

    $('html, body').stop().animate({
        scrollTop: 0
    }, 300);

    event.preventDefault();
});

});
