jQuery().ready(function() {

//  fonction pour que les ajax utilisent les bon caractères spéciaux
//    jQuery.ajaxSetup ( {
//        'beforeSend' : function(xhr) {
//        xhr.overrideMimeType('text/html; charset=iso-8859-1');
//        }
//    });

//     Ouvre les liens externes dans un nouvel onglet
    $('a').live('click',function() {
	var href = $(this).attr('href');
	if (href.indexOf('http://') != -1 || href.indexOf('https://') != -1) {
		var host = href.substr(href.indexOf(':')+3);
		if (host.indexOf('/') != -1) {
			host = host.substring(0, host.indexOf('/'));
		}
		if (host != window.location.host) {
			window.open(href);
			return false;
		}
	}
    });

//  Ouvre et ferme les div

    $("a.selection").click(function(){
            if($(this).next("div.divrouge").is(":hidden")){
//              alert('ok');
                $("div.divrouge").stop().fadeOut('fast');
                $(this).next("div.divrouge").fadeIn('slow');
            }else{
                $(this).next("div.divrouge").fadeOut("fast");

            }
			return false;
    });

   /*changement des couleurs des liens au passage*/

    $("div.lien").css({background:"url(images/bandeauLien.png) no-repeat"});
    $("div.lien").mouseout(function(){
            $("div.lien").stop().css({background:"url(images/bandeauLien.png) no-repeat"});
    });
    $("div.lien").mouseover(function(){
            $(this).css({background:"url(images/BLS.png) no-repeat"});
    });

//        ******fonction ajax****************************************************************

  
    


 });
 

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
    var popup;
    toolbar_str = toolbar ? 'yes' : 'no';
    menubar_str = menubar ? 'yes' : 'no';
    statusbar_str = statusbar ? 'yes' : 'no';
    scrollbar_str = scrollbar ? 'yes' : 'no';
    resizable_str = resizable ? 'yes' : 'no';

    cookie_str = document.cookie;
    cookie_str.toString();

    pos_start  = cookie_str.indexOf(name);
    pos_end    = cookie_str.indexOf('=', pos_start);

    cookie_name = cookie_str.substring(pos_start, pos_end);

    pos_start  = cookie_str.indexOf(name);
    pos_start  = cookie_str.indexOf('=', pos_start);
    pos_end    = cookie_str.indexOf(';', pos_start);

    if (pos_end <= 0) pos_end = cookie_str.length;
    cookie_val = cookie_str.substring(pos_start + 1, pos_end);
    if (cookie_name == name && cookie_val  == "done")
    return;

    popup=window.open(url, name, "left="+left+",top="+top+",width="+width+",height="+height+",location=no,scrollbars="+scrollbar+",resizable="+resizable);

}
