$(document).ready(function(){
    
    /** pas de bordure sur les derniers LI du menu Top **/
    $("#menu ul").each(function(){
        $(this).children().last().css("border-right",0);
    });
    
    /* Calendrier */
    $.ajax({
        url: "/fileadmin/php/json.php",
        data: "special=json-cal",
        dataType: "json",
        success: function(calendarEvents){
        
           $("#calendar-right").datepicker({
               "dateFormat":'yy-mm-dd',
               numberOfMonths: [1, 1],               
               beforeShowDay: function (date){
                   for (i = 0; i < calendarEvents.length; i++) {
                       if (date.getMonth() == calendarEvents[i][0] - 1 
                       && date.getDate() == calendarEvents[i][1]
                       && date.getFullYear() == calendarEvents[i][2]) {
                           return [true,"date-hightlight",""]; 
                       }
                   }
                   return [true, ""];
               },
               onSelect: function(dateText, inst) {                   
                   document.location.href="/"+ lang +"/temporada-2011/calendario/?date="+ dateText;
               }
           });
        }
    });
    
    /* Sponsors */
    $('#divMajor')
    .css({
        "margin":"0 0 0 0"
    })
    .flash({swf:'/fileadmin/templates/images/major.swf',width:140,height:140});
    
    $('#divMinor')
    .css({
        "margin":"20px 0 0 0"
    })
    .flash({swf:'/fileadmin/templates/images/minor.swf',width:180,height:85});
    
    
    /** Diapo HOME **/
    
    //$("#c105 li.csc-textpic-lastcol img").replaceWith('<div id="homeDiapo">&nbsp;</div>');
    $('#c105 li.csc-textpic-lastcol')
    .flash({swf:'/fileadmin/templates/images/diaporama.swf',width:294,height:219});    
});
