<!-- 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();
}
//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];}
}
// ----- 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)
{
	if(eval("document.getElementById(\"g"+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();
	if(eval("document.getElementById(\"d"+num+"\")"))
	{
		with(eval("document.getElementById(\"d"+num+"\")"))
		{
			style.visibility='visible';
			style.position='relative';
		}
	}
}
function cacherDroite(num)
{
	if(eval("document.getElementById(\"d"+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='#3c171a' 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,communeId,communeValeur,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;
	var commune = iFrame.getElementById(communeId);
	commune.value = communeValeur;
	iFrame.getElementById(formulaire).submit();
}

function interrupteurArticle(quel,codeTourisme,type)
{
	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("codeTourisme");
			hiddenField.value = codeTourisme;
			var hiddenField = iFrame.window.document.getElementById("type");
			hiddenField.value = type;
			iFrame.window.document.getElementById("formulaireComposition").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionFiche.php?codeTourisme="+codeTourisme+"&type="+type;
		}
	}
}
function interrupteurChapeau(quel,codeArticle,codeRubrique,type)
{
	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("codeArticle");
			hiddenField.value = codeArticle;
			var hiddenField = iFrame.window.document.getElementById("codeRubrique");
			hiddenField.value = codeRubrique;
			var hiddenField = iFrame.window.document.getElementById("type");
			hiddenField.value = type;
			iFrame.window.document.getElementById("formulaireChapeau").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionChapeau.php?codeArticle="+codeArticle+"&codeRubrique="+codeRubrique+"&type="+type;
		}
	}
}
function interrupteurPhoto(quel,codeTourisme)
{
	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("codeTourisme");
			hiddenField.value = codeTourisme;
			iFrame.window.document.getElementById("formulaireComposition").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionPhoto.php?codeTourisme="+codeTourisme;
		}
	}
}
function interrupteurTarifs(quel,codeTourisme)
{
	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("codeTourisme");
			hiddenField.value = codeTourisme;
			iFrame.window.document.getElementById("formulaireComposition").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionTarifs.php?codeTourisme="+codeTourisme;
		}
	}
}
function interrupteurPhotoAffichage(quel,codeImage,largeur,hauteur)
{
	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 = 100;
		document.getElementById("box"+quel).style.top = 30 + posY;
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			largeur=largeur+5;
			hauteur=hauteur+5;
			document.getElementById("box"+quel).style.display = "";
			document.getElementById("box"+quel).style.width = largeur;
			document.getElementById("box"+quel).style.height = hauteur+25;
			document.getElementById("f"+quel).style.width = largeur;
			document.getElementById("f"+quel).style.height = hauteur;
			document.getElementById("table"+quel).style.width = largeur;
		}
		else
		{
			largeur=largeur;
			hauteur=hauteur;
			document.getElementById("box"+quel).style.display = "";
			document.getElementById("box"+quel).style.width = largeur+3;
			document.getElementById("box"+quel).style.height = hauteur+25;
			document.getElementById("f"+quel).style.width = largeur;
			document.getElementById("f"+quel).style.height = hauteur;
			document.getElementById("table"+quel).style.width = largeur+3;
		}
		document.getElementById("f"+quel).src = "diapo.php?codeImage="+codeImage;
	}
}
function interrupteurReservation(quel,codeTourisme,codeJour)
{
	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 = 400;
		document.getElementById("box"+quel).style.display = "";

		
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			var iFrame = window.frames["f"+quel];
			var hiddenField = iFrame.window.document.getElementById("codeTourisme");
			hiddenField.value = codeTourisme;
			var hiddenField = iFrame.window.document.getElementById("dateDeb");
			hiddenField.value = codeJour;
			var hiddenField = iFrame.window.document.getElementById("codePlanning");
			hiddenField.value = '';
			iFrame.window.document.getElementById("plannification").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "fichePlanning.php?codeTourisme="+codeTourisme+"&dateDeb="+codeJour;
		}
	}
}
function interrupteurReservationPlanning(quel,codeTourisme,codePlanning)
{
	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 = 400;
		document.getElementById("box"+quel).style.display = "";

		
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			var iFrame = window.frames["f"+quel];
			var hiddenField = iFrame.window.document.getElementById("codeTourisme");
			hiddenField.value = codeTourisme;
			var hiddenField = iFrame.window.document.getElementById("codePlanning");
			hiddenField.value = codePlanning;
			iFrame.window.document.getElementById("plannification").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "fichePlanning.php?codeTourisme="+codeTourisme+"&codePlanning="+codePlanning;
		}
	}
}
function interrupteurCalendrier(quel,codeTourisme,codeJour)
{
	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("codeTourisme");
			hiddenField.value = codeTourisme;
			iFrame.window.document.getElementById("plannification").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "calendrierFiche.php?codeTourisme="+codeTourisme;
		}
	}
}
function interrupteurAssociation(quel,codeAssociation,type)
{
	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("codeAssociation");
			hiddenField.value = codeAssociation;
			var hiddenField = iFrame.window.document.getElementById("type");
			hiddenField.value = type;
			iFrame.window.document.getElementById("formulaireComposition").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionAssociation.php?codeAssociation="+codeAssociation+"&type="+type;
		}
	}
}
function interrupteurImage(quel,codeCategorie,codeImage)
{
	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("codeCategorie");
			hiddenField.value = codeCategorie;
			var hiddenField = iFrame.window.document.getElementById("codeImage");
			hiddenField.value = codeImage;
			iFrame.window.document.getElementById("formImageCompo").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionImage.php?codeCategorie="+codeCategorie+"&codeImage="+codeImage;
		}
	}
}
function interrupteurCategorie(quel,codeCategorie)
{
	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("codeCategorie");
			hiddenField.value = codeCategorie;
			iFrame.window.document.getElementById("formCategorieCompo").submit();
		}
		else
		{
			document.getElementById("f"+quel).src = "compositionCategorie.php?codeCategorie="+codeCategorie;
		}
	}
}
/*fonction permettant de verifier si le champ est au bon format, non valide en 2100*/
function verifierChampsDateFr(nom,valeur)
{
  if(document.getElementById(nom).value!='')
  {
	chaine = new String(document.getElementById(nom).value);
	//chaine = chaine.replace(/[\-\.\\]/g, "/");
	var caract = ',';
	if(chaine.indexOf(" ")!='-1')
	{
		//Permet de remplacer la virgule par un point
		var tab = chaine.split(/ /);
		var resultat=tab[0]+"/"+tab[1]+"/"+tab[2];
		//var resultat=chaine.substring(0, chaine.indexOf(','))+'.'+chaine.substring(chaine.indexOf(',')+1, chaine.length);
		document.getElementById(nom).value=resultat;
	}
	if(chaine.indexOf("\.")!='-1')
	{
		var tab = chaine.split(/\./);
		var resultat=tab[0]+"/"+tab[1]+"/"+tab[2];
		document.getElementById(nom).value=resultat;
	}
	if(chaine.indexOf("\\")!='-1')
	{
		var tab = chaine.split(/\\/);
		var resultat=tab[0]+"/"+tab[1]+"/"+tab[2];
		document.getElementById(nom).value=resultat;
	}
	if(chaine.indexOf("-")!='-1')
	{
		var tab = chaine.split(/-/);
		var resultat=tab[0]+"/"+tab[1]+"/"+tab[2];
		document.getElementById(nom).value=resultat;
	}
  	/*ecriture date ddmmaa*/
	var reg = new RegExp("^[0-3][0-9][0-1][0-9][0-9]{2}$", "g");
	if (reg.test(document.getElementById(nom).value)) 
  	{
		chaine = new String(document.getElementById(nom).value);
		var resultat=chaine.substring(0,2)+"/"+chaine.substring(2,4)+"/19"+chaine.substring(4,6);
		document.getElementById(nom).value=resultat;
  	}
	/*ecriture date ddmmaaaa*/
	var reg = new RegExp("^[0-3][0-9][0-1][0-9]20[0-9]{2}$", "g");
	if (reg.test(document.getElementById(nom).value)) 
  	{
		chaine = new String(document.getElementById(nom).value);
		var resultat=chaine.substring(0,2)+"/"+chaine.substring(2,4)+"/"+chaine.substring(4,8);
		document.getElementById(nom).value=resultat;
  	}
	/*l'année est code sur deux chiffres*/
	var reg = new RegExp("^[0-3][0-9]\/[0-1][0-9]\/[0-9]{2}$", "g");
	if (reg.test(document.getElementById(nom).value)) 
  	{
		chaine = new String(document.getElementById(nom).value);
		var tab = chaine.split(/\//);
		var resultat=tab[0]+"/"+tab[1]+"/20"+tab[2];
		document.getElementById(nom).value=resultat;
  	}
	/*la date est elle correcte*/
	var reg = new RegExp("^[0-3][0-9]\/[0-1][0-9]\/[0-9]{4}$", "g");
	if (reg.test(document.getElementById(nom).value)) 
  	{
  	} 
  	else
  	{
	  alert("Le champ \""+valeur+"\" est incorrect,\nformat de la date JJ/MM/AAAA");
	  document.getElementById(nom).value='';
	  document.getElementById(nom).focus();
	  //document.getElementById(nom).select();
  	}
  }
}
/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   integer  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function
