var navigateur;
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var dom = (document.getElementById)? true:false;
if (ie4)
	navigateur	=	"ie";
else if (ns4)
	navigateur	=	"ns";
else if (dom)
	navigateur	=	"dom";

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

function update_checkbox(aCheckboxId)
{
	if (document.getElementById(aCheckboxId).checked)
		document.getElementById(aCheckboxId).checked	=	false;
	else
		document.getElementById(aCheckboxId).checked	=	true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var existe_option	=	true;
	if (features == undefined)
	{
		features		=	"";
		existe_option	=	false;
	}
	
	if (features == "" && existe_option)
	{
		features	=	'center';
		features	+=	',width=500';
		features	+=	',height=600';
		features	+=	',scrollbars=yes';
	}
	
	if (features.substring(0, 7) == "center,")
	{
		features			=	features.substring(7);
		var index_width		=	features.indexOf("width=");
		var index_height	=	features.indexOf("height=");
		var win_width, win_height, win_left, win_top;

		if (index_width == -1)
		{
			alert(1);
			win_width	=	500;
		}
		else
		{
			var index_right		=	index_width + 6;
			
			if (features.indexOf(",", index_right) == -1)
				win_width	=	features.substring(index_right);
			else
				win_width	=	features.substring(index_right, features.indexOf(",", index_right));
			
			if (win_width == "max")
			{
				win_width	=	screen.width;
				features	=	features.replace("width=max", "width=" + win_width);
			}
		}
		
		if (index_height == -1)
		{
			win_height	=	600;
		}
		else
		{
			var index_right		=	index_height + 8;
			if (features.indexOf(",", index_right) == -1)
				win_height	=	features.substring(index_right);
			else
				win_height	=	features.substring(index_right, features.indexOf(",", index_right));
			if (win_height == "max")
			{
				win_height	=	screen.height;
				features	=	features.replace("height=max", "height=" + win_height);
			}
		}
		
		win_left	=	(screen.width - win_width) / 2;
		win_top		=	(screen.height - win_height) / 2;
		features	+=	',left=' + win_left + ',top=' + win_top;
	}
	
	popup	=	window.open(theURL,winName,features);
	if(popup.window.focus)
	{
		popup.window.focus();
	}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goto_page(page)
{
	var obj_form		=	MM_findObj("frm_naviagation");
	
	obj_form.action		=	page;
	var args 			=	goto_page.arguments;
	var target_existe	=	false;
	var add_input		=	"";
	for (i=1; i < args.length; i+=2)
	{
		if (args[i] == "target")
		{
			obj_form.target	=	args[i+1];
			target_existe	=	true;
		}
		else
		{
			var p = document.createElement("input");
			p.name	=	args[i];
			p.id	=	args[i];
			p.type	=	"hidden";
			p.value	=	args[i+1];
			obj_form.appendChild(p);
		}
	}
	
	if (!target_existe)
		obj_form.target	=	"";
	obj_form.submit();
}

function MM_validateForm() { //v4.0
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments, amin=1500, amax=2050, separateur="/";
	
	if (args.length == 1)
		if (typeof(args[0]) == "object")
			args	=	args[0];

	for (i=0; i<(args.length-2); i+=3)
	{
		test	=	args[i+2];
		val		=	MM_findObj(args[i]);
		
		if (test == "RChecked")
		{
			if (!val.checked)
				errors += '- ' + args[i+1] + '\n';
		}
		if (test == "RSup0")
		{
			if (val.value == 0)
				errors += '- ' + args[i+1] + ' est obligatoire.\n';
		}
		if (test == "REnum")
		{
			isSelected	=	false;
			for(j=0; j<2; j++) 
				if (val[j].checked == true)
					isSelected	=	true;
			if (!isSelected)
				errors += '- '+args[i+1] + ' est obligatoire.\n';
		}
		else
		{
			if (val)
			{
				nm=val.name;
				if ((val=val.value)!="")
				{
					if (test.indexOf('isEmail')!=-1)
					{
						p=val.indexOf('@');
						if (p<1 || p==(val.length-1))
							errors+='- ' + args[i+1] + ' doit être une adresse EMail.\n';
					}
					else if (test.indexOf('isDate')!=-1)
					{
						//****************
						/*
						var d=val;
						var j=(d.substring(0,2));
						var m=(d.substring(3,5));
						var a=(d.substring(6));
						var ok=1;
						if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) { 
						errors += '- '+args[i+1]+' (Le jour n\'est pas correct).\n'; ok=0; }
						if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) { 
						errors += '- '+args[i+1]+' (Le mois n\'est pas correct).\n'; ok=0;  }
						if ( ((isNaN(a))||(a<amin)||(a>amax)) && (ok==1) ) { 
						errors += '- '+args[i+1]+' (Le année n\'est pas correct).'; ok=0;  }
						if ( ((d.substring(2,3)!=separateur)||(d.substring(5,6)!=separateur)) 
						&& (ok==1) ) { errors += '- '+args[i+1]+' (Les séparateurs doivent être des \''+separateur+'\').\n'; ok=0; }
						if (ok==1)
						{ 
							var d2=new Date(a,m-1,j); 
							j2=d2.getDate();
							m2=d2.getMonth()+1;
							a2=d2.getYear();
							
							//if (a2<=100) {a2=1900+a2;}
							a2=1900+a2;
							//alert("Jours : "+j+" - "+j2+"\nMois : "+m+" - "+m2+"\nAnnée : "+a+" - "+a2+"\n");
							if ( (j!=j2)||(m!=m2)||(a!=a2) )
							{
								//alert("nono");
								errors += '- '+args[i+1]+' (La date \''+d+'\' n\'existe pas !).\n';
							} 
						} 
						*/
						//****************
					}
					else if (test.indexOf('isHeure')!=-1)
					{
						/*
						var	heure_complet	=	val.explode(":");
						var heure			=	heure_complet[0];
						if ((isNaN(heure)) || (heure<0)||(heure>23))
							errors += '- '+args[i+1]+' (L\'heure n\'est pas correct).\n';
						if (heure_complet.length == 2)
						{
							var minute			=	heure_complet[1];
							if ((isNaN(minute)) || (minute<0)||(minute>59))
								errors += '- '+args[i+1]+' (Les minutes ne sont pas correct).\n';
						}
						if (heure_complet.length == 3)
						{
							var seconde			=	heure_complet[2];
							if ((isNaN(seconde)) || (seconde<0)||(seconde>59))
								errors += '- '+args[i+1]+' (Les secondes ne sont pas correct).\n';
						}
						*/
					}
					else if (test!='R' && test != 'RChecked')
					{
						num = parseFloat(val);
						if (isNaN(val))
							errors+='- ' + args[i+1] + ' doit être un nombre.\n';
						if (test.indexOf('inRange') != -1)
						{
							p=test.indexOf(':');
							min=test.substring(8,p);
							max=test.substring(p+1);
							if (num<min || max<num)
								errors+='- '+args[i+1]+' doit être un nombre compris entre ' + min + ' et ' + max + '.\n';
						}
					}
				}
				else if (test.charAt(0) == 'R' && test != 'RChecked')
					errors += '- '+args[i+1] + ' est obligatoire.\n';
			}
		}
	}
  
  if (errors)
  	alert('Les erreurs suivantes ont été détecté :\n' + errors);
  document.MM_returnValue = (errors == '');
}

// Info bulle *****************
function setInfo(aTitre, aMessage)
{
	document.getElementById("td_titre").innerHTML	=	aTitre;
	document.getElementById("td_message").innerHTML	=	aMessage;
}

function afficherInfoBulle(aObjet)
{
	var decalage_x		=	aObjet.offsetWidth;
	var decalage_y		=	aObjet.offsetHeight;
	var DivLeft			=	0;
	var DivTop			=	0;

	if (dom)
	{
		DivLeft = getLeft(aObjet) + decalage_x;
		DivTop = getTop(aObjet) + decalage_y;
		document.getElementById("div_info_bulle").style.left = DivLeft + "px";
		document.getElementById("div_info_bulle").style.top = DivTop + "px";
		document.getElementById("div_info_bulle").style.display = "";
	}
	else if (ie4)
	{
		DivLeft = getLeft(aObjet) + decalage_x;
		DivTop = getTop(aObjet) + decalage_y;
		document.all["div_info_bulle"].style.posLeft = DivLeft;
		document.all["div_info_bulle"].style.posTop = DivTop;
		document.all["div_info_bulle"].style.display = "";
	}
	else if (ns4)
	{
		DivLeft = aObjet.x + decalage_x;
		DivTop = aObjet.y + decalage_y;
		document.layers["div_info_bulle"].pageX = DivLeft;
		document.layers["div_info_bulle"].pageY = DivTop;
		document.layers["div_info_bulle"].display = "";
	}
}

function cacherInfoBulle()
{
	if (dom)
	{
		document.getElementById("div_info_bulle").style.left = "0px";
		document.getElementById("div_info_bulle").style.top = "0px";
		document.getElementById("div_info_bulle").style.display = "none";
	}
	else if (ie4)
	{
		document.all["div_info_bulle"].style.posLeft = 0;
		document.all["div_info_bulle"].style.posTop = 0;
		document.all["div_info_bulle"].style.display = "none";
	}
	else if (ns4)
	{
		document.layers["div_info_bulle"].pageX = 0;
		document.layers["div_info_bulle"].pageY = 0;
		document.layers["div_info_bulle"].display = "none";
	}
}

function getLeft(MyObject)
{
	if (MyObject.offsetParent)
		return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
	else
		return (MyObject.offsetLeft);
}

function getTop(MyObject)
{
	if (MyObject.offsetParent)
		return (MyObject.offsetTop + getTop(MyObject.offsetParent));
	else
		return (MyObject.offsetTop);
}
// ****************************

//function explode(aStringSeparateur, aString)
String.prototype.explode = function(aStringSeparateur)
{
	var aString			=	this.trim();
	if (aString == "")
		return -1;
	var	lst_occurence	=	new Array();
	var old_index		=	0;
	var	current_index	=	0;
	
	for(i=0;i<aString.length;i++)
	{
		if (aString.substr(i, aStringSeparateur.length) == aStringSeparateur)
		{
			lst_occurence.push(aString.substring(old_index, i));
			old_index		=	i + aStringSeparateur.length;
		}
	}
	lst_occurence.push(aString.substr(old_index));
	/*
	if (lst_occurence.length == 1)
		return lst_occurence[0];
	else
		return lst_occurence;
	*/
	return lst_occurence;
}

String.prototype.sans_accents = function()
{
	var ch = this.replace(/é|è|ê|ë/g, "e");
	ch = ch.replace(/à|â|ä/g, "a");
	ch = ch.replace(/ç/g, "c");
	ch = ch.replace(/î|ï/g, "i");
	ch = ch.replace(/ô|ö/g, "o");
	ch = ch.replace(/ù|û|ü/g, "u");
	ch = ch.replace(/À|Â|Ä|Å/g, "A");
	ch = ch.replace(/Ç/g, "C");
	ch = ch.replace(/É|È|Ê|Ë/g, "E");
	ch = ch.replace(/Ô|Ö/g, "O");
	ch = ch.replace(/Ù|Û|Ü/g, "U");
	return ch;
}

String.prototype.epurer = function()
{
	var chaine		=	this;
	var nb_char		=	chaine.length;
	var str_value	=	"abcdefghijklmnopqrstuvwxyz0123456789_";
	var str_temp	=	"";
	var lettre		=	"";
	var valeur		=	"";
	
	for(i = 0; i < nb_char; i++)
	{
		lettre		=	chaine.substr(i, 1);
		valeur		=	str_value.indexOf(lettre, 0);
		if (valeur != -1)
			str_temp	+=	lettre;
	}
	return str_temp;
}

String.prototype.trim = function()
{
	return this.replace(/ /g, "");
}

function show_div(aDiv, aValue)
{
	if (aValue)
		MM_findObj(aDiv).style.display	=	'block';
	else
		MM_findObj(aDiv).style.display	=	'none';
}

function show_div_alternate(aDiv)
{
	if (MM_findObj(aDiv).style.display == 'block')
		MM_findObj(aDiv).style.display	=	'none';
	else
		MM_findObj(aDiv).style.display	=	'block';
}

function getPageSize(){
    
    var xScroll, yScroll;
    
    if (window.innerHeight && window.scrollMaxY) {    
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    
    var windowWidth, windowHeight;
    if (self.innerHeight) {    // all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }    
    
    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){    
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }


    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
    return arrayPageSize;
}

window.onload = function ()
{
	//MM_preloadImages("images/fond.jpg", "images/fond_degrader.jpg");
}

// Popup ********************************************************************
function afficher_chargement()
{
	var div_contenu	=	document.getElementById('div_contenu');
	div_contenu.innerHTML	=	'<table style="width:120px; height:50px; background-color:#FFFFFF; border:1px #999999 solid;" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td valign="middle" style="width:30px;" align="center"><img src="images/loading.gif" alt="Patientez..." /></td><td valign="middle"><span class="texte_gris">Patientez...</span></td></tr></table>';
	
	var div_fenetre	=	document.getElementById('div_fenetre');
	centrerDiv(div_fenetre);
	div_fenetre.style.display	=	"block";
	
	var div_masque	=	document.getElementById('div_masque');
	new Effect.Appear(div_masque, { duration: 0, from: 0.0, to: 0.5 });
}

function cacher_chargement()
{
	var div_contenu	=	document.getElementById('div_contenu');
	div_contenu.innerHTML	=	"";
	
	var div_fenetre	=	document.getElementById('div_fenetre');
	div_fenetre.style.display	=	"none";
	
	var div_masque	=	document.getElementById('div_masque');
	new Effect.Fade(div_masque, { duration: 0});
}

function afficher_popup(aFenetre, aId)
{
	xajax_afficher_popup(aFenetre, aId);
	return false;
}

var div_masque	=	null;
function ouvrir_fenetre(id_fenetre)
{
	// Calcul du scroll top pour positioner la fenetre
	var effets_scriptaculous	=	false;
	if (div_masque == null)
		effets_scriptaculous	=	true;

	if(!document.getElementById('div_masque'))
	{
		div_masque = document.createElement("div");
		div_masque.setAttribute('id','div_masque');
		div_masque.style.display = 'none';
	}
	else
	{
		div_masque	=	document.getElementById('div_masque');
	}

	var db	=	document.documentElement.clientWidth;
	var D	=	document;
	db		=! 	D.documentElement.clientWidth ? D.body : D.documentElement //quirk IE6
	var gk	=	window.Event ? 1 : 0//Gecko;
	var sy	=	gk ? document.documentElement.scrollTop : db.scrollTop;  

	var arrayPageSize 			=	getPageSize();
	var div_fenetre				=	document.getElementById("div_fenetre");
	div_masque.style.width		=	arrayPageSize[0]+'px';
	div_masque.style.height		=	arrayPageSize[1]+'px';
	
	// Effets scriptaculous
	if (effets_scriptaculous)
		new Effect.Appear(div_masque, { duration: 0.2, from: 0.0, to: 0.8 });
	
	centrerDiv(div_fenetre);

	div_fenetre.style.display	=	"block";
}

function fermer_fenetre()
{
	new Effect.Fade(div_masque, { duration: 0.2, from: 0.8, to: 0.0 });
	var div_fenetre				=	document.getElementById("div_fenetre");
	div_fenetre.style.display	=	"none";
	div_masque					=	null;
}

function centrerDiv(div)
{
	var Scroll	=	getScroll();
	ScrollX		=	Scroll[0];
	ScrollY		=	Scroll[1];
	
	var size	=	getViewPortSize();
	width		=	size[0];
	height		=	size[1];
	
	if(div.style.height == '')
		var divHeight	=	getStyle(div, 'height');
	else
		var divHeight	=	div.style.height;
	if(div.style.width == '')
		var divWidth	=	getStyle(div, 'width');
	else
		var divWidth	=	div.style.width;
		
	// On enleve le 'px'
	var divHeight	=	divHeight.substr(0, divHeight.length - 2);
	var divWidth	=	divWidth.substr(0, divWidth.length - 2);
	
	if(divHeight < height)
		div.style.top	=	((height / 2 - divHeight / 2 + ScrollY)) + "px";
	else
		div.style.top	=	(25 + ScrollY) +'px';
	
	if(divWidth < width)
		div.style.left	=	((width / 2 - divWidth / 2 + ScrollX)) + "px";
	else
		div.style.left	=	(25 + ScrollX) +'px';
}

function getScroll()
{
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		ScrollY = document.documentElement.scrollTop + document.body.scrollTop;
		ScrollX = document.documentElement.scrollLeft + document.body.scrollLeft;
	}
	else
	{
		ScrollY = window.pageYOffset;
		ScrollX = window.pageXOffset;
	}
	return new Array(ScrollX, ScrollY);
}

function getViewPortSize()
{
	/*
	if (document.body)
	{
		var larg = (document.body.clientWidth);
		var haut = (document.body.clientHeight);
	}
	else
	{
		var larg = (window.innerWidth);
		var haut = (window.innerHeight);
	}
	*/
	var viewportwidth;
 	var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
	 if (typeof window.innerWidth != 'undefined')
	 {
		  viewportwidth = window.innerWidth,
		  viewportheight = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
	 {
		   viewportwidth = document.documentElement.clientWidth,
		   viewportheight = document.documentElement.clientHeight
	 }
	 
	 // older versions of IE
	 
	 else
	 {
		   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }
	
	return new Array(viewportwidth, viewportheight);
}
/*
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY)
	{	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} 
	else 
	{ // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) 
	{	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body) 
	{ // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	} 
	else 
	{ 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
	{	
		pageWidth = windowWidth;
	} 
	else 
	{
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
*/

var cache_page	=	false;

function getOffsetPosition(inID, inTYPE)
{
	var iVal	=	0;
	var oObj	=	document.getElementById(inID);
	var sType	=	'oObj.offset' + inTYPE;
	while (oObj && oObj.tagName != 'BODY')
	{
		iVal	+=	eval(sType);
		oObj	=	oObj.offsetParent;
	}
	return iVal;
}

function telecharger(aChemin, aFichier, aDestFileName)
{
	if (aDestFileName == undefined)
		aDestFileName	=	aFichier;
	xajax_set_visite_telechargement(aDestFileName);
	window.location.href	=	"includes/telecharger.php?chemin=" + aChemin + "&fichier=" + aFichier + "&nom=" + aDestFileName;
}

function ouvrir(aChemin, aFichier)
{
	window.open(aChemin + aFichier);
	return false;
}

var old_div_name	=	"";
function ShowDiv(aDivName, aNiveau)
{
	//alert("function ShowDiv(" + aDivName + ", " + aNiveau + ")");
	var current_div			=	MM_findObj(aDivName);
	if (current_div != undefined)
	{
		//alert("current_div != undefined (" + current_div.id + ") => " + current_div.style.display);
		
		if (current_div.style.display == "block") // Si le div est ouvert
		{
			current_div.style.display	=	"none";
			var tab_div	=	document.getElementsByTagName("div");
			for (i=0; i<tab_div.length; i++)
			{
				var	id	=	tab_div[i].id;
				//if (id.substr(0, aDivName.length) == aDivName)
				if (id == aDivName || id.substr(0, aDivName.length+1) == aDivName+"_")
				{
					MM_findObj(id).style.display	=	"none";
				}
			}
			if (aNiveau == 1)
				old_div_name	=	"";
		}
		else if (current_div.style.display == "none") // Si le div est fermer
		{
			current_div.style.display	=	"block";
			var tab_div	=	document.getElementsByTagName("div");
			for (i=0; i<tab_div.length; i++)
			{
				var	id	=	tab_div[i].id;
				//if (id.substr(0, aDivName.length) == aDivName)
				if (id == aDivName || id.substr(0, aDivName.length+1) == aDivName+"_")
				{
					MM_findObj(id).style.display	=	"block";
				}
			}
			if (aNiveau == 1 && old_div_name != "")
			{
				var old_div				=	MM_findObj(old_div_name);
				old_div.style.display	=	"none";
				var tab_div	=	document.getElementsByTagName("div");
				for (i=0; i<tab_div.length; i++)
				{
					var	id	=	tab_div[i].id;
					if (id.substr(0, old_div_name.length) == old_div_name)
					{
						MM_findObj(id).style.display	=	"none";
					}
				}
			}
			old_div_name	=	aDivName;
		}
	}
	//else
		//alert("current_div == undefined");
}
/*
var OldDiv			=	new Array();
function ShowDiv(aDivName, aNiveau)
{
	if (!OldDiv)
		OldDiv			=	new Array();
	var current_div			=	MM_findObj(aDivName);
	var OldDivNiveau		=	OldDiv.length;
	var ouvrir				=	true;
	if (current_div.style.display == "")
	{
		for(i=parseInt(aNiveau);i<OldDivNiveau;i++)
			OldDiv[i].style.display	=	"none";
		ouvrir	=	false;
	}
	
	if (parseInt(aNiveau) <= (parseInt(OldDivNiveau)))
	{
		for(i=parseInt(aNiveau);i<OldDivNiveau;i++)
		{
			OldDiv[i].style.display	=	"none";
		}
	}
	OldDiv[aNiveau]		=	current_div;
	var OldDivNiveau	=	OldDiv.length;
	
	if (ouvrir)
	{
		current_div.style.display	=	"";
	}
}
*/
// Upload ******
function update_div(aUnique, aUploadPath, aTableName, aColonneIdName, aColonneName, aId, aDivListName)
{
	xajax_update_div(aUnique, aUploadPath, aTableName, aColonneIdName, aColonneName, aId, aDivListName);
}

function supprimer_fichier(aUnique, aUploadPath, aTableName, aColonneIdName, aColonneName, aId, aDivListName, aFichier)
{
	xajax_supprimer_fichier(aUnique, aUploadPath, aTableName, aColonneIdName, aColonneName, aId, aDivListName, aFichier);
}
// Fin Upload **

var libelle_chargement	=	"<div align=\"center\"><img src=\"images/loading.gif\" alt=\"Chargement\" /><br /><span class=\"texte_gris\">Chargement en cours...</span></div>";

function changer_couleur_tr(aTr, aCouleur)
{
	aTr.bgColor	=	aCouleur;
}

function strpos( haystack, needle, offset)
{
	if (offset != undefined)
	    var i = (haystack+'').indexOf(needle, offset); 
	else
		var i = (haystack+'').indexOf(needle); 
    return i===-1 ? false : i;
}
