<!--
	'vbscript Document
	'Écrit une ligne de download, sert à downloader le contenu de "date_picker.htm"
	document.write("<DOWNLOAD id=dwn style=""behavior:url(#default#download)"" />")

    sub onDone(src)
	    'Fonction qui est appeler lorsque le download de "date_picker.htm" est terminer
		'Écrit le contenu de "date_picker.htm" dans l'objet popUp
		'Innitialise des valeurs d'affichage
		oPopup.document.write(src)
		oPopup.document.body.topMargin = 0
		oPopup.document.body.leftMargin = 0		
		oPopup.document.body.style.borderwidth = 0
		oPopup.document.body.scroll = "no"
    end sub
	
    sub ShowCalender(leControl, retour)
		'Fonction qui affiche le calendrier
		
		'Si le champ associé au calendrier contient une date valide 
		'Innitialise le calendrier avec cette date
		'Si non, innitialise le calendrier avec la date du system

		if isDate(retour.value) then
			oPopup.document.parentWindow.Redraw retour.value, 0
		else
			oPopup.document.parentWindow.Redraw date(), 0		
		end if
		
		'Inscrit le champ de associé dans une variable de retour du calendrier
		oPopup.document.parentWindow.CalMois.retour = retour.id

		'Affiche le calendrier à une position relative au champ associé
		oPopup.show 0, document.all(leControl).offSetHeight, 140 , 129, document.all(leControl)
    end sub

    
	window.attachEvent "onload", getRef("date_window_onload")
	sub date_window_onload
		'Fonction qui au démarage de la page cherche tout les input qui ont l'attribut date = true
		'et qui affiche le bouton de date picker
		
		for each key in document.all.tags("input")
			if key.type = "text" then
				if key.getAttribute("date") = "true" AND key.getAttribute("id") <> "" then
					imgPicker = "<IMG name='"&key.id&"_piker' align='absmiddle' src='scripts/date_picker.gif' language='javascript' onClick='ShowCalender(this.name, "&key.id&")'>"
					key.insertAdjacentHTML "afterEnd", imgPicker
				end if
			end if
		next
	End Sub

    'Cré le popUp qui reçois le calendrier
	set oPopup = window.createPopup()
	'Démarre le download du contenu de "date_picker.htm"
    dwn.startDownload "scripts/date_picker.htm", GetRef("onDone")

//-->	
