var IxFromDate, IxToDate;

var oPopup = window.createPopup();
var oPopBody = oPopup.document.body;

oPopBody.style.backgroundColor = "#FFDC00";
oPopBody.style.border = "solid black 1px";
oPopBody.style.margin = "0px";
oPopBody.style.color = "black";
oPopBody.fontSize = "12px";
oPopBody.style.textAlign = "center";


/****************************************************************************************************************************************************
*																																					*
*													Fonction utilisés la Popup des documents														*
*																																					*
/***************************************************************************************************************************************************/


function OuvrirPopup(Nom)
{
	window.open('Calendrier.asp', Nom, 'resize=no, location=no, width=280, height=180, menubar=no, status=no, scrollbars=no, menubar=no')
//	window.open('Calendrier.asp', Nom, '')
}


function showPopup(Element)
{
	var largeur_car = 8;
	var marge = 20;
	var largeur = 0;
	var hauteur = 0;
	var texte = Element;
	largeur = marge + largeur_car * texte.length;
	oPopBody.innerHTML = texte;
	oPopup.show(event.x + 10, event.y + 10, largeur, 20, document.body);
}


function hidePopup()
{
	if(oPopup)
		oPopup.hide();
}


/****************************************************************************************************************************************************
*																																					*
*															Fonction utilisés pour les dates														*
*																																					*
/***************************************************************************************************************************************************/


function Init()
{
	var today;
	today = new Date();
	if (document.Search.LSTANNEE.value == "")
	{
		document.Search.LSTANNEE.value = parseInt(today.getYear(), 10);
	}
}


function InitEff()
{
	document.Search.reset();

	var today;
	today = new Date();
	if (document.Search.LSTANNEE.value == "")
	{
		document.Search.LSTANNEE.value = parseInt(today.getYear(), 10);
	}
}


function LastDayOfMonth(aMonth)
{
	switch (aMonth)
	{
		case 1:
			return "31";
		case 2:
			return "28";
		case 3:
			return "31";
		case 4:
			return "30";
		case 5:
			return "31";
		case 6:
			return "30";
		case 7:
			return "31";
		case 8:
			return "31";
		case 9:
			return "30";
		case 10:
			return "31";
		case 11:
			return "30";
		case 12:
			return "31";
	}
}


function FormatDate(aDateData, aDefaultDay, aDefaultMonth)
{
	var lDatePart = "";
	var lDateLen = aDateData.length;
	var lDateData = "";
	var lCharCode;

	for (i = 0; i < lDateLen; i++)
	{
		lCharCode = aDateData.charCodeAt(i);
		if (lCharCode < 47 || lCharCode > 57)
			return false;
		else if (lCharCode == 47)
		{
			if (lDatePart.length == 0)
				lDatePart = aDefaultDay;
			else if (lDatePart.length == 1)
				lDatePart = "0" + lDatePart;
			lDateData = lDateData + lDatePart;
			lDatePart = "";
		}
		else
			lDatePart = lDatePart + aDateData.charAt(i);
	}
	lDateData = lDateData + lDatePart;
	lDateLen = lDateData.length;
	if (lDateLen == 2)
	{
		if (parseInt(lDateData, 10) > 50)
			gDateData = aDefaultDay + "/" + aDefaultMonth + "/19" + lDateData;
		else
			gDateData = aDefaultDay + "/" + aDefaultMonth + "/20" + lDateData;
	}
	else if (lDateLen == 4)
	{
		lDatePart = lDateData.substring(0, 2);
		if (parseInt(lDatePart, 10) <= 12)
		{
			if (aDefaultDay == "31")
				gDateData = LastDayOfMonth(parseInt(lDatePart, 10)) + "/" + lDatePart;
			else
				gDateData = aDefaultDay + "/" + lDatePart;
			lDatePart = lDateData.substring(2, 4);
			if (parseInt(lDatePart, 10) > 50)
				gDateData = gDateData + "/19" + lDatePart;
			else
				gDateData = gDateData + "/20" + lDatePart;
		}
		else if (lDatePart == 19 || lDatePart == 20)
		{
			gDateData = aDefaultDay + "/" + aDefaultMonth + "/" + lDateData;
		}
		else
			return false;
	}
	else if (lDateLen == 6)
	{
		gDateData = lDateData.substring(0, 2);
		if (gDateData == "00")
			return false;
		lDatePart = lDateData.substring(2, 4);
		if (parseInt(lDatePart, 10) <= 12)
		{
			gDateData = lDateData.substring(0, 2) + "/" + lDatePart;
			lDatePart = lDateData.substring(4, 6);
			if (parseInt(lDatePart, 10) > 50)
				gDateData = gDateData + "/19" + lDatePart;
			else
				gDateData = gDateData + "/20" + lDatePart;
		}
		else if (lDatePart == 19 || lDatePart == 20)
		{
			lDatePart = lDateData.substring(0, 2);
			if (aDefaultDay == "31")
				gDateData = LastDayOfMonth(parseInt(lDatePart, 10)) + "/" + lDatePart + "/" + lDateData.substring(2, 6);
			else
				gDateData = aDefaultDay + "/" + lDatePart + "/" + lDateData.substring(2, 6);
		}
		else
			return false;
	}
	else if (lDateLen == 8)
	{
		gDateData = lDateData.substring(0, 2);
		lDatePart = lDateData.substring(2, 4);
		if (gDateData == "00")
			return false;
		if (lDatePart == "00")
			return false;
		if (gDateData > LastDayOfMonth(parseInt(lDatePart)))
			return false;
		if (lDatePart > 12)
			return false;
		gDateData = gDateData + "/" + lDatePart;
		lDatePart = lDateData.substring(4, 6);
		if (lDatePart != 19 && lDatePart != 20)
			return false;
		gDateData = gDateData + "/" + lDatePart + lDateData.substring(6, 8);
	}
	else
	{
		return false;
	}
	return true;
}


