
// slideshow pagers
function addClass(pagers, pager) {
  // remove all active states
  $(pagers).each(function() {
    $(this).removeClass("selected");
  });
  // add state to current list item  
  $(pager).addClass("selected");
}

$(document).ready(function() {

  // add .js class to body as hook for progressive enhancement in CSS
  $('body').addClass('js').css('visibility','visible');
    
  // fade slideshows
  var $active = "";
  $(".article .pagers li a").click(function() {
    $pager = $(this).attr("href");  
    $active = $pager;
    $(".article li.section").each(function() {}).fadeOut("fast");
    $($pager).fadeIn("slow");
      addClass(".article .pagers li", $(this).parent().parent()  );
      return false;
    });
  $(".article li.section").each(function() {}).hide();
  $(".article li:first-child.section").each(function() {}).show(); 
  addClass(".article .pagers li", ".article .pagers li:first-child");

  // Easing equation, borrowed from jQuery easing plugin
  // http://gsgd.co.uk/sandbox/jquery/easing/
  jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
  };
});


Cufon.replace('#about h1, body#about .article h2, #services h1 em, #services h1 strong, #services .detail h1, #work h1, #contact h1, #contact #primary h2, #services .block li h3, body#services .detail img, #content .teasers li h2,  #error h1', { fontFamily: 'ChunkFive' });

Cufon.replace('h1 span', { fontFamily: 'CooperBlack' });


// IE is served jquery.corners.js to replicate CSS3 rounded corners
$(function(){
    $('#menu li a, .nav li a, .pagination a, .pagination li span, .aside li a, #services #content .block h2').corner("3px");
});
