
/**
* Détermination de la taille de la fenêtre dans le but d'afficher l'image à la bonne taille
* 
* @return array
*
* Script inspiré de "thickbox.js" : TB_getPageSize
*/

function taille_fenetre(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}


/**
 * Affichage du diaporama
 * 
 * 
 * 
*/
var widthFlash;
var heightFlash;

function afficherGallerie(ctnId) 
{
	
	var tailleFenetre = taille_fenetre();
	var defaultWidth = 900;
	var defaultHeight = 700;
	var ratio = defaultWidth / defaultHeight; 
	
	widthFlash = tailleFenetre[0]-160;
	heightFlash = widthFlash / ratio;
	
	if(tailleFenetre[1] < 850) {
		heightFlash = tailleFenetre[1]-40;
		widthFlash = ratio * heightFlash;
	}	
	else if(heightFlash + 50 > tailleFenetre[1]) {
		heightFlash = tailleFenetre[1]-50;
		widthFlash = ratio * heightFlash;		
	}

	widthFlash = widthFlash - 80;
	heightFlash = heightFlash - 80;

	var titre=document.getElementById("href_" + ctnId).getAttribute("title");
	
	document.getElementById("cadreCentreGallerie").innerHTML = AC_FL_RunContent_string('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',widthFlash,'height',heightFlash,'src',jspContextURL +'/Multimedia/Flashs/gallerie?idArticle='+ctnId,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',jspContextURL +'/Multimedia/Flashs/gallerie?idArticle='+ctnId);
	
	SexyLightbox.show(titre,"#TB_inline?height="+(heightFlash + 3)+"&width="+(widthFlash + 3)+"&background=#232222&inlineId=cadreCentreGallerie","sexylightbox");	
}

