<!-- 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 interrupteurFenetre(quel)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
		posX=document.body.clientWidth;
	else
		posX=window.innerWidth;
	if(navigator.appName == 'Microsoft Internet Explorer')
		posY=document.body.scrollTop;
	else
		posY=window.pageYOffset;
	if(document.getElementById("box"+quel).style.display == "")
		document.getElementById("box"+quel).style.display = "none";
	else
	{
		document.getElementById("box"+quel).style.left = posX - 200;
		document.getElementById("box"+quel).style.top = posY + 25 + (quel*200);
		document.getElementById("box"+quel).style.display = "";
	}
}
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 interrupteurSavoirPlus(quel,valeur)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
		posY=document.body.scrollTop;
	else
		posY=window.pageYOffset;
	if(document.getElementById("box"+quel).style.display == "")
		document.getElementById("box"+quel).style.display = "none";
	else
	{
		if(navigator.appName == 'Microsoft Internet Explorer')
			var iFrame = window.frames["f"+quel].window.document;
		else
			var iFrame = document.getElementById("f"+quel).contentDocument;
		document.getElementById("box"+quel).style.left = 100;
		document.getElementById("box"+quel).style.top = 25 + posY;
		document.getElementById("box"+quel).style.display = "";
		var hiddenField = iFrame.getElementById("codeMenu");
		hiddenField.value = valeur;

		if(navigator.appName == 'Microsoft Internet Explorer')
			iFrame.getElementById("idsavoir").submit();
		else
			document.getElementById("f"+quel).src = "savoirPlus.php?codeMenu="+valeur;
	}
}
function cacherDiv()
{
	oSelects = document.getElementsByTagName('DIV'); 
 	if (oSelects.length > 0)
	{ 
  		for (i = 0; i < oSelects.length; i++) 
		{
			oSlt = oSelects[i];
			oSlt.style.visibility='hidden';
			oSlt.style.position='absolute';
		} 
 	} 
}
/*fin de la gestion des popup*/
document.write('<div class=popperlink id=topdecklink></div>');
/*Fonction permettant de changer du texte dans une zone défini*/
var oldTxt="";
function changeTxt(id,texte)
{
	var element = null
	if(document.getElementById)
	{
		element = document.getElementById(id);
	}
	else if (document.all)
	{
		element = document.all[id];
	}
	if (element)
	{
		oldtxt=element.innerHTML=texte;
		element.innerHTML=texte
	}
}
function restaure(id,leTexte)
{
	var element = null;
	if(document.getElementById)
	{
		element = document.getElementById(id);
	}
	else if (document.all)
	{
		element = document.all[id];
	}
	if (element)
		element.innerHTML=leTexte;
}
// ----- Fonctions pour ouvrir une fenêtre popup avec une dimension fixée, ou en plein écran
function popup2(url)
{
	var largeur=650;
	var hauteur=400;
	var f=window.open(url,"fenetre2","height="+hauteur+",width="+largeur+",toolbar=no,location=no,status=no,directories=no,scrollbars=yes,resizable=no,copyhistory=no");
	f.focus();
}