function DateFrom(FormName, IxFormName, DTFormName)
{
	if (FormName.value == "")
	{
		IxFormName = "";
		return;
	}
	if (FormatDate(FormName.value, "01", "01"))
		FormName.value = gDateData;
	else
	{
		window.alert("Date invalide.");
		FormName.value = "";
	}
	IxFormName.value = FormName.value.substring(6,10) + FormName.value.substring(3,5) + FormName.value.substring(0,2)

	if (DTFormName.value != "")
	{
		if (FormName.value.substring(6,10) > DTFormName.value.substring(6,10))
		{
			window.alert("Date invalide.");
			FormName.value = "";
		}
		else
		{
			if (FormName.value.substring(6,10) == DTFormName.value.substring(6,10))
			{
				if (FormName.value.substring(3,5) > DTFormName.value.substring(3,5))
				{
					window.alert("Date invalide.");
					FormName.value = "";
				}
				else
				{
					if (FormName.value.substring(3,5) == DTFormName.value.substring(3,5))
					{
						if (FormName.value.substring(0,2) > DTFormName.value.substring(0,2))
						{
							window.alert("Date invalide.");
							FormName.value = "";
						}
					}
				}
			}
		}
	}
}


function DateTo(FormName, IxFormName, DTFormName)
{
	if (FormName.value == "")
	{
		IxFormName = "";
		return;
	}
	if (FormatDate(FormName.value, "31", "12"))
		FormName.value = gDateData;
	else
	{
		window.alert("Date invalide.");
		FormName.value = "";
	}
	IxFormName.value = FormName.value.substring(6,10) + FormName.value.substring(3,5) + FormName.value.substring(0,2)

	if (DTFormName.value != "")
	{
		if (FormName.value.substring(6,10) < DTFormName.value.substring(6,10))
		{
			window.alert("Date invalide.");
			FormName.value = "";
		}
		else
		{
			if (FormName.value.substring(6,10) == DTFormName.value.substring(6,10))
			{
				if (FormName.value.substring(3,5) < DTFormName.value.substring(3,5))
				{
					window.alert("Date invalide.");
					FormName.value = "";
				}
				else
				{
					if (FormName.value.substring(3,5) == DTFormName.value.substring(3,5))
					{
						if (FormName.value.substring(0,2) < DTFormName.value.substring(0,2))
						{
							window.alert("Date invalide.");
							FormName.value = "";
						}
					}
				}
			}
		}
	}
}


/****************************************************************************************************************************************************
*																																					*
*														Fonction pour les recherches multi-critères													*
*																																					*
/***************************************************************************************************************************************************/


