
// ---------------------------------------------------------------------------------------------
// -- fonction gérant les popups
// ---------------------------------------------------------------------------------------------
function initialiser(messageJ)
{
	var timer=setTimeout("editeur.document.iView.document.body.innerHTML='"+messageJ+"'",200);
}
function popup(page) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width=490, height=340,');
}
function popup1(page) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width=490, height=340, scrollbars=yes');
}
function popup2(page) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width=300, height=225,');
}
function popup3(page) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width=400, height=425, scrollbars=yes');
}
function popupSize(page,largeur,hauteur) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width='+largeur+', height='+hauteur+', scrollbars=no');
}
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_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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
//fonction gerant les fenetres de message suivant la souris n2

IE4 = (document.all) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
VERSION4 = (IE4 | NS4) ? 1 : 0;

if (!VERSION4) event = null;

function helpGetOffset(obj, coord) {
    var val = obj["offset"+coord] ;
    if (coord == "Top") val += obj.offsetHeight;
    while ((obj = obj.offsetParent )!=null) {
        val += obj["offset"+coord];
        if (obj.border && obj.border != 0) val++;
    }
    return val;
}

function helpDown () {
    if (IE4) document.all.helpBox.style.visibility = "hidden";
    if (NS4) document.helpBox.visibility = "hidden";
}

function helpOver (event,texte) {
    if (!VERSION4) return;

    var ptrObj, ptrLayer;
    if (IE4) {
        ptrObj = event.srcElement;
        ptrLayer = document.all.helpBox;
    }
    if (NS4) {
        ptrObj = event.target;
        ptrLayer = document.helpBox;
    }

    if (!ptrObj.onmouseout) ptrObj.onmouseout = helpDown;

    var str = '<DIV CLASS="helpBoxDIV">'+texte+'</DIV>';
    if (IE4) {
        ptrLayer.innerHTML = str;
        ptrLayer.style.top = helpGetOffset (ptrObj,"Top") + 2;
        ptrLayer.style.left = helpGetOffset (ptrObj,"Left");
        ptrLayer.style.visibility = "visible";
    }
    if (NS4) {
        ptrLayer.document.write (str);
        ptrLayer.document.close ();
        ptrLayer.document.bgColor = "yellow";
        ptrLayer.top = ptrObj.y + 20;
        ptrLayer.left = ptrObj.x;
        ptrLayer.visibility = "show";
    }
}
function helpOver2 (event,texte) {
    if (!VERSION4) return;

    var ptrObj, ptrLayer;
    if (IE4) {
        ptrObj = event.srcElement;
        ptrLayer = document.all.helpBox;
    }
    if (NS4) {
        ptrObj = event.target;
        ptrLayer = document.helpBox;
    }

    if (!ptrObj.onmouseout) ptrObj.onmouseout = helpDown;

    var str = '<DIV CLASS="helpBoxDIV2">'+texte+'</DIV>';
    if (IE4) {
        ptrLayer.innerHTML = str;
        ptrLayer.style.top = helpGetOffset (ptrObj,"Top") + 2;
        ptrLayer.style.left = helpGetOffset (ptrObj,"Left") - 190;
        ptrLayer.style.visibility = "visible";
    }
    if (NS4) {
        ptrLayer.document.write (str);
        ptrLayer.document.close ();
        ptrLayer.document.bgColor = "yellow";
        ptrLayer.top = ptrObj.y + 2;
        ptrLayer.left = ptrObj.x - 190;
        ptrLayer.visibility = "show";
    }
}
// fin de gestion des message suivant la souris
<!-- Script par @ NBF, membre de l'Éditeur JavaScript -->
var clic = 0;
var dif_x = new Array("0","0","0","0","0","0");
var dif_y = new Array("0","0","0","0","0","0");
var pos_x = new Array("25","325","625","25","325","625");
var pos_y = new Array("25","25","25","325","325","325");
var quel = 0;
var timer = 0;
var time;
var w;
var h;

