$(function(){
    
    // sifr text replacement
    $.sifrSettings({ path: '/fonts/' , color: '#006898' });
    $('h3.sifr').sifr({font: 'optima', color: '#006898', fontWeight: 'bold'});   
    
    // links with rel external should open in new window
    $('a[rel="external"]').attr( 'target', '_blank' );
    
    // track the opening of PDF files with Google Analytics
    $("#content a[href$='.pdf']").click(function(){
        window.open($(this).attr( "href" ));
        pageTracker._trackPageview($(this).attr( "href" ));
        return false;
    });
    
    // track certain outgoing links
    $("a.track").live('click', function(){
    	var href = $(this).attr("href");
        pageTracker._trackPageview(href);
        setTimeout(function(){
        	document.location.href = href;
        }, 500);
        return false;
    });
    
    // fader for promo banners
    $('#promo-fader').innerfade({ speed: 800, timeout: 3500, type: 'sequence', containerheight: '206px'});
    
    // handle month selections in the nature calendar
    $('#natureCalendar div').hide();
    $('#ncJan').show();
    $('#natureCalendarNav a').click(function(){
        var selectedMonth = $(this).attr('href');
        $('#natureCalendar div:visible').fadeOut(500,function(){
            $(selectedMonth).fadeIn(500, function(){
                if(jQuery.browser.msie) this.style.removeAttribute('filter');
            });
        });
        $('#natureCalendarNav li').removeClass('selected');
        $(this).parent().addClass('selected');
        return false;
    });
});