var newFenetre = null;
var newFenetre_acrobat = null;


//creation d'une fenêtre à partir d'une url et d'un chaine de paramètres 
function  faitFenetre (url, winOpts)
{

	var nomfen="fenetre";
	
	// seule façon de forcer tous les navigateurs à ouvrir une nouvelle fenêtre
	//pour les mac fenêtre unique = nom unique
	if (navigator.appVersion.indexOf('Macintosh') == -1) nomfen = Math.round(Math.random()*1000);
	
	newFenetre = window.open(url, nomfen , winOpts);
	
	//pour les mac une fenêtre unique -> on lui redonne le focus
	if (navigator.appVersion.indexOf('Macintosh') != -1) setTimeout('newFenetre.focus();',250);  
}


function  FenetreExterieur (url)
{
	var winOpts="left=20,top=20,width=200,height=300,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no";
	faitFenetre(url , winOpts);
}
    
function  FenetreAideCommentaire(url)
{
	var winOpts="left=20,top=20,width=200,height=300,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no";
	faitFenetre(url , winOpts);
}

function  FenetreExemple (url)
{
	var winOpts="left=20,top=20,width=200,height=300,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no";
	faitFenetre(url , winOpts);
}

function  FenetreFiche (url)
{
	var winOpts="left=20,top=20,width=200,height=300,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no";
	faitFenetre(url , winOpts);
}


//traitement particulier pour les acrobat
//fenetre unique, on lui redonne le focus à chaque fois
//si la fenêtre existe déjà, on modifie son window.location
//pour obtenir une bonne gestion de l'historique.
//Sauf sous IE3 = nouvelle fenetre à chaque fois !!!!
function  FenetreAcrobat(url)
{
var nomfen="fenetreacrobat";
if (navigator.appVersion.indexOf('MSIE 3.') != -1) nomfen = Math.round(Math.random()*1000);

var winOpts="left=20,top=20,width=200,height=300,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no";

if ( (newFenetre_acrobat == null) || (navigator.appVersion.indexOf('MSIE 3.') != -1) ) newFenetre_acrobat=window.open(url, nomfen, winOpts);

else {
	
	if (newFenetre_acrobat.closed)
	{
		
		newFenetre_acrobat=window.open(url, nomfen, winOpts);
		
	} else {
		
		newFenetre_acrobat.location = url;
		
	}
}

if (navigator.appVersion.indexOf('MSIE 3.') == -1) setTimeout('newFenetre_acrobat.focus();',250);

}



//Affiche sous le lien cliqué, une bulle (fenêtre !) d'aide
function afficheNote(message, mot, couleurFond, fond, couleurTexte, typePolice, tailleCaracteres, pX, pY) {
  newFenetre = window.open('','Note','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,' + 'width=400' + ',height=100');
  texte = '<' + 'HTML' + '><' + 'HEAD' + '><' + 'TITLE' + '>' + mot + '</' + 'TITLE' + '><' + '/HEAD' + '><' + 'BODY BACKGROUND=' + '"' + fond + '"' + ' BGCOLOR=' + '"' + couleurFond + '">';
  texte += '<left>';
  texte +='<FONT FACE="' + typePolice +'"';
  texte += ' SIZE=' + tailleCaracteres; 
  texte += ' COLOR=' + '"' + couleurTexte +'">';
  texte += message + '</CENTER></FONT>';
  texte += '</' + 'BODY' + '><' + '/HTML' + '>';
  newFenetre.document.write(texte);
  newFenetre.focus();
  newFenetre.document.close();
  newFenetre.moveTo(pX,pY+5);
  return false;
}


//On referme la fenêtre, sauf s'il s'agit d'une fenêtre acrobat
//Ne marche pas avec IE 3
//N'est pas déclenché par les mac (pas de onFocus)

function closer()
{
	if ( (newFenetre != null) || (navigator.appVersion.indexOf('MSIE 3.') != -1) ) {

		if (! newFenetre.closed) {newFenetre.close();}
		
		newFenetre = null;
	}
	
}

	




