$(document).ready(function(){
  
  Cufon.replace('.font', { fontFamily: 'Helvetica Neue LT Pro' });
  Cufon.replace('.font2', { fontFamily: 'Helvetica Neue LT Pro2' });
  
  $('#subMenuButtons ul li').bind("mouseenter",function(){
    var submenu = $(this).children('.dropUp');
    var top = -8 - submenu.height();
    var height = submenu.height();
    submenu.show().css({'opacity' : 0,'top' : 0,'height' : 0});
    submenu.animate({opacity: 0.9,height: height,top: top}, 500, function(){
      submenu.show().css({'opacity' : 0.9,'top' : top});
    });
  }).bind("mouseleave",function(){
    var submenu = $(this).children('.dropUp');
    submenu.animate({opacity: 0,top: 0,height: 0}, 250, function(){
      submenu.hide().css({'opacity' : 1,'top' : top,'height' : 'auto'});
    });
  });
  
  setInterval( "slideSwitch()", 3000 );

});

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
