function classPopUp(){

	this.allPopup=[[],[]];
	
	//Création d'un tableau de pop 
	this.Set_allPopup = function(nom){
				this.allPopup[0][this.allPopup[0].length]=nom;
				this.allPopup[1][this.allPopup[1].length]=eval("window."+nom);	
	}
	//Recupère variable associée
	this.GetVariable = function(nom){
		for(var i=0;i<this.allPopup[1].length;i++){
				if(this.allPopup[0][i] == nom){
					return i;
				}	
		}
		this.Set_allPopup(nom);
		return false;
	}
	/** Positionne la PoPup
			Nom est le nom de la pop up
		*/
	this.setPosition = function (nom,x,y){
		this.allPopup[1][this.GetVariable(nom)].moveTo(x,y);
	}
	
	/** Retaille la PoPup
			Nom est le nom de la pop up
		*/
	this.setTaille = function (nom,x,y){
		this.allPopup[1][this.GetVariable(nom)].resizeTo(x,y);
	}
	
	//Cacule la position centre
	this.setPositionCenter = function (nom,longueur,hauteur){
		var x = (typeof(_globalEcranX) != "undefined")? parseInt(_globalEcranX): 800 ;
		var y = (typeof(_globalEcranY) != "undefined")? parseInt(_globalEcranY) : 600 ;
		this.setPosition(nom,((x/2)-(longueur/2)),((y/2)-(hauteur/2)))
	}
	//Affichage d'une pop Up
	this.SetPop = function(nom,url,longueur,hauteur,my_s,my_status,my_resize,set_Focus,set_Position){
		if(typeof(this.allPopup[1][this.GetVariable(nom)]) == 'object' &&  !this.allPopup[1][this.GetVariable(nom)].closed && set_Focus){
			this.allPopup[1][this.GetVariable(nom)].focus();
		}else{
			var tlocation = (_globalDebug==true)? 1 :  0;
			var ttoolbar = (_globalDebug==true)? 1 : 0;
			var tlocation = (_globalDebug==true)? 1 : 0;
			var tstatus = (_globalDebug==true)? 1 :  my_status;
			var tmenubar = (_globalDebug==true)? 1 :  0;
			var tscrollbars = (_globalDebug==true)? 1 :  my_s;
			var tresizable = (_globalDebug==true)? 1 :  my_resize;
			this.allPopup[1][this.GetVariable(nom)]=window.open(url,nom,"width="+longueur+",height="+hauteur+",scrollbars="+tscrollbars +",toolbar="+ttoolbar+",location="+tlocation+",status="+tstatus+",menubar="+tmenubar+",resizable="+tresizable);
			this.allPopup[1][this.GetVariable(nom)].focus();
		}
		if(set_Position==true){ this.setPositionCenter(nom,longueur,hauteur);}
	}
	//Ferme une pop up
	this.closePop = function(nom){
		var temp =[[],[]];
		for(var i=0;i<this.allPopup[1].length;i++){
			if(this.allPopup[0][i] == nom){
				this.allPopup[1][i].close();	
			}else{
				temp[0][temp[0].length] = this.allPopup[0][i];
				temp[1][temp[1].length] = this.allPopup[1][i];
			}
		}
		this.allPopup = temp;
	}
	//Ferme toutes les pop up
	this.closeall = function(){
		for(var i=0;i<this.allPopup[1].length;i++){
			if(typeof(this.allPopup[1][i])=='object' && !this.allPopup[1][i].closed){
				if(typeof(this.allPopup[1][i].Popup)=='object'){
					this.allPopup[1][i].Popup.closeall();
				}
				this.allPopup[1][i].close();			
			}
		}
		this.allPopup=[[],[]];
	}
	
	this.exist = function(nom){
		for(var i=0;i<this.allPopup[1].length;i++){
			if(this.allPopup[0][i]==nom && typeof(this.allPopup[1][i])=='object' && !this.allPopup[1][i].closed){
				return true;
			}
		}
		return false;
	}
	
	// en cours de creation
	this.recharge = function(nom){
		for(var i=0;i<this.allPopup[1].length;i++){
			if(this.allPopup[0][i]==nom){
				this.allPopup[1][i].recharge();
			}
		}
	}
	
	this.setfocus = function(nom){
		for(var i=0;i<this.allPopup[1].length;i++){
			if(this.allPopup[0][i]==nom){
				this.allPopup[1][i].focus();
			}
		}
	}
}
