var IE = document.all?true:false
var tempX = 0
var tempY = 0
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY

  return true
}

function mouseMove (evt) 
{ 

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.


// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s


// Main function to retrieve mouse x-y pos.s

		var x=0; var y=0;
		if (document.layers) {
			x=evt.x; y=evt.y;
		} 
		if (document.all) {
			x=event.clientX; y=event.clientY;
		} else {
			if (document.getElementById) {
				x=evt.clientX; y=evt.clientY; 
			}
		}
		document.getElementById('def').style.left = tempX+15;
		document.getElementById('def').style.top = tempY;
}
 
function popup(url, name, width, height, scroll, resizable) {
   winSet = "toolbar=no,location=no,directories=no,menubar=no,scrollbars="+scroll+",resizable="+resizable+"";
   winSet += ",width="+width +",height="+height+",left="+(screen.availWidth-width)/2+",top="+(screen.availHeight-height)/2;
   popwnd = window.open(url, name, winSet);
   popwnd.focus();
}

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_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 affiche(j) {
	if(document.getElementById(j).style.display=="block")
		document.getElementById(j).style.display="none";
	else
		document.getElementById(j).style.display="block";
}

function masque(j) {
	document.getElementById(j).style.display="none";
}
function affiche_on(j) {
	document.getElementById(j).style.display="block";
}

function afficheInscription(j,j2) {
		document.getElementById(j).style.display="block";
		document.getElementById(j2).style.display="none";
}

function writeDiv(texte, box) {
	document.getElementById(box).innerHTML = texte;
}

function sendAction(nompage,maform,monaction){
		theform = eval('this.document.'+maform);
		
		var inputs=document.getElementsByTagName("*");
		// Max, Ne rend plus obligatoire, l'insertion du champ faction.
		for (var i=0; i<inputs.length;i++){
			if ( inputs.item(i).name == "faction") {
				theform.faction.value = monaction;
			}
		}

		theform.method = "POST";
		mapage = nompage;
		theform.action = mapage;
		theform.submit();

}

function file(fichier, data) {
	if(window.XMLHttpRequest) // FIREFOX
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
		return(false);
	// variable envoyé par l'url
	xhr_object.open("POST", fichier, false);
	/* Effectue la requête en envoyant les données : */
	xhr_object.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr_object.send(data);
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}

function affdefinition(definition,titre)
{
	document.getElementById('def').innerHTML = "<u>"+titre+":</u><br>"+definition;
	document.getElementById('def').style.display = "block";
	
	if (document.layers) 
	document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) 
	document.onmousemove = mouseMove; 
	if (document.addEventListener) 
	document.addEventListener('mousemove', mouseMove, true); 
	
}

function FaitTableau(n) {
  // Création d'un tableau (array)
  // aux dimensions du nombre de paramètres.
  this.length = n;
  for (var i = 0; i <= n; i++) {
    this[i] = 0
  }
  return this
}
function page(nompage,quelpage,maform){
		theform = eval('this.document.'+maform);
		theform.method = "POST";
		paramURL = "?";
			if (!location.search) {
			  paramOk = false;
			}
			else {
			  // Éliminer le "?"
			 
			  nReq = location.search.substring(1,location.search.length)
			  // Extrait les différents paramètres avec leur valeur.
			  nReq = nReq.split("&");

			  param = new FaitTableau(nReq.length-1)
			  for (var i=0;i<(nReq.length);i++) {
				
					if(   nReq[i].substring(0,nReq[i].indexOf("=")) != "page" ){
				
						param[i] = nReq[i]
						paramURL += param[i]+"&";
					}	
			  }
			}

		mapage = nompage+paramURL+"page="+quelpage+"#page";
		
		theform.action = mapage;
		theform.submit();

}

function affBloc(definition,titre,produit)
{	

	document.getElementById('def').style.display = "block";
	document.getElementById('titre_bloc').innerHTML = ""+titre+"";
	document.getElementById('des_bloc').innerHTML = ""+definition;
	document.getElementById('produit_bloc').innerHTML = ""+produit+"";
	
	if (document.layers) 
	document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) 
	document.onmousemove = mouseMove; 
	if (document.addEventListener) 
	document.addEventListener('mousemove', mouseMove, true); 
	
	
	
	
}

