// JavaScript

/* 
mode d'emploi :
---------------
ajouter : <body onLoad="redimAllImages();">
*/
<!-- 
// redimensionne toutes les images de la page
function redimAllImagesDescriptif() {
	return redimAllImagesBySize('insertedimageDesc',740,99999);
}	
function redimAllImages() {
//6110
	return redimAllImagesBySize('insertedImage',525,99999);
}
function redimAllImagesBySize(name,s1,s2) {	
	if (navigator.appName!="Microsoft Internet Explorer") 
	  return false;
	var x=document.getElementsByName(name);

	maxi=x.length;
	for (i=0;i<maxi;i++) {
		//on genere un id
		var currentTime = new Date()
		id = currentTime.getTime();
		x[i].id='insertedimage-'+id; 
		
		redimImage(x[i],s1,s2);
	}
	return true;
}
// redimensionne l'objet image inImg avec width-max=inMW height-max=inMH
function redimImage(inImg, inMW, inMH) {
	
//	if (navigator.appName!="Microsoft Internet Explorer") 
//		 return;

  // ratio
  var maxWidth = inMW;
  var maxHeight = inMH;
  var dW = 0;
  var dH = 0;
  oImg=inImg;

  if ( !oImg ) return;

  // tailles reelles
  var h = dH = oImg.height;
  var w = dW = oImg.width;
  
  // non ie ou non compatible, on quitte
  if ( h == 0 || w == 0 ) return;
  
  if ( !oImg.complete ) {
  	oImg.style.display='none';
  	setTimeout('delayredim(\''+inImg.id+'\', \''+inMW+'\', \''+inMH+'\')',100);
	return false;
  }

	// pour firefox
	//oImg.style.width='inherit';  
	//oImg.style.height='inherit';  

  // Si la largeur ou la hauteur depasse la taille maximale
  if ((h >= maxHeight) || (w >= maxWidth)) {
    // Si la largeur et la hauteur depasse la taille maximale
    if ((h >= maxHeight) && (w >= maxWidth)) {
      // On cherche la plus grande valeur
      if (h > w) {
        dH = maxHeight;
        // On recalcule la taille proportionnellement
        dW = parseInt((w * dH) / h, 10);
      } else {
        dW = maxWidth;
        // On recalcule la taille proportionnellement
        dH = parseInt((h * dW) / w, 10);
      }
    } else if ((h > maxHeight) && (w < maxWidth)) {
      // Si la hauteur depasse la taille maximale
      dH = maxHeight;
        // On recalcule la taille proportionnellement
      dW = parseInt((w * dH) / h, 10);
    } else if ((h < maxHeight) && (w > maxWidth)) {
      // Si la largeur depasse la taille maximale
      dW = maxWidth;
        // On recalcule la taille proportionnellement
      dH = parseInt((h * dW) / w, 10);
    }
  }
 // redimensionnement
 oImg.width=dW;
 oImg.height=dH;
 oImg.style.display='inline';

 return -1;
}
// appel avec delai
function delayredim(image,inMW,inMH) {
	redimImage(document.getElementById(image),inMW,inMH);
}
function hackGreybox(object,w,h) {
	 var item = {
		'caption': object.title || '',
		'url': object.href
	}
	GB_showCenter(item.caption, item.url, h, w);
	return false;
}	
/* modification de MM_openBrWindow pour appel a greybox */
function MM_openBrWindow(theURL,winName,features) { 
	window.open(theURL,winName,features); 
}

function Show() {
	x = document.getElementById("infoBlogOFF") ;
	x.style.display='none';
	
	if (!x) return;

	zu = document.getElementById("header") ;
	z = zu.getElementsByTagName("EMBED") ;
	for (i=0;i<z.length;i++)
	{
	z[i].style.display='block';
	}
	y = document.getElementById("infoBlogON") ;
	y.style.display='inline';
	
 }

function Hide() {
	x = document.getElementById("infoBlogOFF") ;
	
	if (!x) return;
	
	x.style.display='inline';

	zu = document.getElementById("header") ;
	z = zu.getElementsByTagName("EMBED") ;
	for (i=0;i<z.length;i++)
	{
	z[i].style.display='none';
	}

	
	y = document.getElementById("infoBlogON") ;
	y.style.display='none';

 }

function check_embed(sta){
	y = document.getElementById("infoBlogON") ;
	if ( !y ) return ;
	if (sta=='none') {
		Hide();
	}
}

//-->