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_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, x.height=x.oHeight,x.width=x.oWidth;
}

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.0
  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 && document.getElementById) x=document.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;
   		if(!x.oHeight) x.oHeight = x.height;
   		if(!x.oWidth) x.oWidth = x.width;
   		x.src = a[i+2];
   		if(a[i+4]!=null) x.height = a[i+4];
   		if(a[i+5]!=null) x.width = a[i+5];
   		break;
	}
}

function MM_swapBackground() { //v3.0
  	var i,j=0,x,a=MM_swapBackground.arguments;
	document.MM_bg=new Array;
	x = a[0];
	document.MM_bg[j++] = x;
	if(!x.oBg) x.oBg = x.style.backgroundImage;
	x.style.backgroundImage = 'url('+a[1]+')';
}

function MM_swapBackgroundRestore() { //v3.0
	var a = document.MM_bg;
	x = a[0];
	x.style.backgroundImage = '';
}

function affiche(j) {
	if(document.getElementById(j).style.display=="block")
		document.getElementById(j).style.display="none";
	else
		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);
}


