$(document).ready(function() {
  $('#slideshow').cycle({ 
      fx:     'fade', 
      speed:  'slow', 
      timeout: 3000,
      pause: 'true',
      pager: '#slideshow-nav',
      activePagerClass: 'active',
      pagerAnchorBuilder: function(idx, slide) {
        return '<a href="#"></a>'
      }
  });
  
  $('.go-to-top a').click(function(){
    if ( $.browser.webkit ) {$("body").animate({scrollTop:0}, 1000);}
    else{$("html").animate({scrollTop:0}, 1000);}
    return false;    
  });
        
  $(".bigmap").fancybox({
    'transitionIn' : 'fade',
    'transitionOut' : 'fade',
    'overlayShow' : true,
    'titleShow' : false,
    'padding': 10,
    'centerOnScroll' : 'true',
    'type' : 'iframe',
    'width' : '90%',
    'height' : '90%'
  });

  if ($('#subnav').length > 0) {
    var offset = $("#subnav").offset();
    var topPadding = 15;
    $(window).scroll(function() {
      if ($(window).scrollTop() > offset.top) {
        $("#subnav").stop().animate({
          marginTop: $(window).scrollTop() - offset.top + topPadding
        });
      } else {
        $("#subnav").stop().animate({
          marginTop: 0
        });
      };
    });
  }
});

Cufon.replace('.push-quote h2, .profile h2, .profile small');