function DoSearch()
{
	document.Search.REQUEST.value = "";
	document.Search.REQUEST2.value = "";
	var ChampTexte = trim(document.Search.TEXTE.value);
	var TypeChr = "TROUVE";

	var Lefiltre = "xfilter(name " + '"' + "*.pdf" + '"' + ")";
	document.Search.FILECONDITIONS.value = Lefiltre;
	
	if (document.Search.SEANCE.value == "" && document.Search.DATESEANCEDEPUIS.value == ""  && document.Search.DATESEANCEJUSQUA.value == "" && document.Search.THEMES.value == "" && document.Search.COMMISSIONS.value == "" && document.Search.RAPPORTEURS.value == "" && document.Search.SERVICES.value == "" && document.Search.NUMDEFINITIF.value == "" && document.Search.TYPEDOC.value == "" && document.Search.LSTANNEE.value == "" && document.Search.LSTMOIS.value == "")
	{
		TypeChr = "FAUX";
	}		

	ChampTexte = Remplace(ChampTexte, 'ç', 'c');
	ChampTexte = Remplace(ChampTexte, 'é', 'e');
	ChampTexte = Remplace(ChampTexte, 'è', 'e');
	ChampTexte = Remplace(ChampTexte, 'ê', 'e');
	ChampTexte = Remplace(ChampTexte, 'ë', 'e');
	ChampTexte = Remplace(ChampTexte, 'à', 'a');
	ChampTexte = Remplace(ChampTexte, 'â', 'a');
	ChampTexte = Remplace(ChampTexte, 'ä', 'a');
	ChampTexte = Remplace(ChampTexte, 'î', 'i');
	ChampTexte = Remplace(ChampTexte, 'ï', 'i');
	ChampTexte = Remplace(ChampTexte, 'ô', 'o');
	ChampTexte = Remplace(ChampTexte, 'ö', 'o');
	ChampTexte = Remplace(ChampTexte, 'ù', 'u');
	ChampTexte = Remplace(ChampTexte, 'û', 'u');
	ChampTexte = Remplace(ChampTexte, 'ü', 'u');

	/* CAS D'UNE RECHERCHE PLEIN TEXTE*/
	if (TypeChr == "FAUX")
	{
		if (ChampTexte == "")
		{
			document.Search.REQUEST.value = "";
		}
		else
		{			
			document.Search.REQUEST.value = "";
			ChampTexte = ChampTexte.toUpperCase();
			addToRequest(trim(ChampTexte))
		}
		document.Search.submit()
	}

	/* CAS D'UNE RECHERCHE MULTI-CRITERES*/
	else
	{
		/* PLEIN TEXTE */
		if (ChampTexte == "")
		{
			document.Search.REQUEST.value = "";
		}
		else
		{
			document.Search.REQUEST.value = "";
			ChampTexte = ChampTexte.toUpperCase();
			addToRequest(trim(ChampTexte))
		}

		/* GESTION DES DATES */
		if (document.Search.DATESEANCEDEPUIS.value.length != 0 || document.Search.DATESEANCEJUSQUA.value.length != 0)
		{
			document.Search.REQUEST2.value += '+DateSeance::';
			if (document.Search.DATESEANCEDEPUIS.value.length != 0)
			{
				document.Search.REQUEST2.value += 
				document.Search.DATESEANCEDEPUIS.value.substring(6, 10) +
				document.Search.DATESEANCEDEPUIS.value.substring(3, 5) +
				document.Search.DATESEANCEDEPUIS.value.substring(0, 2);
			}
			else
			{
				document.Search.REQUEST2.value += "19000101";
			}

			document.Search.REQUEST2.value += '~~';

			if (document.Search.DATESEANCEJUSQUA.value.length != 0)
			{
				document.Search.REQUEST2.value += 
				document.Search.DATESEANCEJUSQUA.value.substring(6, 10) +
				document.Search.DATESEANCEJUSQUA.value.substring(3, 5) +
				document.Search.DATESEANCEJUSQUA.value.substring(0, 2);
			}
			else
			{
				document.Search.REQUEST2.value += "21000101";
			}
		}

		
				
				if (document.Search.LSTANNEE.value != "")
		{
			if (document.Search.LSTMOIS.value != "")
			{
				var Gestdate = document.Search.LSTANNEE.value
				Gestdate += document.Search.LSTMOIS.value + '01~~';
				Gestdate += document.Search.LSTANNEE.value;
				Gestdate += document.Search.LSTMOIS.value;
				var RecupMois = LastDayOfMonth(parseInt(document.Search.LSTMOIS.value));
				Gestdate += RecupMois;
				addToRequest2(' ( DateSeance contains "' + Gestdate + '" ) ');
				
			}
			else
			{
				var Gestdate = document.Search.LSTANNEE.value
				Gestdate += '0101~~';
				Gestdate += document.Search.LSTANNEE.value;
				Gestdate += '12';
				var RecupMois = LastDayOfMonth(parseInt('12'));
				Gestdate += RecupMois;
				addToRequest2(' ( DateSeance contains "' + Gestdate + '" ) ');
								
			}
		}

		/* NUMDELIB */
		if (document.Search.NUMDEFINITIF.value != "")
		{
			var strNumDelib = trim(document.Search.NUMDEFINITIF.value);
			addToRequest2(' ( NUM_DEFINITIF contains "' + strNumDelib + '" ) ');
		}

		/* TYPESEANCE */
		if (document.Search.SEANCE.value != "")
		{
			var strTypeSeance = document.Search.SEANCE.value;
			strTypeSeance = Remplace(strTypeSeance, "-", " ");
			addToRequest2(' ( TYPE_SEANCE contains "' + strTypeSeance + '" ) ');
		}

		/* THEMES */
		if (document.Search.THEMES.value != "")
		{
			var strTheme = document.Search.THEMES.value;
			strTheme = Remplace(strTheme, "-", " ");
			addToRequest2(' ( THEME contains "' + strTheme + '" ) ');
		}

		/* TYPE DE DOCUMENT */
		if (document.Search.TYPEDOC.value != "")
		{
			var strTypeDoc = trim(document.Search.TYPEDOC.value);
			addToRequest2(' ( TYPE_DOCUMENT contains "' + strTypeDoc + '" ) ');
		}

		/* COMMISSION */
		if (document.Search.COMMISSIONS.value != "")
		{
			var strCom = document.Search.COMMISSIONS.value;
			strCom = Remplace(strCom, "-", " ");
			addToRequest2(' ( COMMISSION_PRINCIPALE contains "' + strCom + '" ) ');
		}

		/* RAPPORTEUR */
		if (document.Search.RAPPORTEURS.value != "")
		{
			var strRapp = document.Search.RAPPORTEURS.value;
			strRapp = Remplace(strRapp, "-", " ");
			addToRequest2(' ( RAPPORTEUR contains "' + strRapp + '" ) ');
		}

		/* SERVICE */
		if (document.Search.SERVICES.value != "")
		{
			var strServ = document.Search.SERVICES.value;
			strServ = Remplace(strServ, "-", " ");
			addToRequest2(' ( SERVICE_REF contains "' + strServ + '" ) ');
		}

		document.Search.submit()
	}
}


