/*============================================================================================
 Fichier Javascript
 Fichier contenant divers animations Generique

 AUTEUR:					Alban BALLIEUX
 CREATION:					07/07/2008
 VARIABLE GLOBALES:				
 MODIFICATIONS:				
===============================================================================================
	copyright 2009 Alban BALLIEUX - ballieuxa@laon.noirot
	http://www.phpmyportal.info

	This file is part of phpMyPortal.

    phpMyPortal is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    any later version.

    phpMyPortal is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with phpMyPortal; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===============================================================================================*/
/**
 * 
 * @param {Object} id		
 * @param {Object} nbcol
 * 
 * @return		void
 *//* Mis en commentaire parce que non utilisé
function cache_col(id,nbcol){
	PtId=GetPtId(id);
	if (!isset(PtId))	return '';
	TTR=PtId.getElementsByTagName('TR');
	if (TTR.length==0) return '';
	for (i=0;i<TTR.length;i++){
		TTD=TTR[i].getElementsByTagName('TD');
		if (isset(TTD[nbcol])){
			if (TTD[nbcol].style.display == 'block'){
				TTD[nbcol].style.display='none';
			}else{
				TTD[nbcol].style.display='block';
			}
		}
	}
}*/

/**
 * Methode permettant de faire un fondu sur un objet identifier
 * Fonction qui s'auto appelle pour faire disparaitre un element de la page
 * 
 * @param {string} 	Id		Identifiant de l'element a faire disparaitre
 * @param {int} 	opa		Taux d'apparition
 * @param {string} 	fnDisp	Code javascript executé après avec fait une disparition
 * 
 * @return ''
 */
function disparition(Id,opa,fnDisp){
// Initialisation des variables
	if (!isset(fnDisp)) fnDisp = '';
	if (Opacity!=false) return;
	if (opa>0){
		opa=opa-10;
		ChangeOpac(Id,opa);
	// Relancement de la fonction toute les 20 milliseconde
		setTimeout("disparition('" + Id + "'," + opa + ",'" + fnDisp + "')", 20);
	}else{
	// Je cache l'element
		GetPtId(Id).style.display=='none';
	// Execution du code de fin
		eval(fnDisp);
	}
	return;
}

/**
 * Methode permettant de faire un fondu sur un objet identifier
 * Fonction qui s'auto appelle pour faire apparaitre un element de la page
 * 
 * @param {string} 	Id		Identifiant de l'element a faire disparaitre
 * @param {int} 	opa		Taux d'apparition
 * @param {string} 	fnDisp	Code javascript executé après avec fait une disparition
 */
function apparition(Id,opa,fnDisp){
// Initialisation des variables
	if (!isset(fnDisp)) fnDisp = '';
	if (Opacity!=false) return;
	if (opa<100){
		opa=opa+10;
		ChangeOpac(Id,opa);
	// Relancement de la fonction toute les 20 milliseconde
		setTimeout("disparition('" + Id + "'," + opa + ",'" + fnDisp + "')", 20);
	}else{
	// Je cache l'element
		GetPtId(Id).style.display=='none';
	// Execution du code de fin
		eval(fnDisp);
	}
	return;
}

/**
 * Changement de la taille d'un élément appellé récurssivement pour avoir un effet d'agrandissement
 * Utilisé dans dhtml.js (modifBarreProgression)
 * 
 * @param {string} 	id		Identifiant de l'element
 * @param {int} 	W		Largeur final
 * @param {int} 	H		Hauteur final
 * @param {int} 	V		Vitesse
 */
function ModifTaillePrct(id,W,H,V){
// Récupération de l'objet à manipuler
	PtId=GetPtId(id);
	idW=parseInt(PtId.style.width);
	idH=parseInt(PtId.style.height);
	
	if(W != -1){
		if(idW<W){
			PtId.style.width=(idW+1)+'%';
		}else{
			PtId.style.width=(idW-1)+'%';
		}
	}
	if(H != -1){
		if(idH<H){
			PtId.style.height=(idH+1)+'%';
		}else{
			PtId.style.height=(idH-1)+'%';
		}
	}
	if (idW!=W&idH!=H){
		setTimeout("ModifTaillePrct('" + id + "'," + W + "," + H + ","+V+ ")", V);
	}
	return;
}
/**
 * Fait defiler une div vers le bas
 * AfficheContextMenu
 * 
 * @param {string} 	idDiv		Identifiant de la zone à mettre à jour
 * @param {int} 	Position	Position de la div (Y)
 * @param {int} 	Limite		position limite
 * @param {int} 	Pas			Pas de déplacement
 */
function Descend_Div(idDiv,Position,Limite,Pas){
	if(!isset(Pas))Pas = 1 ;
	Div = GetPtId(idDiv);
	if(Div!=false && Position<=Limite){
		Position=Position+Pas;	
		Div.style.top=Position+'px';
		if(Position+Pas>Limite){
			Pas = Limite - Position ;
		}
		if (Position < Limite) {
			setTimeout("Descend_Div('" + idDiv + "'," + Position + "," + Limite + "," + Pas + ")", 10);
		}
	}
}
