/**********************************************************************************************************************
	LISTE DES FONCTIONS JS
	Création : JCB 06/05/2009
	Modifications :
**********************************************************************************************************************/
RedimensionneDivs = function(){
	var HBody = document.body.offsetHeight;
	var LBody = document.body.offsetWidth;
	$('CONTENEUR').setStyle({ 'height' : ( HBody - 50 ) + 'px' });
	$('CACHE').setStyle({ 'height' : HBody + 'px', 'width' : LBody + 'px' });
	$('PRINCIPAL').setStyle({ 'height' : ( HBody - 50 - 20 - 30 - 120 - 50 ) + 'px' });
}
/* Message d'attente */
var WaitMessage
WaitMessage	=	'<table width="99%" height="99%">';
WaitMessage	+=	'<tr><td align="center" valign="middle" style="color:#999;" class="A10">';
WaitMessage	+=	'<img src="/images/wait.gif" align="absmiddle" style="margin-right:5px">Chargement en cours...';
WaitMessage	+=	'</td></tr></table>';

function Wait(DivDest, TexteAttente) {
	if ( !TexteAttente || TexteAttente=='' ) TexteAttente = WaitMessage;
	$(DivDest).innerHTML = TexteAttente;
}

DebutLoading = function (Texte) {
	var WaitMessageTexte;
	!Texte ? Texte = 'Traitement en cours...' : false;
	WaitMessageTexte  =	'<table width="100%" height="100%" class="cadre_gris_blanc">';
	WaitMessageTexte +=	'<tr><td align="center" valign="middle" style="color:#999;" class="A10">';
	WaitMessageTexte +=	'<img src="/images/wait.gif" align="absmiddle" style="margin-right:5px">'+Texte;
	WaitMessageTexte +=	'</td></tr></table>';
	var L = document.body.scrollWidth
	var HO = document.body.scrollHeight
	if ( document.body.scrollHeight <= document.body.offsetHeight ) 
	HO = document.body.offsetHeight
	//---- Fabrique et affiche un Cache
	var cache = Builder.node('div', {
	  id: 'new_cache',
	  style: 'position: absolute; z-index:100; top:0; left:0; width:' + L + 'px' + '; height:' + HO + 'px' + '; background:#000; display:none;'
	});
	document.body.appendChild(cache);
	$('new_cache').appear({duration:0.3, from:0, to:0.5});
	//---- Fabrique et affiche un cadre d'info
	var wait = Builder.node('div', {
	  id: 'new_wait',
	  style: 'position:absolute; z-index:101; top:10px; left:50%; margin:-90px 0 0 200px; width:250px; height:40px; border:0px solid #CCC; display:none;'
	});
	document.body.appendChild(wait);
	$('new_wait').setStyle({
		top: (document.body.scrollTop+100) + 'px'
	});
	$('new_wait').innerHTML = WaitMessageTexte;
	$('new_wait').appear({duration:0.3, from:0, to:1});
}

FinLoading = function () {
	$('new_wait').fade({duration:0.3, delay:0.3, to:0, from:0.9});
	$('new_cache').fade({duration:0.3, delay:0.4, to:0, from:0.7});
}

SelectEtape = function (numEtape, theme) {
	var bt_etapes = $$('.MENU2_BT');
	bt_etapes.each( function (elt) {
				  	elt.setStyle({
						'backgroundImage': 'url(css/' + theme + '/bt_menu2_190x30.png)',
						'color': '#000'
					});
				  });
	$('BT_ETAPE_' + numEtape).setStyle({
				'backgroundImage': 'url(css/' + theme + '/bt_menu2_190x30_selected.png)',
				'color': '#FFF'
			});
}