// Fenetres pop_up

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var MSWin = navigator.userAgent.indexOf("Win") != -1;
var ref_w_choix = null

function ouvre_fen_photo( fich, largeur, hauteur, texte )
{
	if( InternetExplorer && MSWin && ref_w_choix ) ref_w_choix.close();

	ref_w_choix = window.open( "", "w_image", 'width=' + ( largeur + 30 ) + ',height=' + ( hauteur + 30 ) +  ',scrollbars=no,toolbar=no,status=yes' );

	r = ref_w_choix.document
	r.open();
	r.write( '<html><head><title>Image</title><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">' )
	r.write( '</head><body bgcolor="#000040" onBlur="self.close()" text="#003300">' )
	r.write( '<table bgcolor="000011" align="center" valign="center" border="0" cellpadding="0"><tr valign="bottom">' )
	r.write( '<td width="' + largeur + '" height="' + hauteur + '" align="right" background="' + fich + '">' )
	r.write( '<font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="2">' + texte + '&nbsp;</font></td></tr></table></body></html>' )
	ref_w_choix.focus()
}

function ouvre_fen_info( url, w, h )
{
	if( InternetExplorer && MSWin && ref_w_choix ) ref_w_choix.close();
	
	if( ! w ) w = 300;
	if( ! h ) h = 400;
	ref_w_choix = window.open( url, "w", 'scrollbars=yes,resizable=yes,width=' + w + ',height=' + h );
	if( ref_w_choix.innerwidth != w || ref_w_choix.innerheight != h ) ref_w_choix.resizeTo( w + 15, h + 20 );
	ref_w_choix.focus();
}

function plein_ecran( url )
{
	if( InternetExplorer && MSWin && ref_w_choix ) ref_w_choix.close();
	
	w = screen.width;
	h = screen.height;

	if( InternetExplorer && MSWin ) { // IE Windows
		ref_w_choix = window.open( url, "w", "fullscreen,scrollbars" ); 
	} else if( ! InternetExplorer && MSWin ) { // NS Windows
		ref_w_choix = window.open( url, "w", "outerwidth=" + w + ",outerheight=" + h + ",top=0,left=0" );
	} else if( InternetExplorer && ! MSWin ) { // IE Mac
		ref_w_choix = window.open( url, "w", "width=" + w + ",height=" + h + ",top=0,left=0,scrollbars=no" );
	} else if( ! InternetExplorer && ! MSWin ) { // NS Mac
		ref_w_choix = window.open( url, "w", "width=" + ( w - 10 ) + ",height=" + ( h - 50 ) + ",top=0,left=0" );
	}

	ref_w_choix.focus();
}
