
//-------------------------------------------------------------
// Fonction permettant l'ouverture d'un pop-up centré sur la page
//-------------------------------------------------------------
function PopupCentrer(page,largeur,hauteur,options) 
{	
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function PopupHautGauche(page,largeur,hauteur,options)
{
	var top=(screen.height-hauteur)/3; 
	var left=(screen.width-largeur)/3;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
			
function popupBAT(url)
{
	var maintenant = new Date();
	var token = 'POPUPBAT' + maintenant.getFullYear() + maintenant.getMonth() + maintenant.getDay() + maintenant.getHours() + maintenant.getMinutes() + maintenant.getSeconds() + maintenant.getMilliseconds();
	var winpopupbat = window.open(url,token,'top='+(screen.height-450)/2,'left='+(screen.width-700)/2,'width=700','height=450','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
	winpopupbat.focus();
	return false;
}

function PopupImage(page,largeur,hauteur,options)
{
	window.open(page,"","top=10,left=10,width="+largeur+",height="+hauteur+","+options);
}

function Images(imageid, imglargeur, imghauteur)
{	
	img_hauteur = imghauteur;
	img_largeur = imglargeur;

	if (imglargeur > 520 && imglargeur > imghauteur)
	{
		var img_hauteur = Math.ceil(imghauteur * 520 / imglargeur);
		img_largeur = 520;			
	}
	else
	{
		if (imghauteur > 520)
		{
			var img_largeur = Math.ceil(imglargeur * 520 / imghauteur);
			img_hauteur = 520;
		}
	}
	PopupHautGauche("../traitement/image-miniature.aspx?w="+img_largeur+"&h="+img_hauteur+"&id="+imageid,img_largeur+20,img_hauteur+25,"toolbar=no,location=no,scrollbars=no,status=no,personalbar=no,menubar=no,resizable=yes");	
}

