function datereset(){
    /*mydate = new Date;
    mydate2 = new Date;
    mydate2.setDate(mydate2.getDate() + 2);
    document.ecriveznous.frmdatein.value = mydate.getDate() + "/" + (mydate.getMonth() + 1) + "/" + mydate.getFullYear();
    document.ecriveznous.frmdatein2.value = mydate2.getDate() + "/" + (mydate2.getMonth() + 1) + "/" + mydate2.getFullYear();*/
	document.ecriveznous.frmdatein.value = 'jj/mm/aaaa';
	document.ecriveznous.frmdatein2.value = 'jj/mm/aaaa';

}
function isDate(date){

				var pattern= new RegExp(/\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/);

				return pattern.test(date);

			}

			function parseDate(str) {

				var mdy = str.split('/');

				return new Date(parseInt(mdy[2]), parseInt(mdy[1]-1), parseInt(mdy[0]));

			}

			function dayDiff(first, second) {

				return (second-first)/(1000*60*60*24);

			}

			function validateMoteur(){

				var isValid = true;

				try{

					d1 = document.ecriveznous.frmdatein.value;

					isValid = isDate(d1);

					if(!isValid){

						alert('Veuillez préciser la date de départ.');

						return isValid;

					}

					

					d = new Date();

					d0 =  d.getDate() + '/' +  parseInt(d.getMonth()+1) + '/' +  d.getFullYear();

					var diff = dayDiff(parseDate(d0), parseDate(d1));

					if(diff <= 0){

						alert('La date de départ doit être supérieure à la date du jour.');

						return false;

					}

					

					d2 = document.ecriveznous.frmdatein2.value;

					isValid = isDate(d2);

					if(!isValid){

						alert('Veuillez préciser la date de retour.');

						return isValid;

					}

					

					

					var diff = dayDiff(parseDate(d1), parseDate(d2));

					

					if(diff < 1){

						alert('La date de départ doit être supérieure à la date retour.');

						return false;

					}

					return true;

				}

				catch(error){

					isValid = false;

				}

				return isValid;

			}


new Calendar({
    inputField: "frmdatein",
    dateFormat: "%d/%m/%Y",
    trigger: "du3",
    bottomBar: !1,
    align: "du3",
    min: Calendar.dateToInt(new Date),
    onSelect: function(){
        this.hide()
    }
});
new Calendar({
    inputField: "frmdatein2",
    dateFormat: "%d/%m/%Y",
    trigger: "du4",
    bottomBar: !1,
    align: "du4",
    min: Calendar.dateToInt(new Date),
    onSelect: function(){
        this.hide()
    }
});
new Calendar({
    inputField: "frmdatein",
    dateFormat: "%d/%m/%Y",
    trigger: "frmdatein",
    bottomBar: false,
    align: "du3",
    min: Calendar.dateToInt(new Date()),
    onSelect: function(){
        this.hide()
    }
});
new Calendar({
    inputField: "frmdatein2",
    dateFormat: "%d/%m/%Y",
    trigger: "frmdatein2",
    bottomBar: false,
    align: "du4",
    min: Calendar.dateToInt(new Date()),
    onSelect: function(){
        this.hide()
    }
});
