$(document).ready(function() {
  //set width and height of card wrappers to window width and height
  var cards = $('#cards');
  var win = $(window);
  
  $('div[id!=""]', cards).css({
    width: win.width(),
    height: win.height()
  });
  
  
  //ow!
  if(cards.children('div').length == 1) $('body').css('overflow', 'hidden');


  //apply cycle plugin
  var navigation = '#navigation';

  cards.cycle({
    fx: 'scrollLeft', // http://malsup.com/jquery/cycle/begin.html
    speed: 1000,
    timeout: 0,
    easing: 'easeInOutCirc', // http://gsgd.co.uk/sandbox/jquery/easing/
    pager: navigation,
    pagerAnchorBuilder: function(idx, slide) {
      return navigation+' li:eq('+idx+') a';
    }
  });


  //manage current card indicator
  $(navigation+' li a').click(function() {
    $(navigation+' li').removeClass('current');
    $(this).parent().addClass('current');
  });
  
  
  //vcard shadow animation
  var vcard = $('#vcard');
  var vcardShadow = $('span', vcard);
  
  vcardShadow.css('opacity', 0.2);
  
  vcard.hover(function() {
    vcard.stop().animate({ top: 170 }, 'slow');
    vcardShadow.stop().animate({ paddingTop: 40, opacity: 0.8 }, 'slow');
  }, function() {
    vcard.stop().animate({ top: 180 }, 'slow');
    vcardShadow.stop().animate({ paddingTop: 20, opacity: 0.2 }, 'slow');
  });
});
