// ini
var _POPUP_FEATURES = '';


// popup
function rawPopup(url,target,features){
    if(typeof(features) == 'undefined')
        features = _POPUP_FEATURES;
    if(typeof(target) == 'undefined')
        target = '_blank';
    var popup = window.open(url,target,features);
    if (popup) {
        popup.focus();
        return popup;
    };
    return false;
}


// sur chargement...
$(document).ready(
    function(){
        // ie5.5+ png
        //$('img[@src$=.png],.fondpng').pngfix();

        // popup
        if ($('a.externe')) {
            $('a.externe').click(
                function(){
                    if (rawPopup($(this).attr('href'),'_blank')) {
                        return false;
                    };
                    return true;
                }
            );
        }
        // safeAddress
        if ($('span.safeAddress')) {
            $('span.safeAddress').each(
                function(){
                    var title = $(this).attr('title');
                    var mail = $(this).text();
                    $(this).empty();
                    $(this).append('<a href="mailto:' + mail + '">' + title + '</a>');
                    $(this).removeAttr('title');
                    $(this).removeAttr('class');
                }
            );
        }
        // menu déroulant
        if ($('#nav-main > ul li')) {
            $('#nav-main li.section').hover(
                function () {
                    $(this).children('ul').css('display','block');
                }, 
                function () {
                    $(this).children('ul').css('display','none');
                }
            );
        }
		// pdf
        $('a.pdf').each(
            function(){
                $(this).prepend('<img src="/style/pdf.gif" width="16" height="16" style="padding: 0 5px 0 0;display: inline;" alt="pdf" style="vertical-align: bottom;" />');
            }
        );
        // icone impression
        if ($('p.print-page')) {
            $('p.print-page').each(
                function() {
                    var htmlStr = $(this).html();
                    var img = '<img src="/style/print.gif" width="20" height="14" alt="" />';
                    $(this).html(htmlStr+img);
                }
            );
        }
    }
);

