jQuery(function() 
{
//<![CDATA[
  var LEFT_CAL = Calendar.setup({
          cont          : "cont",
          fdow          : 1,
          selectionType : Calendar.SEL_MULTIPLE
  });
  
  LEFT_CAL.addEventListener("onSelect", function()
  {
    //var ta = document.getElementById("f_selection");
   // ta.value = this.selection.countDays() + " days selected:\n\n" + this.selection.print("%Y/%m/%d").join("\n");
    
    var count = this.selection.countDays();
    

           //var test = this.selection.normalize()  ;
          var mesDates = LEFT_CAL.selection.get();
           //alert(mesDates);
    //on lance un script php qui recupere les jours sélectionnés
      jQuery.ajax(
			{
				  url: "/php/calendar/ajax/traitement_dates.ajax.php",
				  type: "POST",
				  data : {mesDates : mesDates, currentLG : currentLG, urlAgenda : urlAgenda} ,
				  dataType:"html",
				  beforeSend :function(){jQuery('#res-evt').html("<img src='/php/gmap/images/loading.gif' title='loading'/>");},
				  success: function(retour)
				  {
              //alert(retour);

              jQuery("#res-evt").empty().html(retour);
              //EVENEMENT
              //On définit le nombre d'éléments
              var nombre = jQuery('div.defil').size();

              //On atribut la valeur de la div contenant les éléments (tout_defil)
              jQuery('div.tout_defil').width(nombre*273);

              //définit la position de ma div
              var position = jQuery('div.tout_defil').position();//console.log(position);
              jQuery('div.tout_defil').animate({
                      left: "0px"
                    }, 500 );
              Cufon.refresh();

				  }
			});  
    
  });
  //]]

});

