function mettre_focus(id_name)
{
	document.getElementById(id_name).focus();
}

function img_attente(maDiv, type_sortie)
{
	switch(type_sortie)
	{
		case 0 : break;
		case 1 : maDiv.innerHTML = "<div align=\"center\"><img src=\"images/rubriques/ajax_load.gif\" border=\"0\" /></div>"; break;
		case 2 : maDiv.innerHTML = "<div align=\"center\"><img src=\"images/rubriques/ajax_load2.gif\" border=\"0\" /></div><br />"; break;
		default : maDiv.innerHTML = "<img src=\"images/rubriques/ajax_load.gif\" border=\"0\" />"; break;
	}
}

function OuvrirFenetre(url,nom,details)
{
	window.open(url,nom,details);
}

/**
* Ouvre une popup et centre la fenêtre
*/
function OuvrirFenetre_PreviewCard(url,nom,l,h)
{
	posx=Math.round((screen.availWidth-l)/2);
	posy=Math.round((screen.availHeight-h)/4);

	window.open(url,nom,'resizable=no, location=no, top='+posy+',left='+posx+', width='+l+', height='+h+', menubar=no, status=no, scrollbars=no, menubar=no');
}

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_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_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_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 details(a)
{
	if (document.getElementById('affi'+a).style.display == "none")
		document.getElementById('affi'+a).style.display = "";
	else
		document.getElementById('affi'+a).style.display = "none";
}

var lastzone1 = "";
var lastzone2 = "";
function affizone(zone1, zone2)
{
	if(lastzone1 != "") document.getElementById(lastzone1).style.display = "none";
	if(lastzone2 != "") document.getElementById(lastzone2).style.display = "none";
	if(zone1 != "") document.getElementById(zone1).style.display = "";
	if(zone2 != "") document.getElementById(zone2).style.display = "";

	lastzone1 = zone1;
	lastzone2 = zone2;
}

function verif_extension_img(id_champ){
	var extensions_autorisees=new Array("gif","jpg","jpeg");
	var valeur=document.getElementById(id_champ).value;
	if(valeur!=""){
		var indice=valeur.lastIndexOf(".");
		var extension = valeur.substr(indice+1).toLowerCase();

		var ok=false;
		for(var j=0;(!ok)&&(j<extensions_autorisees.length);j++){
			ok=(extension==extensions_autorisees[j]);
		}
		if(!ok){
			alert("Les extensions acceptées sont : "+extensions_autorisees.toString()+".");
			document.getElementById(id_champ).focus();
			return(false);
		}
	}
	return(true);
}