$(document).ready(function() {

//Window Resize 
  winResize();
  
  $(window).resize(function(){
    winResize()
  });
  
   function winResize() {
      $winwidth = $(window).width();
      $winheight = $(window).height();
      
      if($('body').height() > $(window).height()){
        $winheight = $('body').height();
      }else{
        $winheight = $(window).height();
      }
      
      $('.contentbackground').animate({
          height: $winheight
      }, 0)
      
      /*if($winheight >= 650){
        $('.contentbackground').clearQueue();
        $('.contentbackground').animate({
          height: $winheight
        }, 0)
      }else{
        $('.contentbackground').clearQueue();
        $('.contentbackground').animate({
          height: 650
        }, 0)
      }*/
      
      if($winwidth <= 1280){
        $('.bganimate').animate({
            width: 1280
        }, 0)
      }else{
        $('.bganimate').animate({
            width: $winwidth
        }, 0)
      }
  };
  
  
//Fancy Navigation background
  $('.bganimate').animate({
      opacity: 0
  })
  
 $('.bganimate').css('z-index', '-2')
 
  $('.navigation').mouseenter(function() {
    $('.bganimate').clearQueue();
    $('.bganimate').css('z-index', '0')
    $('.bganimate').animate({
      opacity: 0.5
    })
  })
  
  $('.navigation').mouseleave(function() {
    $('.bganimate').clearQueue();
    $('.bganimate').css('z-index', '-2')
    $('.bganimate').animate({
      opacity: 0
    })
  })

  
 //Team page functionality 
  $('.teamlist li').mouseover(function() {
    $(this).css('background', 'url(images/whitebg.png)');
  });
  
  $('.teamlist li').mouseout(function() {
    $(this).css('background', 'url(images/textbg.png)');
  });
  
  $('.teamlist li').click(function() {
    $('.teaminfo').hide('fast');
    if($(this).hasClass('tonylink')){
      $('.teaminfo.tony').show('fast');
    }else if($(this).hasClass('peterlink')){
      $('.teaminfo.peter').show('fast');
    }else{
      $('.teaminfo.vivian').show('fast');
    }
  });

});