function MM_preloadImages() {
  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() {
  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) {
  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() {
  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 popupcentree(page,largeur,hauteur,options) {
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

// fonction de vérification de champ date au format JJ/MM/AAAA ou JJ/MM/AA
function CheckDate(d_name, d_champ, oblig) {
	var d  = d_name.value;
	if (d == "") {
		if(oblig == true){ alert("Le champ \"" + d_champ + "\" doit être renseigné."); d_name.focus(); } }
	else {
		var separateur = "/"; j  = d.substring(0,2); m  = d.substring(3,5); a  = d.substring(6); ok = true;
		
		if ( isNaN(j) || j < 1 || j > 31)										{ ok = false; }
		if (isNaN(m) || m < 1 || m > 12)										{ ok = false; }
		if (isNaN(a) || a.length < 2 || a.length == 3  || a.length > 4) 		{ ok = false; }
		if (d.substring(2,3) != separateur || d.substring(5,6) != separateur)	{ ok = false; }
		
		if (ok == false) { alert("Le champ \"" + d_champ + "\" comporte une date non valide.\nFormat : JJ/MM/AAAA ou JJ/MM/AA"); d_name.focus(); return false;}
	}
	// APPEL :  onblur="CheckDate(nom_du_champ, 'libelle du champ', [true]) : true si le champ est obligatoire"
}
// /fonction de vérification de champ date au format JJ/MM/AAAA ou JJ/MM/AA

function popup(url, name, rezise, width, height, scroll, centre){
	if(centre == 1){
		var top  = (screen.height - height) / 2;
		var left = (screen.width  - width)  / 2;
		pop = window.open(url, name, "top=" + top + ", left=" + left +  ", resizable=" + rezise + ", scrollbars=" + scroll + ", menubar=no,width=" + width + ", height=" + height + ", menubar=no")
	}
	else{
		pop = window.open(url, name, ", resizable=" + rezise + ", scrollbars=" + scroll + ", width=" + width + ", height=" + height + ", menubar=no")
	}
	// APPEL : <a href="javascript:popup('toto.asp', 'pop1', 'yes', 800, 600, 'yes', 1)">lien vers popup</a>
}

function movedown(div_actu) {
	var iens6	= document.all||document.getElementById;
	var ns4		= document.layers;
	var speed	= 5;
	if (iens6){
		var crossobj		= document.getElementById? document.getElementById("corps_actu_01") : document.all.content;
		var contentheight 	= crossobj.offsetHeight;
	}
	else if (ns4){
		var crossobj		= document.nscontainer.document.nscontent;
		var contentheight	= crossobj.clip.height;
	}
	if (iens6 && parseInt(crossobj.style.top) >= (contentheight * (-1) + 100)) {
		crossobj.style.top = parseInt(crossobj.style.top) - speed + "px";
	} else if (ns4 && crossobj.top >= (contentheight * (-1) + 100)) {
		crossobj.top -= speed;
	}
	
	movedownvar = setTimeout("movedown(" + div_actu + ")", 20);
}