$(document).ready(function() {
    $('.pngfix').pngFix();
    
    mainNav();
    
    $('.diaporama-block').slideshow({
        playframe: false,
        width: 475,
        height: 270,
        time: 3000,
        title: false,
        panel: false   
    }).playSlide();
    
    openExternalLinks();

    maxheight = 0;
    $('.columns-wrapper .column-news-block').each(function(i) {
    	if($(this).height() > maxheight) {
    		maxheight = $(this).height();
    	}
    });
    $('.columns-wrapper .column-news-block').css({'height':maxheight+'px'})
    
    homeNewsTop = 0;
    h1 = $('.mini-agenda-block').height() - 270 + 34; // 270 : slider height : 34 : agenda padding
    if(h1 > 0) {
    	h2 = $('.news-block ul').height();
    	$('.news-block ul').css({'height': h2 + h1})
    }    
});


function mainNav() {
    $('#nav > li').mouseover(function() {
            $(this).addClass('over');
        })
        .mouseleave(function() {
            $(this).removeClass('over');      
    });
}


 function openExternalLinks() {
    $('a[rel=external]').click(function() {
         var newWindow = window.open($(this).attr('href'), '_blank');
         newWindow.focus();
         return false;
     });
 }
