// JavaScript Document

function calendrier(name_select) {   
    FirstDate = new Date(1980, 0, 1);
    SecondDate = new Date(1980, 0, 2);
    DayLength = SecondDate.getTime() - FirstDate.getTime()
    
    MyDate = new Date(); 
    MyDay = MyDate.getDay();
    // Récupère le nombre de jours le séparant du samedi
    Interval = 6 - MyDay;
    // Nombre de millisecondes le séparant du samedi
    NbMS = Interval * DayLength;
    //alert(7*NbMS);
    
    NewNbMS = NbMS;
    
    document.write('<select name="'+name_select+'" >');
    
    for(i=0;i<52;i++)
    {
     
     if(i != 0)
     {
      NewNbMS = NbMS+(i*7*DayLength);
     }
    
     SaturdayDate = new Date(MyDate.getTime() + NewNbMS);
    
     SaturdayDay  = SaturdayDate.getDate();
     SaturdayMonth = SaturdayDate.getMonth()+1; /* le décomptage des mois de se fait de 0 a 11  avec cette fonction */ 
     SaturdayYear = SaturdayDate.getFullYear();
    	
	
	
     if(SaturdayDay < 10)
     {
      SaturdayDay = '0' + SaturdayDay;
     } 
     if(SaturdayMonth < 10)
     {
      SaturdayMonth = '0' + SaturdayMonth;
     }
     
     dateFormatFr = SaturdayDay + '/' + SaturdayMonth + '/' + SaturdayYear;
     dateFormatUk = SaturdayYear + '/' + SaturdayMonth + '/' + SaturdayDay;
     
     document.write('<option id="begindate_op'+i+'" value="'+ dateFormatFr +'">' + dateFormatFr+ '</option>');
    }
    document.write('</select>');
	
}