/****************************************************************************************************************************************************
*																																					*
*											Fonction permettant la constitution de la requête de recherche											*
*																																					*
/***************************************************************************************************************************************************/


function addToRequest(s)
{
	if (document.Search.REQUEST == "")
		document.Search.REQUEST.value = s
	else
	{
		if(document.Search.REQUEST.value != "")
			document.Search.REQUEST.value = document.Search.REQUEST.value + " " + s
		else
			document.Search.REQUEST.value = s
	}
}


function addToRequest2(s)
{
	if (document.Search.REQUEST2 == "")
		document.Search.REQUEST2.value = s
	else
		if(document.Search.REQUEST2.value != "")
			document.Search.REQUEST2.value = document.Search.REQUEST2.value + " and " + s
		else
			document.Search.REQUEST2.value = s
}


/****************************************************************************************************************************************************
*																																					*
*											Fonction permettant la navigation entre les pages de résulats											*
*																																					*
/***************************************************************************************************************************************************/


function Pagination(DocumentStart, DocumentEnd, DossierStart, DossierEnd)
{
	document.Search.STARTAT.value = DocumentStart;
	document.Search.ENDAT.value = DocumentEnd;
	document.Search.ARRAYSTARTAT.value = DossierStart;
	document.Search.ARRAYENDAT.value = DossierEnd;
	DoSearch();
}


/****************************************************************************************************************************************************
*																																					*
*													Fonction de traitement de chaîne de caractère													*
*																																					*
/***************************************************************************************************************************************************/


