// ======================================================================================================
// 29/05/2007, Refonte des fonctions de création de popup
// Fonctions de remplacement de modaldialogbox pour compatibilité avec Firefox...
// Dans la fenêtre fille, il faut utiliser la variable opener pour intéragir avec la fenêtre parent
// il faut ajouter : if (!opener) opener = window.dialogArguments;
// ensuite 	opener.document.cms.dto.value="toto@wanadoo.fr";
// où cms est le nom du formulaire de la fenêtre parent et dto la zone qui doit être alimentée 
// voir /admin/userhelp.php pour complément d'informations
// ======================================================================================================
// La fonction poUpString() doit être utilisée pour créer un objet de config.
// Ensuite, il faut passer cet objet à la fonction Popup() pour créer la fenêtre.
// Bien sûr, il est possible de modifier les paramètres d'appel comme dans l'exemple ci-dessous:
//		MaFenetre="spec/pw.php";
//		conf=new popUpSettings();
//		conf.width=600;
//		conf.height=585;
//		popUp(MaFenetre,conf);
// ATTENTION: le paramètre modal ne fonctionne pas en mode window.open.
// ATTENTION 2: Il semble qu'il ne soit pas possible d'enlever la barre de status...
// ======================================================================================================
var win=null;
function classPopUp(mypage) // DEFINITION DE LA CLASSE
{
//---------------------------------------------------------------------------------------------------------
//                                              ATTRIBUTS
//---------------------------------------------------------------------------------------------------------
this.name='CASSIUMForge'; // Nom de la fenêtre

this.modal='yes'; // On veut une boite de dialogue modale

this.width=500; // Largeur
this.height=500; // Hauteur

this.LeftPosition=0; // Position à partir de la gauche de l'écran
this.TopPosition=20; // Position à partir du haut de l'écran
this.position='center'; // Demande de centrage de la fenêtre (autre valeur possible: random. Si vide, valeur ci dessus...)

this.location='no'; // sé plus...
this.directories='no'; // Pas de bouton d'accès aux répertoires
this.status='no'; // Pas de barre d'état (ne fonctionne pas)
this.scrollbars='no'; // Pas d'ascenseurs
this.menubar='no'; // Pas de barre de menu (avec boutons suivant, précédent...)
this.toolbar='no'; // Pas de barre d'outils
this.resizable='no'; // Redimensionnement de la fenêtre interdit

//---------------------------------------------------------------------------------------------------------
//                                              METHODES
//---------------------------------------------------------------------------------------------------------

// show() : Affichage de la fenetre
//---------------------------------
this.show = function() 
	{ 
	var configString='';

	if (this.position=="random")
		{
		this.LeftPosition+=(screen.width)?Math.floor(Math.random()*(screen.width-this.width)):100;
		this.TopPosition+=(screen.height)?Math.floor(Math.random()*((screen.height-this.height)-75)):100;
		}
	if (this.position=="center")
		{
		this.LeftPosition+=(screen.width)?(screen.width-this.width)/2:100;
		this.TopPosition+=(screen.height)?(screen.height-this.height)/2:100;
		}

	if ((this.modal=='yes') && (window.showModalDialog)) 
		{
		configString ='dialogWidth:' + this.width + 'px'
				+ ';dialogHeight:' + this.height + 'px'
				+ ';dialogTop:'  + this.TopPosition + 'px'
				+ ';dialogLeft:' + this.LeftPosition + 'px'
				+ ';resizable:' + this.resizable
				+ ';scroll:' + this.scrollbars
				+ ';status:' + this.status
				;
		resul=showModalDialog(mypage,window,configString);
		//alert(configString);
		}
	else
		{
		configString ='width=' + this.width 
				+ ',height=' + this.height 
				+ ',top='  + this.TopPosition
				+ ',left=' + this.LeftPosition
				+ ',scrollbars=' + this.scrollbars
				+ ',location=' + this.location
				+ ',directories=' + this.directories
				+ ',status=' + this.status
				+ ',menubar='  + this.menubar
				+ ',toolbar=' + this.toolbar
				+ ',resizable=' + this.resizable
				+ ',modal=' + this.modal
					;
		win=window.open(mypage,this.name,configString);
		}
	} 

//---------------------------------------------------------------------------------------------------------
//                                          FIN DE LA  CLASSE
//---------------------------------------------------------------------------------------------------------
}

