YAHOO.util.Event.onDOMReady(function () {

        function onButtonClick3() {
            
            /*
                 Create a Calendar instance and render it into the body 
                 element of the Overlay.
            */

            var oCalendar = new YAHOO.widget.Calendar("buttoncalendar3", oCalendarMenu.body.id,{navigator:true});

			
									/***** LANGUE FR ******/

	// Correct formats for Germany: dd.mm.yyyy, dd.mm, mm.yyyy 
	oCalendar.cfg.setProperty("DATE_FIELD_DELIMITER", "."); 
	 
	oCalendar.cfg.setProperty("MDY_DAY_POSITION", 1); 
	oCalendar.cfg.setProperty("MDY_MONTH_POSITION", 2); 
	oCalendar.cfg.setProperty("MDY_YEAR_POSITION", 3); 	 
	oCalendar.cfg.setProperty("MD_DAY_POSITION", 1); 
	oCalendar.cfg.setProperty("MD_MONTH_POSITION", 2); 
	oCalendar.cfg.setProperty("START_WEEKDAY", 1);
	 
	// Date labels for German locale 
	oCalendar.cfg.setProperty("MONTHS_SHORT",   ["Jan", "Fev", "Mar", "Avr", "Mai", "Juin", "Juil", "Aou", "Sep", "Oct", "Nov", "Dec"]); 
	oCalendar.cfg.setProperty("MONTHS_LONG",    ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre"]); 
	oCalendar.cfg.setProperty("WEEKDAYS_1CHAR", ["D", "L", "M", "M", "J", "V", "S"]); 
	oCalendar.cfg.setProperty("WEEKDAYS_SHORT", ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"]); 
	oCalendar.cfg.setProperty("WEEKDAYS_MEDIUM",["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"]); 
	oCalendar.cfg.setProperty("WEEKDAYS_LONG",  ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]); 
	
			
            oCalendar.render();


            /* 
                Subscribe to the Calendar instance's "changePage" event to 
                keep the Overlay visible when either the previous or next page
                controls are clicked.
            */

            oCalendar.changePageEvent.subscribe(function () {
                
                window.setTimeout(function () {

                    oCalendarMenu.show();
                
                }, 0);
            
            });


            /*
                Subscribe to the Calendar instance's "select" event to 
                update the month, day, year form fields when the user
                selects a date.
            */

            oCalendar.selectEvent.subscribe(function (p_sType, p_aArgs) {

                var aDate;

                if (p_aArgs) {
                        
                    aDate = p_aArgs[0][0];
					if(aDate[2]<10) aDate[2]="0"+aDate[2];
					if(aDate[1]<10) aDate[1]="0"+aDate[1];
					
                    YAHOO.util.Dom.get("date_naissance").value = aDate[2]+"/"+aDate[1]+"/"+aDate[0];
					

                }
                
                oCalendarMenu.hide();
            
            });
            

            /*
                 Unsubscribe from the "click" event so that this code is 
                 only executed once
            */

            this.unsubscribe("click", onButtonClick);
        
        }


        // Create an Overlay instance to house the Calendar instance

        var oCalendarMenu = new YAHOO.widget.Overlay("calendarmenu3", { visible: false });


        // Create a Button instance of type "menu"

        var oButton = new YAHOO.widget.Button({ 
                                            type: "menu", 
                                            id: "calendarpicker3", 
                                            label: "Choisir une date", 
                                            menu: oCalendarMenu, 
                                            container: "datefields3" });

		oButton.on("appendTo", function () {

			/*
				 Create an empty body element for the Overlay instance in order 
				 to reserve space to render the Calendar instance into.
			*/
	
			oCalendarMenu.setBody("&#32;");
	
			oCalendarMenu.body.id = "calendarcontainer3";
	
			// Render the Overlay instance into the Button's parent element
	
			oCalendarMenu.render(this.get("container"));
		
        });
        

        /*
            Add a "click" event listener that will render the Overlay, and 
            instantiate the Calendar the first time the Button instance is 
            clicked.
        */

        oButton.on("click", onButtonClick3);
    
    });