function dif(e)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
	{
		dif_x[quel] = parseInt(event.clientX) - parseInt(document.getElementById("box"+quel).style.left);
		dif_y[quel] = parseInt(event.clientY) - parseInt(document.getElementById("box"+quel).style.top);
	}
	else
	{
		dif_x[quel] = parseInt(e.clientX) - parseInt(document.getElementById("box"+quel).style.left);
		dif_y[quel] = parseInt(e.clientY) - parseInt(document.getElementById("box"+quel).style.top);
	}
}

function bouger(e)
{
	
	if(clic == 1)
	{
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			pos_x[quel] = parseInt(event.clientX) - parseInt(dif_x[quel]);
			pos_y[quel] = parseInt(event.clientY) - parseInt(dif_y[quel]);
			if(pos_x[quel] < 0)
			{
				pos_x[quel] = 0;
				dif_x[quel] = parseInt(event.clientX) - parseInt(document.getElementById("box"+quel).style.left);
				if(dif_x[quel] < 0)
				{
					dif_x[quel] = 0;
				}
			}
			if(pos_y[quel] < 0)
			{
				pos_y[quel] = 0; 
				dif_y[quel] = parseInt(event.clientY) - parseInt(document.getElementById("box"+quel).style.top);
				if(dif_y[quel] < 0)
				{
					dif_y[quel] = 0;
				}
			}
		}
		else
		{
			
			pos_x[quel] = parseInt(e.pageX) - parseInt(dif_x[quel]);
			pos_y[quel] = parseInt(e.pageY) - parseInt(dif_y[quel]);
			if(pos_x[quel] < 0)
			{
				pos_x[quel] = 0;
				dif_x[quel] = parseInt(e.pageX) - parseInt(document.getElementById("box"+quel).style.left);
				if(dif_x[quel] < 0)
				{
					dif_x[quel] = 0;
				}
			}
			if(pos_y[quel] < 0)
			{
				pos_y[quel] = 0; 
				dif_y[quel] = parseInt(e.pageY) - parseInt(document.getElementById("box"+quel).style.top);
				if(dif_y[quel] < 0)
				{
					dif_y[quel] = 0;
				}
			}
		}
		document.getElementById("box"+quel).style.left = pos_x[quel];
		document.getElementById("box"+quel).style.top = pos_y[quel];
	}
}
function gererfocus()
{
	for(n = 0; n < 2; n++)
	{
		if(document.getElementById("box"+n).style.zIndex > document.getElementById("box"+quel).style.zIndex)
		{
			document.getElementById("box"+n).style.zIndex--;
		}
	}
}

