// doc sur le calendar :  http://yellow5.us/projects/datechooser/
		
//events.add(window, 'load', WindowLoad);

function loadCalendar() {

    var ndExample1 = document.getElementById('datechooserex1');
    ndExample1.DateChooser = new DateChooser();
    
    // premiere date selectionnable = la date du jour + 2 jours
    var objEarlyDateEx3 = new Date();
    //objEarlyDateEx3.setDate(objEarlyDateEx3.getDate()+3);
	objEarlyDateEx3.setDate(objEarlyDateEx3.getDate()); 
    ndExample1.DateChooser.setEarliestDate(objEarlyDateEx3);
    
    // jours selectionnables = tous sauf les week ends
    ndExample1.DateChooser.setAllowedDays(['1', '2', '3', '4', '5']);
    
    // la semaine commence le lundi = jour 1
    ndExample1.DateChooser.setWeekStartDay(nDay = 1);

    // Check if the browser has fully loaded the DateChooser object, and supports it.
    if (!ndExample1.DateChooser.display) {
        return false;
    }

    /*ndExample1.DateChooser.setCloseTime(200);*/
    
    // deplacement du layer
    ndExample1.DateChooser.setXOffset(30);
    
    // mise en forme de la date via la fonction
    ndExample1.DateChooser.setUpdateFunction(FunctionEx1);

    document.getElementById('datelinkex1').onclick = ndExample1.DateChooser.display;
    $('telephone2').onclick = ndExample1.DateChooser.display;

    return true;
}

function FunctionEx1(objDate) {
    // objDate is a plain old Date object, with the getPHPDate() property added on.
    document.getElementById('telephone2').value = objDate.getPHPDate('d/m/Y');
    $('telephone2').setAttribute("readonly", "readonly");
    return true;
}