function Remplace(expr,a,b)
{
	var i = 0
	while (i != -1)
	{
		i = expr.indexOf(a,i);
		if (i >= 0)
		{
			expr = expr.substring(0, i) + b + expr.substring(i + a.length);
			i += b.length;
		}
	}
	return expr
}


function trim(str)
{
	while (str.charAt(0) == " ")
	{
		str = str.substring(1);
	}
	while (str.charAt(str.length - 1) == " ")
	{
		str = str.substring(0, str.length - 1);
	}
	return str;
}


/****************************************************************************************************************************************************
*																																					*
*														Fonction Spécifique au CRPACA																*
*																																					*
/***************************************************************************************************************************************************/


function montre(titre)
{
	var hauteur = 450
	var largeur = 450
	var top = (screen.height-hauteur) / 2;
	var left = (screen.width-largeur) / 2;
	var options = "menubar=no, scrollbars=yes, statusbar=no"
	window.open(titre, "", "top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
	<!--fenetre = window.open("ListeTheme.asp",'','toolbar=no,location=no,directories=no,status=no,scrollbars=Yes,resizable=yes,copyhistory=no,width=450,height=350')!-->
}


function InsererNumDelib()
{
	document.Search.Tri.options.length = 0;
	var p = new Option("N° de Délibération", 2);
	document.Search.Tri.options[document.Search.Tri.options.length] = p;
	var o = new Option("Date de séance", 1);
	document.Search.Tri.options[document.Search.Tri.options.length] = o;

	document.Search.Tri.options.selectedIndex.text = "N° de Délibération";
}


function InsererNumRapport()
{
	document.Search.Tri.options.length = 0;
	var p = new Option("N° de Rapport", 2);
	document.Search.Tri.options[document.Search.Tri.options.length] = p;

	var o = new Option("Date de séance", 1);
	document.Search.Tri.options[document.Search.Tri.options.length] = o;

	document.Search.Tri.options.selectedIndex.text = "N° de Délibération";
}


function Supprimer(list)
{
	list.options[2] = null;
}


function TypeDocRetour()
{
	if (document.Search.RadioGroup1[0].checked == true)
	{
		document.Search.DATESEANCEDEPUIS.value = ""
		document.Search.DATESEANCEDEPUIS.disabled = true;
		document.Search.Numero.value = "N° de rapport";
		Gereliste = InsererNumRapport()
		document.Search.DATESEANCEJUSQUA.value = ""
		document.Search.DATESEANCEJUSQUA.disabled = true;
	}
	else
	{
		document.Search.DATESEANCEDEPUIS.disabled = false;
		document.Search.DATESEANCEJUSQUA.disabled = false;
		document.Search.Numero.value = "N° de délibération";
		Gereliste = InsererNumDelib()
	}
}


function TypeDocFlag(flag)
{
	if (flag == 1)
	{
		document.Search.DATESEANCEDEPUIS.value = ""
		document.Search.DATESEANCEDEPUIS.disabled = true;
		document.Search.Numero.value = "N° de rapport";
		Gereliste = InsererNumRapport()
		document.Search.DATESEANCEJUSQUA.value = ""
		document.Search.DATESEANCEJUSQUA.disabled = true;
	}
	else
	{
		document.Search.DATESEANCEDEPUIS.disabled = false;
		document.Search.DATESEANCEJUSQUA.disabled = false;
		document.Search.Numero.value = "N° de délibération";
		Gereliste = InsererNumDelib()
	}
}


function SetDateRestriction(aMonthRestriction, aDateRestriction)
{
	var today;
	var nYear;
	var nMonth;
	var nTotalMonth;

	if (aMonthRestriction.value == "")
		return;

	today = new Date();
	nYear = parseInt(today.getYear(), 10);
	nMonth = parseInt(today.getMonth(), 10);
	nTotalMonth = nYear*12 + nMonth - parseInt(aMonthRestriction.value, 10);

	nYear = parseInt(nTotalMonth/12);
	nMonth = parseInt(nTotalMonth%12);

	aDateRestriction.value = nYear*100 + nMonth + 1;
}


function DisplayODJSeance()
{
	SetDateRestriction(document.formODJSeance.MonthRestriction,document.formODJSeance.DateRestriction);
	document.formODJSeance.submit();
}


/****************************************************************************************************************************************************
*																																					*
*														Fonction Spécifique au CG91																	*
*																																					*
/***************************************************************************************************************************************************/

function Erase()
{
	document.Search.reset();
}


function LoadImage()
{
	var i;
	var valAnnee = document.Search.LSTANNEE.value;
	if (valAnnee != "")
	{
		var valDateSel = document.Search.lstdate.options.selectedIndex;
		i = document.Search.lstdate.options.length -1;
		while (i > 0) {
			if (document.Search.lstdate.options[i].value.indexOf(valAnnee) == -1) {
				document.Search.lstdate.options[i] = null;
			}
			i--;
		}
		document.Search.lstdate.options.selectedIndex = valDateSel;
		document.Search.lstdate.disabled = false;
	}
	else
	{
		document.Search.lstdate.disabled = true;
	}
}


function TypeSea()
{
	document.Search.lstdate.disabled = true;
	document.Search.lstdate0.disabled = true;
	document.Search.lstdate1.disabled = true;
	document.Search.lstdate2.disabled = true;
	document.Search.LSTANNEE.options.selectedIndex = "toutes";
	document.Search.lstdate.options.selectedIndex = "toutes";
}


function DateAnnee()
{
	var i, j;
	var TypeSeance = document.Search.SEANCE.value;
	var valAnnee = document.Search.LSTANNEE.value;
	var valDate  = new Option("toutes", "");

	if (TypeSeance == "")
	{
		document.Search.lstdate1.disabled = false;
		document.Search.lstdate2.disabled = false;
		if (valAnnee != "")
		{
			document.Search.lstdate.disabled = false;
			document.Search.lstdate.options.length=0;
			document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
			for (i=0; i < document.Search.lstdate0.options.length; i++) {
				if (document.Search.lstdate0.options[i].value.indexOf(valAnnee) != -1) 
				{
					valDate=new Option(document.Search.lstdate0.options[i].value, document.Search.lstdate0.options[i].value);
					document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				}
			}
		}
		else
		{
			document.Search.lstdate.disabled = true;
			document.Search.lstdate.options.length=0;
			document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
			for (i=0; i < document.Search.lstdate0.options.length; i++) 
			{
				valDate=new Option(document.Search.lstdate0.options[i].value, document.Search.lstdate0.options[i].value);
				document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
			}
		}
	}
	else
	{
		if (TypeSeance == "Assemblée Départementale")
		{
			document.Search.lstdate0.disabled = false;
			document.Search.lstdate2.disabled = false;
			if (valAnnee != "")
			{
				document.Search.lstdate.disabled = false;
				document.Search.lstdate.options.length=0;
				document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				for (i=0; i < document.Search.lstdate1.options.length; i++) {
					if (document.Search.lstdate1.options[i].value.indexOf(valAnnee) != -1) 
					{
						valDate=new Option(document.Search.lstdate1.options[i].value, document.Search.lstdate1.options[i].value);
						document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
					}
				}
			}
			else
			{
				document.Search.lstdate.disabled = true;			
				document.Search.lstdate.options.length=0;
				document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				for (i=0; i < document.Search.lstdate0.options.length; i++) 
				{
					valDate=new Option(document.Search.lstdate0.options[i].value, document.Search.lstdate0.options[i].value);
					document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				}
			}
		}
		else
		{
			document.Search.lstdate0.disabled = false;
			document.Search.lstdate1.disabled = false;
			if (valAnnee != "")
			{
				document.Search.lstdate.disabled = false;
				document.Search.lstdate.options.length=0;
				document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				for (i=0; i < document.Search.lstdate2.options.length; i++) {
					if (document.Search.lstdate2.options[i].value.indexOf(valAnnee) != -1) 
					{
						valDate=new Option(document.Search.lstdate2.options[i].value, document.Search.lstdate2.options[i].value);
						document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
					}
				}
			}
			else
			{
				document.Search.lstdate.disabled = true;			
				document.Search.lstdate.options.length=0;
				document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				for (i=0; i < document.Search.lstdate0.options.length; i++) 
				{
					valDate=new Option(document.Search.lstdate0.options[i].value, document.Search.lstdate0.options[i].value);
					document.Search.lstdate.options[document.Search.lstdate.options.length]=valDate;
				}
			}
		}
	}
}
