/************************************************************************************
@ Author : Nicolas Castelli
@ Mail : nicolas.castelli2@gmail.com
@ Date of creation : 2008-01-01
@ Filename : myLoadingWindow.js
@ Use : Définition de la classe permettant de créer la barre de chargement
************************************************************************************/

// * Classe  : MyLoadingWindow
// * Utilité : définit une fenetre qui s'affiche pour signifier le chargement de fichiers
MyLoadingWindow = function() {
	//**** VARIABLES PRIVÉES
	var id = "";
	//Objet servant d'ancre de positionnement
	//(à savoir position du coin supérieu gauche de la fenetre)
	var idAnchor = "";
	var browser = new Browser();
	//**** VARIABLES PUBLIQUES




	//**** FONCTIONS PRIVÉES
	var getWindowPos = function() {
		var xPos = $(idAnchor).offsetLeft - 40;
		var yPos = $(idAnchor).offsetTop - 10;
		//Evidemment, spécifique pour IE qui fait rien comme les autres
		if(browser.navigator == "Internet Explorer")
		{
			//IE6
			if(browser.navVersion == 6)
			{
				yPos = yPos + 150;
				xPos = $(idAnchor).offsetLeft - 30;
			}
			//IE7 et au-delà
			else if(browser.navVersion >= 7)
			{
				yPos = yPos + 150;
				xPos = $(idAnchor).offsetLeft*2.7;
			}
		}

		var arrPos = new Array(xPos, yPos);
		return arrPos;
	}




	//**** FONCTIONS PUBLIQUES
	//Constructeur
	this.construct = function(idWindows, idAnchorObj) {
		id = idWindows;
		idAnchor = idAnchorObj;
	}

	//Gestion de la barre de chargement : fait apparaître la barre de chargement
	//pour indiquer au visiteur de patienter
	this.show = function() {
		var XYPos = getWindowPos();
		var xPos = XYPos[0];
		var yPos = XYPos[1];
		//Dans le cas d'IE, il faut cacher les combobox, car bien évidemment, elles
		//survolent la DIV ! On cache la sélection de block et celle du deck si elles
		//existent.
		if(browser.navigator == "Internet Explorer")
		{
			var combobox = document.getElementsByTagName("select");
			for(var i=0; i<combobox.length; i++)
			{
				//Ne pas "traiter" la combobox des langues, déjà gérée par ailleurs
				if(combobox[i].id != "LANG")
					combobox[i].className = "hidden";
			}
		}
		$(id).style.top = yPos + 'px';
		$(id).style.left = xPos + 'px';
		$(id).className = "showed";
	}

	//Gestion de la barre de chargement : fait apparaître la barre de chargement
	//pour indiquer au visiteur de patienter
	this.hide = function() {
		$(id).className = "hidden";
		if(browser.navigator == "Internet Explorer")
		{
			var combobox = document.getElementsByTagName("select");
			for(var i=0; i<combobox.length; i++)
			{
				combobox[i].className = "showed";
			}
		}
	}

}//Fin de la classe MyLoadingWindow