		
$(document).ready(function() {
		
		// Preload all rollovers
		$(".roll img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_On.png");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("a.roll").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_On/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_On.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("a.roll").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
        // AUTO SCALE IMAGES added on 2009-11-20 
        // Il suffit de mettre la classe scale aux images qui doivent etre automatiquement forcer a une taille max
        // Les images prendront al taille maximale du div qui les contient
        // Ne marchera que si le div a ete force a une taille max via les CSS
        // <div> <img class="scale" src="..............."> </div>
        $("img.scale").each( function() { 
            
            img = $(this);

            // img.animate({opacity: 0}, {queue:false, duration: 10});
            img.load(function(){
                container = $(this).parents('div');
                maxwidth  = container.width();
                maxheight = container.height();
                w = $(this).width();
                h = $(this).height();
                if (w > maxwidth || h > maxheight)
                {
                    factor = Math.max(w/maxwidth, h/maxheight);
                    $(this).attr('width', Math.round(w/factor))
                    $(this).attr('height', Math.round(h/factor))
                }
                // $(this).show('slide', {direction: 'left'}, 1000); 
                // $(this).animate({opacity: 1}, {queue:false, duration: 200});
            });
        });
});



//Ouverture de lien valide

function open_ext_link()
{
	var liens = document.getElementsByTagName('a');
	// On rÃ©cupÃ¨re tous les liens (<a>) du document dans une variable (un array), ici liens.
	// Une boucle qui parcourt le tableau (array) liens du dÃ©but Ã  la fin.
	for (var i = 0 ; i < liens.length ; ++i)  {
		// Si les liens ont un nom de class Ã©gal Ã  lien_ext, alors on agit.
		if (liens[i].className == 'ext_link')  {
			/*liens[i].title = 'S\'ouvre dans une nouvelle fenÃªtre';*/
			// Au clique de la souris.
			liens[i].onclick = function()  {
				window.open(this.href);
				return false; // On ouvre une nouvelle page ayant pour URL le href du lien cliquÃ© et on inhibe le lien rÃ©el.
			};
		}
	}
}
window.onload = open_ext_link;
// Au chargement de la page, on appelle la fonction.