function MM_preloadImages() { 
  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() { 
  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) {
  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() { 
  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];}
}
	
/******************************************************************************************************************/
	//********************************************************************	
	//   Toutes les fonctions permettant d'ouvrir une fenetre fille      *
	//********************************************************************	
//ouvre une photo dans une fenetre fille à la taille de la photo
function fenetrephoto2 (repimages, lo, ha, nomimage,id)
{	
	browser=window.open("visualisation.asp?image="+repimages+"&id="+id, nomimage,"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,width="+lo+",height="+ha)
}
function new_browserFF(src,name,h) 
{
size=",width=565,height="+h
browser=window.open(src,name,"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}	
function new_browserFFno(src,name,h) 
{
size=",width=565,height="+h
browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}

function new_browser(src,name,w,h) 
{
	size=",width="+w+",height="+h
	browser=window.open(src,name,"resizable=yes,scrollbars=yes,toolbar=yes,status=yes,menubar=yes,location=1,directories=yes,top=0,left=0"+size)
}

function new_browser1(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=no,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}

function new_browser2(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}

function new_browser3(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=no,scrollbars=yes,toolbar=yes,status=no,menubar=yes,location=0,directories=no,top=0,left=0"+size)
}			
function new_browser4(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}	

function photothequeFF(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,top=0,left=0"+size)
}	
		
function imprimer ()
{
	new_browser1("imprimer.asp",'imprimer',320,240)
}

function calendrier(src,name,w,h) 
{
size=",width="+w+",height="+h
browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no,top=350,left=700"+size)
}

	//********************************************************************	
	//   fonction permettant d'ouvrir une fenetre fille de taille fixe   *
	//********************************************************************		
	function new_browserUpload(src,name,w,h)
	{
		size=",width="+w+",height="+h
		browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no"+size)
	}	
		
	function new_browserSuppr(src,name)
	{
		w = 330;
		h = 130;
		size=",width="+w+",height="+h
		browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no"+size)
	}			
		
	function fenetrefichier (monimage,repimages)
	{	
	//alert(monimage+"\n"+repimages);				

		//monURL = "../" + repimages +	"/" + eval ("document.formulaire."+monimage+".value")
		recupphoto = eval("window.document.formulaire." + monimage + ".value");
		if (recupphoto != "")
		{
			monURL = repimages + recupphoto ;
			browser=window.open(monURL,'fichier',"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no,width=640,height=480")
		}
		else
			browser=window.open("CQ_aucunfichier.asp","fichier","resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no,width=200,height=200")			
	
	}
/******************************************************************************************************************/
/******************************************************************************************************************/
	
	
// SUPPRIME LA SELECTION D'UNE LISTBOX
function supprime_select(formulaire,destination)
	{
		var destlen =	eval("document."+formulaire+"."+destination+".length")-1
		for (a=destlen ; a>=0; a--)
			{			
				if ( eval("document."+formulaire+"."+destination+".options[a].selected == true") ) 
				{					
					eval("document."+formulaire+"."+destination+".options[a] = null");
				}
			}
	}
	
function decoche(formulaire)
{
	eval("document."+formulaire+".all.checked = false");
}
	
function VideListBox(formulaire,destination)
{
	var destlen = eval("document."+formulaire+"."+destination+".length") - 1		
	for (i=destlen ; i>=0; i--)	eval("document."+formulaire+"."+destination+".options[i] = null");

}	
// AJOUTE LA SELECTION D'UNE LISTBOX A UNE AUTRE LISTBOX
function ajoute_select(formulaire,sources,destination)
	{
	var sourceslen = eval("document."+formulaire+"."+sources+".length")
	for (i=0; i< sourceslen; i++)
		{
		var destlen =	eval("document."+formulaire+"."+destination+".length")
		if (  eval("document."+formulaire+"."+sources+".options[i].selected == true") )
			{
				trouve = "faux"
				// verification si l'element est deja present
				for (j=0; j<destlen ; j++)
				{
					if (   eval("document."+formulaire+"."+sources+".options[i].value")  ==   eval("document."+formulaire+"."+destination+".options[j].value")  )
					{
						trouve = "vrai"
					}
				}
				// ajout de l'element s'il n'est pas deja present
				if (trouve == "faux")
				{
					opt = new Option(   eval("document."+formulaire+"."+sources+".options[i].text")  );
					opt.value = eval("document."+formulaire+"."+sources+".options[i].value") ;	

					
					eval("document."+formulaire+"."+destination+".options[destlen] = opt") ;								
				}	
			}
		}
	ordonne (formulaire,sources,destination);
	}
// reordonne la listbox
function ordonne (formulaire,sources,destination)
	{	
		var taille  = eval("document."+formulaire+"."+destination+".length")
		var sourceslen = eval("document."+formulaire+"."+sources+".length")		
						
		// sauvegarde des valeurs dans 1 tableau
		valeur = new Array(taille);
		for (i=0; i < taille; i++) 
		{
			valeur[i] = eval("document."+formulaire+"."+destination+".options[i].value");
		}
					
		//on vide la select
		for (i=(taille-1); i>=0; i--) eval("document."+formulaire+"."+destination+".options[i] = null");

		//on rempli la select dans l'ordre
		for (i=0; i<sourceslen ; i++)
		{
			trouve = "faux"

			// verification si l'element est present
			for (j=0; j<taille ; j++)
				if (eval("document."+formulaire+"."+sources+".options[i].value") == valeur[j]) trouve = "vrai";
					
			// ajout de l'element s'il est present
			if (trouve == "vrai")
			{
				opt = new Option(   eval("document."+formulaire+"."+sources+".options[i].text")  );
				opt.value = eval("document."+formulaire+"."+sources+".options[i].value") ;	
				
				var taille2 =  eval("document."+formulaire+"."+destination+".length")
				
				eval("document."+formulaire+"."+destination+".options[taille2] = opt");														
			}	
		}
	}
	
// SELECTIONNE TOUS LES ELEMENTS D'UNE LISTBOX (afin de soumettre le formulaire)
function select_all(formulaire,obj)
{
	var k = eval("document."+formulaire+"."+obj+".length") - 1
	for (i=k; i>=0; i--)
	{
		eval("document."+formulaire+"."+obj+".options[i].selected = true");
	}
}	



function resizePopUp(monImage,id,monTitre)
    {
	w = window.open('','chargement','width=10,height=10');
	w.document.write( "<html><head><title>"+monTitre+"</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "IE5=NN4=NN6=false;\n");
	w.document.write( "if(document.all)IE5=true;\n");
	w.document.write( "else if(document.getElementById)NN6=true;\n");
	w.document.write( "else if(document.layers)NN4=true;\n");
	w.document.write( "function autoSize() {\n");
	w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+31);\n");
	w.document.write( "else if(NN6) self.sizeToContent();\n");
	w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+20);\n");
	w.document.write( "self.focus();\n");
	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	w.document.write( "<a href='javascript:window.close();'><img src='"+monImage+"' border=0 alt='"+monTitre+"'></a>" );
	w.document.write( "</body></html>" );
	w.document.close();
	}

