/*
    base JS - p2.com
    by 28|zwo arge medien -rt, 2011
*/

var windowSizeArray = [ "width=460,height=360,scrollbars=no" ];

$(document).ready(function(){

    $(".clickable").click(function (event) { 
        var href_list = $(this).find('a');
        var i = href_list.length > 1?1:0;
        if ($(this).children('.openInNewWindow').length) {
            $($(this).children('.openInNewWindow')[0]).click();
        } else {
            window.location = $(href_list[i]).attr('href');
        }
        event.preventDefault();
        });

    $(".close_me").click(function (event){
        window.close();
        });

    $("#navigation a:not('.current') img")
        .mouseover(function() { 
            var src = $(this).attr("src").match(/[^\.]+/) + "_on.gif";
            $(this).attr("src", src);
        })
        .mouseout(function() {
            var src = $(this).attr("src").replace("_on", "");
            $(this).attr("src", src);
        });

    $('.openInNewWindow').click(function (event){
        var url = $(this).attr("href");
        var windowName = "new";
        var windowSize = windowSizeArray[$(this).attr("rel")]; 
        window.open(url, windowName, windowSize);
        event.stopPropagation();
        event.preventDefault();
        });

    $('img.pictogram').mouseover(function (event){
            $('#big_picto').html('<img src="'+$(this).attr('rel')+'" alt=""/>').fadeIn(300);
        }).mouseout(function (event){
            $('#big_picto').hide();
        });
});
