function attente_serveur() {
	this.image = 'images_attente_serveur.gif';
	//this.couleur_texte = '#000000';
	//this.couleur_fond = '#FF0000';
	this.couleur_texte = '#000000';
	this.couleur_fond = '#FFFFFF';
	this.largeur = 0;
	this.hauteur = 0;
	
	this.id_local = '';
	//this.div_principal = '';
	//this.div_texte = '';

	this.scrollTop = 0;
	this.scrollLeft = 0;
	
	this.window_x = 0;
	this.window_y = 0;
	this.document_x = 0;
	this.document_y = 0;

	this.taille_min_x = 0;
	this.taille_min_y = 0;

	this.div_x=0;
	this.div_y=0;

	this.getElementByIdPrefix = "";
	
	this.document_in_frame = false;
	
	this.demande_fermer = false;
	this.actualisations = 0;
	
	// Afficher le message d'attente
	this.afficher = function(str_message) {
		var tab_res;
		var str_html;
		var obj_div_plein_ecran;
		
		this.cacher_forcer();
		
		// Generer le id unique
		//if(this.id_local == "") {
			this.id_local = this.random_id();
			eval(this.id_local + " = this;");
		//}
		/*
		// Preparer le HTML qui sera affiche dans la celule
		str_html  = '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
		str_html += '	<tr>';
		if(this.image != '') {
			str_html += '		<td align="center" valign="center">';
			str_html += '			<img src="' + this.image + '" border="0">';
			str_html += '		</td>';
			str_html += '		<td align="center" valign="center">&nbsp;</td>';
		}
		str_html += '		<td align="center" valign="center">' + str_message + '</td>';
		str_html += '	</tr>';
		str_html += '</table>';
		*/
		
		// ################## Preparer le HTML qui sera affiche dans la celule (le message) ########
		str_html  = '<table border="0" width="100%" cellpadding="0" cellspacing="0" style_old="border: #000000 solid 2px; margin: 0px;" >';
		if(this.image != '') {
			str_html += '	<tr>';
			str_html += '		<td align="center" valign="center">';
			str_html += '			<img src="' + this.image + '" border="0">';
			str_html += '		</td>';
			str_html += '	</tr>';
		}
		str_html += '	<tr>';
		str_html += '		<td align="center" valign="center" style="padding:5px;">' + str_message + '</td>';
		str_html += '	</tr>';
		str_html += '</table>';
		
		// ########################################################################################



		// ################## Preparer le tableau global (celui qui contiendra le message) ########
		
		obj_div_main = document.createElement("table");
		obj_div_main.style.position = "absolute";
		obj_div_main.id = this.id_local;	
		obj_div_main.cellPadding = 0;
		obj_div_main.cellSpacing = 0;
		obj_div_main.style.color = this.couleur_texte;
		obj_div_main.style.backgroundColor = this.couleur_fond;
		//obj_div_main.style.border = "#000000 solid 1px";
		//obj_div_main.style.margin = "1px";
		obj_div_main.style.border = "#000000 solid 3px";
		obj_div_main.style.margin = "10px";
		obj_div_main.style.zIndex = 9000;
		obj_div_main.style.display = "";
				
		// Ajouter une ligne
		var obj_ligne = obj_div_main.insertRow(0);

		// Ajouter une cellule
		var obj_cellule = obj_ligne.insertCell(0);
		obj_cellule.align = "center";
		obj_cellule.style.padding = "3px";
		
		// Ajouter le HML dans la cellule
		obj_cellule.innerHTML = str_html;

		// Ajouter le tableau global dans le document
		document.body.appendChild(obj_div_main);
		
		var tab_pos_dim_div = this.lire_dimensions(this.id_local);
		
		document.getElementById(this.id_local).style.top = parseInt(((tab_pos_dim_div["window_width"] - tab_pos_dim_div["width"]) / 2), 10) +  "px";
		
		// ########################################################################################

		
		
		
		// ################## Preparer le div qui va bloquer l'ecran (avec transparence) ########

		obj_div_plein_ecran = document.createElement("div");
		obj_div_plein_ecran.style.position = "absolute";
		obj_div_plein_ecran.id = this.id_local + '_plein_ecran';
		document.body.appendChild(obj_div_plein_ecran);

		document.getElementById(this.id_local + '_plein_ecran').style.backgroundColor = '#999999';
		document.getElementById(this.id_local + '_plein_ecran').style.zIndex = 8999;
		document.getElementById(this.id_local + '_plein_ecran').style.top = '0px';
		document.getElementById(this.id_local + '_plein_ecran').style.left = '0px';
		document.getElementById(this.id_local + '_plein_ecran').style.width = tab_pos_dim_div["window_width"] + 'px';
		document.getElementById(this.id_local + '_plein_ecran').style.height = tab_pos_dim_div["window_height"] + 'px';
		document.getElementById(this.id_local + '_plein_ecran').style.display = 'block';
		document.getElementById(this.id_local + '_plein_ecran').style.filter="alpha(opacity=50)";
		document.getElementById(this.id_local + '_plein_ecran').style.opacity=".5";
		document.getElementById(this.id_local + '_plein_ecran').style.MozOpacity=".5";
		
		innerHTML='<table border="0" width="100%" height="100%">';
		innerHTML+='<tr><td align="center" valign="center">&nbsp;<td><tr>';
		innerHTML+='</table>';
		document.getElementById(this.id_local + '_plein_ecran').innerHTML = innerHTML;
		
		// ########################################################################################

		// Indiquer qu'il n'y a pas de demande de fermeture en cours
		this.demande_fermer = false;
		
		// Initialiser le nombre d'actualisation
		this.actualisations = 0;

		// Re-positionner les elements
		this.maj_position();
		
				
		// Cacher les 'select' et les 'object' + 'applet' (pour certaines version de IE)
		this.cacher_selects();
		this.cacher_objects();

		// Declencher le repositionement tout les 100ms
		eval("int_timeout_attente_serveur_" + this.id_local + " = setInterval(\"" + this.id_local + ".maj_position()\", 100)");
	}

	// Mettre a jour la position du message d'attente (et du div de bloquage de l'ecranc)
	this.maj_position = function () {
		// Recalculer la position actuelle du message (et dimensions de la fenetre)
		var tab_pos_dim_div = this.lire_dimensions(this.id_local);
		
		// Acces au tableau contenant le message
		var obj_div_attente = document.getElementById(this.id_local);
		
		// Acces au div de bloquage
		var obj_div_attente_plein_ecran = document.getElementById(this.id_local + '_plein_ecran');

		// Repositionner le message (pour qu'il reste au milieu de la fenetre)
		try {
			obj_div_attente.style.left = parseInt(((tab_pos_dim_div["window_width"] - tab_pos_dim_div["width"]) / 2), 10) + tab_pos_dim_div["scroll_width"] + "px";
			
			obj_div_attente.style.top = (parseInt(((tab_pos_dim_div["window_height"] - tab_pos_dim_div["height"]) / 2), 10) + tab_pos_dim_div["scroll_height"] + 1) + 'px';
			
			obj_div_attente.style.display = "";
		}
		catch(e) {
		}

		// Redimensionner le bloqueur (pour qu'il utilise toute la fenetre)
		try {
			obj_div_attente_plein_ecran.style.width = (tab_pos_dim_div["window_width"] + tab_pos_dim_div["scroll_width"]) + 'px';
			obj_div_attente_plein_ecran.style.height = (tab_pos_dim_div["window_height"] + tab_pos_dim_div["scroll_height"]) + 'px';
		}
		catch(e) {
		}
		
		// Incrementer le nombre d'actialisation
		this.actualisations++;
		
		// Verifier si il y a eu une demande de fermeture
		// Et ne pas fermer tout de suite. Attendre 300ms
		if(this.demande_fermer && this.actualisations > 3) {
			this.cacher_forcer();
		}
	}

	// Cacher le message d'attente (demande de fermeture)
	this.cacher = function () {
		this.demande_fermer = true;
	}
	
	// Cacher reelement le message d'attente
	this.cacher_forcer = function () {
		var obj_div_attente;
		
		// Montrer les 'select' et les 'object' + 'applet' (pour certaines version de IE)
		this.montrer_selects();
		this.montrer_objects();
			
		if(this.id_local != "") {
			
			// Cacher le message
			obj_div_attente = document.getElementById(this.id_local);
			try {
				eval(" res = clearInterval(int_timeout_attente_serveur_" + this.id_local + ");");
				document.body.removeChild(obj_div_attente);
			}
			catch(e) {
			}
			
			// Cacher le bloqueur
			obj_div_attente_plein_ecran = document.getElementById(this.id_local + '_plein_ecran');
			try {
				document.body.removeChild(obj_div_attente_plein_ecran);
			}
			catch(e) {
			}
				
		}
	}


	this.cacher_selects = function () {
		var nom, les_select, un_select;
		eval('les_select=' + this.getElementByIdPrefix + 'document.getElementsByTagName("select")');
		for(nom in les_select) {
			eval('un_select=' + this.getElementByIdPrefix + 'document.getElementById(nom)');
			if(un_select) {
				un_select.style.visibility="hidden";
			}
		}
	}


	this.montrer_selects = function () {
		var nom, les_select, un_select;
		eval('les_select=' + this.getElementByIdPrefix + 'document.getElementsByTagName("select")');
		for(nom in les_select) {
			eval('un_select=' + this.getElementByIdPrefix + 'document.getElementById(nom)');
			if(un_select) {
				un_select.style.visibility="visible";
			}
		}
	}
	
	this.cacher_objects = function(){
		var objs, i;
  		if (document.getElementsByTagName) {
    		// Recuperer tous les object avec tag 'object'.
      		eval('var objs = ' + this.getElementByIdPrefix + 'document.getElementsByTagName("object")');
      		for (i=0; i<objs.length; i++) {
				objs[i].style.visibility="hidden";
      		}
    		// Recuperer tous les object avec tag 'applet'.
      		eval('var objs = ' + this.getElementByIdPrefix + 'document.getElementsByTagName("applet")');
      		for (i=0; i<objs.length; i++) {
				objs[i].style.visibility="hidden";
      		}
  		}
	}


	this.montrer_objects = function(){
		var objs, i;
  		if (document.getElementsByTagName) {
    		// Recuperer tous les object avec tag 'object'.
      		eval('var objs = ' + this.getElementByIdPrefix + 'document.getElementsByTagName("object")');
      		for (i=0; i<objs.length; i++) {
				objs[i].style.visibility="visible";
      		}
    		// Recuperer tous les object avec tag 'applet'.
      		eval('var objs = ' + this.getElementByIdPrefix + 'document.getElementsByTagName("applet")');
      		for (i=0; i<objs.length; i++) {
				objs[i].style.visibility="visible";
      		}
  		}
	}



	// Generer un id unique
	this.random_id = function () {
		var str_available_char = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
		var i;
		var str_id = "";
		var int_pos;
		for(i=1;i<=32;i++) {
			int_pos = Math.floor((16)*Math.random()) + 0;
			str_id += str_available_char[int_pos];
		}
		return("_" + str_id);
	}
	
	// Lire la position d'un objet ainsi que les dimensions de la fenetre et du document
	// Valeurs retournees :
	//		- tab["left"] : x position of the object
	//		- tab["top"] : y position of the object
	//		- tab["width"] : width of the object
	//		- tab["height"] : height of the object
	//		- tab["window_width"] : width of the window		
	//		- tab["window_height"] : height of the window		
	//		- tab["document_width"]	 : width of the document	
	//		- tab["document_height"] : height of the document		
	//		- tab["scroll_width"] : x scroll position
	//		- tab["scroll_height"] : y scroll position
	this.lire_dimensions = function (id) {
		var curleft = curtop = 0;
		var res=Array();
		
		var curleft = curtop = 0;
		var res=Array();
		
		var window_x;
		var window_y;
		var document_x;
		var document_y;
		var scroll_x;
		var scroll_y;
		
		if(id != "") {
			obj =document.getElementById(id);
	
			if(obj) {
				if (obj.offsetParent) {
					try {
						curleft_tmp = obj.offsetLeft;
					}
					catch(e) {
						curleft_tmp = 0;
					}
					curleft = curleft_tmp;
					try {
						curtop_tmp = obj.offsetTop;
					}
					catch(e) {
						curtop_tmp = 0;
					}
					curtop = curtop_tmp;
					valid = true;
					try {
						obj = obj.offsetParent;
					}
					catch(e) {
						valid = false;
					}
					
					while (valid) {
			
						try {
							curleft_tmp = obj.offsetLeft;
						}
						catch(e) {
							curleft_tmp = 0;
						}
						try {
							curtop_tmp = obj.offsetTop;
						}
						catch(e) {
							curtop_tmp = 0;
						}
			
			
						curleft += curleft_tmp;
						curtop += curtop_tmp;
						
						try {
							obj = obj.offsetParent;
						}
						catch(e) {
							valid = false;
						}
			
					}
				}
				
				try {
					var html_elemento = document.getElementById(id);
					curwidth = parseInt(html_elemento.offsetWidth,10);
				}
				catch(e) {
					curwidth = 0;
				}
				
				try {
					var html_elemento = document.getElementById(id);
					curheight = parseInt(html_elemento.offsetHeight,10);
				}
				catch(e) {
					curheight = 0;
				}
				
				try {
					
					if (navigator.appName == "Microsoft Internet Explorer"){
						window_x = document.body.clientWidth;
						window_y = document.body.clientHeight;
						document_x = document.body.clientWidth;
						document_y = document.body.clientHeight;
						if(window_x == 0) {
							window_x = document.documentElement.clientWidth;
							window_y = document.documentElement.clientHeight;
							document_x = document.body.clientWidth;
							document_y = document.body.clientHeight;		
						}
					} else {
						window_x = document.documentElement.clientWidth;
						window_y = document.documentElement.clientHeight;
						document_x = document.body.clientWidth;
						document_y = document.body.clientHeight;		
					}
					
					//alert("window_x=" + this.window_x);
				}
				catch(err) {
					window_x = 0;
					window_y = 0;
					document_x = 0;
					document_y = 0;
				}
			} else {
				window_x = 0;
				window_y = 0;
				document_x = 0;
				document_y = 0;
			}
		} else {
			window_x = 0;
			window_y = 0;
			document_x = 0;
			document_y = 0;
		}
		
		// Get maximum x dimension
		if(window_x>document_x) {
			res["window_width"]=document_x;
			res["document_width"]=window_x;
		} else {
			res["window_width"]=window_x;
			res["document_width"]=document_x;
		}
	
		// Get maximum y dimension
		if(window_y>document_y) {
			res["window_height"]=document_y;
			res["document_height"]=window_y;
		} else {
			res["window_height"]=window_y;
			res["document_height"]=document_y;
		}		
		
		// Calcul de la hauteur de la fenetre (multi-navigateur)
		var windowHeight
		if (self.innerHeight) {// all except Explorer
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowHeight = document.body.clientHeight;
		}
		res["window_height"]=windowHeight;
		
		// Calcul de la largeur de la fenetre (multi-navigateur)
		var windowWidth
		if (self.innerWidth) {// all except Explorer
			windowWidth = self.innerWidth;
		} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
		}
		res["window_width"]=windowWidth;
		
		// Recuperer la position des ascenseurs
		if (navigator.appName == "Microsoft Internet Explorer"){
			scroll_x = document.documentElement.scrollLeft;
			if(scroll_x == 0) {
				scroll_x = document.body.scrollLeft;
			}
			scroll_y = document.documentElement.scrollTop;
			if(scroll_y == 0) {
				scroll_y = document.body.scrollTop;
			}
		} else { 
			scroll_x = window.pageXOffset; 
			scroll_y = window.pageYOffset; 
		}
		
		// Envoyer les donnees
		res["left"]=curleft;
		res["top"]=curtop;
		res["width"]= parseInt(curwidth,10);
		res["height"]= parseInt(curheight,10);
		res["scroll_width"] = scroll_x;
		res["scroll_height"] = scroll_y;
		
		return res;
	}	
	
}