  
  function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  /*
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
  */
  return Array(myWidth,myHeight);
}
  function resizeImg(){
    tab=alertSize();
    //alert(tab)
    //calcul de la nouvelle taille de l'image
    tab[0]=(tab[0]<852)?852:tab[0];
	  
		if (tab[0]>852) {
		  document.getElementById('fond').style.overflowX='hidden';
      document.body.style.overflowX="hidden";
    }else{
      document.getElementById('fond').style.overflowX='auto';
      document.body.style.overflowX="auto";
    }
    /*
    heightmax=(document.getElementById('blockcentral')==null)?620:1000;
    alert(document.getElementById('content').clientHeight);
    */
    //heightmax=document.getElementById('container').clientHeight+40;
    //alert(document.getElementById('content').clientHeight)
    heightmax=document.getElementById('container').clientHeight;
    //alert (tab[1]+'/'+heightmax)
    /*
    if(tab[1]<heightmax){
      tab[1]=heightmax;
      coeff=tab[1]/hauteurimg;
    }else{
      coeff=tab[0]/largeurimg; 
    }
    */
    /*tab[0]=(tab[0]<902)?902:tab[0];*/
    tab[1]=(tab[1]<heightmax)?heightmax:tab[1];
    coeff1=tab[0]/largeurimg;
    coeff2=tab[1]/hauteurimg;
    coeff=(coeff1>coeff2)?coeff1:coeff2;
    //alert(coeff+'/'+coeff1+'/'+coeff2)
    if(Math.round(hauteurimg*coeff)>tab[1]){                          //alert(hauteurimg*coeff)
      document.getElementById('imgfond').width=tab[0];      //alert(tab[1])            
      document.getElementById('imgfond').height=(hauteurimg*coeff);
    }else{
      document.getElementById('imgfond').width=(largeurimg*coeff);           
      document.getElementById('imgfond').height=tab[1];
    }
    //alert(coeff+'/'+document.getElementById('imgfond').height+'/'+document.getElementById('imgfond').width)
    document.getElementById('fond').style.width=tab[0]+"px";
    document.getElementById('fond').style.height=tab[1]+"px";
  }
  function startimg(){
    resizeImg();
    document.getElementById('fond').style.display="block";
    setInterval(resizeImg,1800)
  }
  onload=startimg
  onresize=resizeImg
  
  function lightbox(racine){
   $("img.imgcontent").each(function(){
      $(this).replaceWith("<a href=\""+$(this).attr('src')+"\" class=\"inline\" rel=\"gallery\"><img src=\""+$(this).attr('src')+"\" class=\"imgcontent\" align=\"left\" title=\""+$(this).attr('title')+"\" alt=\""+$(this).attr('alt')+"\"/></a>");
     }
     );
    $("blockquote").each(function(){
      content=$(this).html();
      $(this).prev().replaceWith($(this).prev().html()+" <a href=\"#\" class=\"accordeon\"><img src=\""+racine+"/tpl/images/plus.jpg\" title=\"Plus d'information\"></a><br><div class=\"divaccordeon\">"+content+"</div>");
      $(this).replaceWith("");
     }
     );
    $("a.inline").fancybox({
    'overlayOpacity'	:	0.7,
		'overlayColor'		:	'#000',
		'hideOnContentClick': false,
		'showCloseButton':true
	   });

   $("a.thumbln").fancybox({
    'overlayOpacity'	:	0.7,
		'overlayColor'		:	'#000',
		'hideOnContentClick': false,
		'showCloseButton':true
	   });
	  $(".accordeon img").tooltip({position: "top right", effect: "fade", tip:"#extdiv"});
    $(".accordeon").toggle(function() {
      //$(this).find('.divaccordeon').show('slow');
      //alert($(this).next().next().html());
      $(this).next().next().show('slow');
      //alert($(this).html())
      //alert('First handler for .toggle() called.');
    }, function() {
      //$(this).find('.divaccordeon').hide('slow');
      $(this).next().next().hide('slow');
      //alert('Second handler for .toggle() called.');
      //alert($(this).html())
    });
  }
