/*
Fonctions Javascript pour popup d'un Site Internet

Copyright (c) YZEO 2005,2006
Créé le 23/10/2007 par Flavien BUCHETON

Dernière modification le 23/10/2007
*/


//Affiche une image (img) dans un popup
function PopupImage(img) {
	var titre="Image agrandie";
	w=open("",'image','top=0,left=200,width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+15,document.images[0].height+85); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><a href='javascript:window.close();'><IMG src='"+img+"' border=0></a>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

//PopupImageR (resizable pour les images trop grandes)
function PopupImageR(img) {
	var titre="Image taille reelle";
	w=open("",'image','width=400,height400,toolbar=no,scrollbars=yes,resizable=yes,status=no');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) { if (document.images[0].width >=760) { window.resizeTo(830,600); window.focus; } else {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} } else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0 bgcolor='#990000'><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

//Affiche une image (img) dans un popup avec le clic droit bloqué
function PopupImageCD(img) {
	var titre="Image taille reelle";
	w=open("",'image','top=0,left=0,width=400,height=400,toolbar=no,scrollbars=no,resizable=yes,status=no');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE><meta HTTP-EQUIV='imagetoolbar' CONTENT='no'></HEAD>");
	w.document.write("<SCRIPT language=javascript>");
	w.document.write("function ejs_nodroit(){ alert('Vous n\\'etes pas autorise a utiliser le bouton droit de la souris.'); return false; } ");
	w.document.write("document.oncontextmenu = ejs_nodroit; ");
	w.document.write("function checksize(){ if (document.images[0].complete){ window.resizeTo(document.images[0].width+15,document.images[0].height+40); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><a href='javascript:window.close()'><IMG src='"+img+"' border=0></a>");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

//Ouvrir Popup
function OpenFen(page,titre,x,y,w,h,scrollbar,resize){
	var option='top='+x+',left='+y+',width='+w+',height='+h+',';
	option+='toolbar=no,scrollbars='+scrollbar+',resizable='+resize+',status=no';
	window.open(page,titre,option);
}

/* ************************* Popup Centrer 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);
}

// option peut etre "menubar=no,scrollbars=no,statusbar=no"
// appel : javascript:PopupCentrer('nompage.htm',520,220,'menubar=no,scrollbars=no,statusbar=no')
