// 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
      // popup
        if (jQuery('a.externe').length > 0) {
            jQuery('a.externe').click(
                function(){
                    if (rawPopup(jQuery(this).attr('href'),'_blank')) {
                        return false;
                    };
                    return true;
                }
            );
        }
        // safeAddress
        if (jQuery('span.safeAddress').length > 0) {
            jQuery('span.safeAddress').each(
                function(){
                    var title = jQuery(this).attr('title');
                    var mail = jQuery(this).text();
                    jQuery(this).empty();
                    jQuery(this).append('<a href="mailto:' + mail + '">' + title + '</a>');
                    jQuery(this).removeAttr('title');
                    jQuery(this).removeAttr('class');
                }
            );
        }
		
		
          // menu déroulant
        if (jQuery('#nav-main > ul li').length > 0) {
            jQuery('#nav-main > ul li').hover(
                function () {
                    jQuery(this).children('ul').css('visibility','visible');
                }, 
                function () {
                    jQuery(this).children('ul').css('visibility','hidden');
                }
            );
        }
        // icone impression
        if (jQuery('p.print-page').length > 0) {
            jQuery('p.print-page').each(
                function() {
                    var htmlStr = jQuery(this).html();
                    var img = '<img src="/style/print.gif" width="20" height="14" alt="" />';
                    jQuery(this).html(htmlStr+img);
                }
            );
        }
    }
);

