<!--
/*
	Update_Droplist(droplist1,droplist2,message) 
	-> Mettre à jour un droplist associé sans avoir à rafraichir la page.
	
	recherche(path_id)
	-> Validation de la recherche du site public du CSSSVC
	
	open_window(mypage, myname, w, h, scroll)
	-> Ouverture d'une fenêtre en popup
	
	telechargement(mypage, myname, w, h, scroll)
	-> Ouverture d'une fenêtre popup pour le téléchargement
	
	MM_preloadImages()
	-> Préload d'image
	
	MM_swapImgRestore()
	-> Restore d'images après rollover
	
	MM_findObj(n, d)
	-> Recherche d'object
	
	MM_swapImage()
	-> Rollover d'images
*/

//Mettre à jour un droplist associé sans avoir à rafraichir la page.
//Méhode similaire à AJAX
function Update_Droplist(droplist1,droplist2,message) {

	
	//OBJECT
	obj_droplist1 = eval("document.theform." + droplist1);
	obj_droplist2 = eval("document.theform." + droplist2);
	
	//Valeur sélectionné dans le droplist
	drop_value = obj_droplist1.value;
	
	if(drop_value == "null" || drop_value == ""){
	
		//Efface le drop list 2
		obj_droplist2.options.length = 0;
	
	} else {
	
		//Récupérer les informations Onchange
		//------------------------------------------------
		
		//Path du champ hidden text
		path_text = "document.theform.text_" + drop_value + ".value"; 
		path_object_text = "document.theform.text_" + drop_value; 
		//Path du champ hidden id
		path_id = "document.theform.id_" + drop_value + ".value"; 
		path_object_id = "document.theform.id_" + drop_value; 
		
		
		//Si les object Hidden existe pour l'élément
		if(eval(path_object_text && path_object_id)){
		
			//Valeur texte du hidden field correspondant au drop list 2
			hidden_text = eval(path_text);
			//Valeur ID du hidden field correspondant au drop list 2
			hidden_id = eval(path_id);
			
			//Split des valeurs textes dans un tableau
			split_text = hidden_text.split("¤");
			//Split des valeurs ID dans un tableau
			split_id = hidden_id.split("¤");
			//------------------------------------------------
				
			//Mise à jour du second droplist
			//------------------------------------------------
			
			//Efface le droplist 2
			obj_droplist2.options.length = 0;
			
			//Créé le nombre d'option nécessaire dans le droplist 2
			obj_droplist2.options.length = split_id.length + 1;
			
			//Ajout de l'option message à valeur NULL si sous élément
			if(split_id.length > 0){
				obj_droplist2.options[0].text = message;
				obj_droplist2.options[0].value = "null";
			}
	
			for (i = 0; i < split_id.length; i++) {
				obj_droplist2.options[i+1].text = split_text[i];
				obj_droplist2.options[i+1].value = split_id[i];
			}
			
		} else {
			
			//Efface le droplist 2
			obj_droplist2.options.length = 0;
		}	
		//------------------------------------------------
		
	}
	
		
 }


function recherche(path_id){
	//Submit pour la recherche
	//------ validation du champ ------
	if (document.theform.txtMotsCles.value == "") {
		alert("Vous devez entrer un mot clés pour la recherche!");
		document.theform.txtMotsCles.focus();
		return false;	
	}else{
		//Le champ n'est pas vide
		if (document.theform.txtMotsCles.value.length < 3){
			alert("Les mots de moins de trois lettres ne sont pas acceptés.");
			document.theform.txtMotsCles.focus();
			return false;
		}else{
			//------ Envoie du formulaire pour la recherche ------
			if (path_id == 0){
				document.theform.action = "recherche/index.php" ;
			}else if (path_id == 1){
				document.theform.action = "../recherche/index.php" ;
			}
			document.theform.submit();
			return false;
		}
	}
}

function open_window(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 20;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function telechargement(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 20;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	//if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	
	//Fermer la fenêtre enfant
	win.window.close();
	
}

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_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_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

  //On mouse out du bouton du menu de gauche, l'image reprend sa src initiale
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

  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];}
}
//-->