// ----- Fonctions pour appeler la carte interactive
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//survole d'image
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 gestionSelect(v)
{
	oSelects = document.getElementsByTagName('SELECT'); 
 	if (oSelects.length > 0)
	{ 
  		for (i = 0; i < oSelects.length; i++) 
		{
			oSlt = oSelects[i];
			oSlt.style.visibility = v;
		} 
 	} 
}
// ----- Fonctions pour le menu de gauche
function interrupteurGauche(num)
{
	if (eval("document.getElementById(\"g"+num+"\").style.visibility")=='visible')
		cacherGauche(num);
	else
		montrerGauche(num);
}
function montrerGauche(num)
{
	toutCacherGauche();
	if(num!="")
	{
		with(eval("document.getElementById(\"g"+num+"\")"))
		{
			style.visibility='visible';
			style.position='relative';
		}
	}
}
function cacherGauche(num)
{
	with(eval("document.getElementById(\"g"+num+"\")"))
	{
		style.visibility='hidden';
		style.position='absolute';
	}
}
function toutCacherGauche()
{
	for (i=0;eval("document.getElementById(\"g"+i+"\")");i++)
		cacherGauche(i);
}
// ----- Fonctions pour le menu de droite
function interrupteurDroite(num)
{
	if (eval("document.getElementById(\"d"+num+"\").style.visibility")=='visible')
		cacherDroite(num);
	else
		montrerDroite(num);
}
function montrerDroite(num)
{
	//toutCacherDroite();
	with(eval("document.getElementById(\"d"+num+"\")"))
	{
		style.visibility='visible';
		style.position='relative';
	}
}
function cacherDroite(num)
{
	with(eval("document.getElementById(\"d"+num+"\")"))
	{
		style.visibility='hidden';
		style.position='absolute';
	}
}
function toutCacherDroite()
{
	for (i=0;eval("document.getElementById(\"d"+i+"\")");i++)
		cacherDroite(i);
}
function toutMontrerDroite()
{
	for (i=0;eval("document.getElementById(\"d"+i+"\")");i++)
	{
		montrerDroite(i);
	}
}
function testerMail(id) 
{
	var email=document.getElementById(id).value
	if ((email.indexOf('@',0)==-1) || (email.indexOf('.',0)==-1)) 
	{
		// l'adresse entrée est incorrecte
		alert("Votre adresse email est incorrecte");
		document.getElementById(id).value='';
		document.getElementById(id).focus;
	}
}
function popup(page) 
{ 
	window.open(page, 'popup', 'top=200,left=150,width=640, height=425, scrollbars=yes,menubar=yes');
}
//fonction gerant les fenetres de message suivant la souris
domok = document.getElementById;
if (domok)
{
	if(document.getElementById("topdecklink"))
	{
		skn = document.getElementById("topdecklink").style;
		if(navigator.appName.substring(0,3) == "Net")
			document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = get_mouse;
	}
}

function poplink(msg)
{
	gestionSelect('hidden');
	var content ="<TABLE BORDER=1 BORDERCOLOR='#F3B625' CELLPADDING=2 CELLSPACING=0 width=100><TR><TD class=\"sitesousmenuInv\"><CENTER>"+msg+"</CENTER></TD></TR></TABLE>";
	if (domok)
	{
	  	document.getElementById("topdecklink").innerHTML = content;
	  	skn.visibility = "visible";
	}
}
function poplink2(msg)
{
	var content ="<TABLE BORDER=1 BORDERCOLOR=white CELLPADDING=2 CELLSPACING=0 width=100><TR><TD BGCOLOR='#BFE101'><FONT COLOR='#008837' SIZE=2 face='Arial'><CENTER>"+msg+"</CENTER></TD></TR></TABLE>";
	if (domok)
	{
		document.getElementById("topdecklink").innerHTML = content;
		skn.visibility = "visible";
	}
}
function get_mouse(e)
{
	var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
	skn.left = x - 50;
	skn.top = y+20;
}
function killlink()
{
	gestionSelect('visible');
	if (domok)
		skn.visibility = "hidden";
}
function attribuerRecherche(maFrame,categorieId,categorieValeur,rubriqueId,rubriqueValeur,rechercheId,rechercheValeur,formulaire)
{
	if(navigator.appName == 'Microsoft Internet Explorer')
		var iFrame = window.frames["Frecherche"].window.document;
	else
		var iFrame = document.getElementById("Frecherche").contentDocument;
	var categorie = iFrame.getElementById(categorieId);
	categorie.value = categorieValeur;
	var rubrique = iFrame.getElementById(rubriqueId);
	rubrique.value = rubriqueValeur;
	var recherche = iFrame.getElementById(rechercheId);
	recherche.value = rechercheValeur;
	iFrame.getElementById(formulaire).submit();
}


