
    /* retourne une date format YYYY/MM/DD suivant une Date*/
    function getDateFormat(date) {
        var day = date.getDate();
        var month = date.getMonth() + 1;

        if( day < 10 ){ day = "0" + day; }
        if( month < 10 ){ month = "0" + month; }

        return( date.getFullYear() + "_" + month + "_" + day);
    }

    /* affiche une div identifier par une date */
    function afficheInfoDate(date) {
        var jour = getDateFormat(date);
        var div = document.getElementById("D"+jour);
        if(div)
        {
            var DivSize = div.offsetWidth;
            var size = getSize();
            if(DivSize == 0) DivSize = 300;
            /*if(IE)
            {
//                 div.style.position = "absolute";
                div.style.visibility = "visible";
                if(div.style.left)div.style.left =  (sourisX - (DivSize+15)) +"px";
// div.style.left =  ((sourisX + document.body.leftMargin) - DivSize) + "px";
//                  div.style.left = ((sourisX - (size[0]-780)/2 ) - DivSize) +"px";
                if(div.style.top) div.style.top = sourisY +"px" ;
                div.style.display = "block";
            }
            else
            {
                div.style.left =  (sourisX - (DivSize+15)) +"px";
//                 div.style.left =  ((sourisX - (size[0]-780)/2 ) - DivSize) +"px";
                div.style.top = sourisY + "px";
                div.style.display = "block";
            }*/
            $(div).css({"position":"absolute", "display":"block","left":(sourisX - (DivSize+15)) +"px","top":sourisY+"px"});
        }
    }

    /* cache une div indentifier pour une date */
    function cacheInfoDate(date) {
        var jour = getDateFormat(date);
        var div = document.getElementById("D"+jour);
        if(div)
        {
            div.style.display = "none";
            if(IE)div.style.visibility = "hidden"; // IE
        }
    }
    /* verifie qu'un date est un concert */
    function dateIsSpecial(year, month, day) {
        if(SPECIAL_DAYS[year] == null) return false;
        var m = SPECIAL_DAYS[year][month];
        if (!m) return false;
        for (var i in m) if (m[i] == day) return true;
        return false;
    }

    /* functions appeles lors des events */
    function onSelect(calendar,date){datachanged(calendar,date);}
    function onClose(calendar) {};
    
    /* check les jours a afficher */
    function dateStatusHandler(date, y, m, d) {
        if ( dateIsSpecial(y, m, d)) return "special";
        else if( TODAY.getFullYear() == y && TODAY.getMonth() == m && TODAY.getDate() == d ) return "today";
        else return true;
        // return true above if you want to disable other dates
    }

    /* Quand on click sur une date */
    function datachanged(calendar,date){
        if (calendar.dateClicked) {
            // OK, on a selectionn&eacute; une date
            //si c'est une date de concert
            if( dateIsSpecial(calendar.date.getFullYear(), calendar.date.getMonth(), calendar.date.getDate()) ) window.location = "programmation.php?date="+date+"#soiree";
        }
    }