function redim(s)
{
	if(timer == 1)
	{
		if(s == 1)
		{
			h = parseInt(document.getElementById("box"+quel).style.height);
			h -= 2;
			if(h < 1)
			{
				h = 0;
			}
			if(h >= window.screen.availHeight)
			{
				h = window.screen.availHeight;
			}
			document.getElementById("box"+quel).style.height = h + "px";
			document.getElementById("f"+quel).style.height = h + "px";
		}
		if(s == 2)
		{
			h = parseInt(document.getElementById("box"+quel).style.height);
			h += 2;
			if(h < 1)
			{
				h = 0;
			}
			if(h >= window.screen.availHeight)
			{
				h = window.screen.availHeight;
			}
			document.getElementById("box"+quel).style.height = h + "px";
			document.getElementById("f"+quel).style.height = h + "px";
		}
		if(s == 3)
		{
			w = parseInt(document.getElementById("box"+quel).style.width);
			w -= 2;
			if(w < 125)
			{
				w = 125;
			}
			if(w >= window.screen.availWidth)
			{
				w = window.screen.availWidth;
			}
			document.getElementById("box"+quel).style.width = w + "px";
			document.getElementById("f"+quel).style.width = w + "px";
		}
		if(s == 4)
		{
			w = parseInt(document.getElementById("box"+quel).style.width);
			w += 2;
			if(w < 125)
			{
				w = 125;
			}
			if(w >= window.screen.availWidth)
			{
				w = window.screen.availWidth;
			}
			document.getElementById("box"+quel).style.width = w + "px";
			document.getElementById("f"+quel).style.width = w + "px";
		}
		if(s == 5)
		{
			document.getElementById("box"+quel).style.height = 0 + "px";
			document.getElementById("f"+quel).style.height = 0 + "px";
		}
		if(s == 6)
		{
			document.getElementById("box"+quel).style.width = window.screen.availWidth + "px";
			document.getElementById("box"+quel).style.height = window.screen.availHeight + "px";
			document.getElementById("f"+quel).style.width = window.screen.availWidth + "px";
			document.getElementById("f"+quel).style.height = window.screen.availHeight + "px";
			document.getElementById("box"+quel).style.top = 0;
			document.getElementById("box"+quel).style.left = 0;
			pos_x[quel] = 0;
			pos_y[quel] = 0;
		}
		if(s == 7)
		{
			document.getElementById("box"+quel).style.display = "none";
		}
	}
	if(timer == 0)
	{
		clearInterval(time);
	}
}
function gestionSelect(v)
{
	oSelects = document.getElementsByTagName('SELECT'); 
 	if (oSelects.length > 0)
	{ 
  		for (i = 0; i < oSelects.length; i++) 
		{
			oSlt = oSelects[i];
			oSlt.style.visibility = v;
		} 
 	} 
}
function interrupteurPhoto(quel,codeFiche)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
		posX=document.body.clientWidth;
	else
		posX=window.innerWidth;
	if(document.getElementById("box"+quel).style.display == "")
		document.getElementById("box"+quel).style.display = "none";
	else
	{
		document.getElementById("box"+quel).style.left = 100;
		document.getElementById("box"+quel).style.top = 30;
		document.getElementById("box"+quel).style.display = "";

		
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			var iFrame = window.frames["f"+quel];
			var hiddenField = iFrame.window.document.getElementById("codeFiche");
			hiddenField.value = codeFiche;
			iFrame.window.document.getElementById("formulaireComposition").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionPhoto.php?codeFiche="+codeFiche;
		}
	}
}
function interrupteurPhotoAffichage(quel,lienPhoto,largeur,hauteur)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
		posX=document.body.clientWidth;
	else
		posX=window.innerWidth;
	if(window.parent.document.getElementById("box"+quel).style.display == "")
		window.parent.document.getElementById("box"+quel).style.display = "none";
	else
	{
		window.parent.document.getElementById("box"+quel).style.left = 100;
		window.parent.document.getElementById("box"+quel).style.top = 30;
		window.parent.document.getElementById("box"+quel).style.display = "";
		window.parent.document.getElementById("box"+quel).style.width = largeur+10;
		window.parent.document.getElementById("box"+quel).style.height = hauteur+10+25;
		window.parent.document.getElementById("f"+quel).style.width = largeur+10;
		window.parent.document.getElementById("f"+quel).style.height = hauteur+10;
		window.parent.document.getElementById("table"+quel).style.width = largeur+10;

		window.parent.document.getElementById("f"+quel).src = "diapo.php?lienPhoto="+lienPhoto;
	}
}
/*variable d'etat permettant de savoir si la page est en cours de chargement*/
var chargement;
//function enChargement(formulaire,fichier,bouton,valeur)
//avec onClick="enChargement(this.form,'calendrier.php',document.plannificationUser.actionPlannification.name,'Valider');"
function enChargement()
{
	if(chargement=="oui")
	{
		alert('Page en cours de chargement');
		return false;
	}
	else
	{
		chargement = "oui";
		/*document.getElementById(bouton).value=valeur;
		formulaire.method = "POST";
		formulaire.action = fichier;
		formulaire.submit();*/
		return true;
	}
}
function controleChargement()
{
	if(chargement=="oui")
	{
		alert('Page en cours de chargement');
		return false;
	}
	else
	{
		return true;
	}
}
function chargementTermine()
{
	chargement = "non";
}
