$(function(){
  // Datepicker
  $('#arrivo').datepicker({
    dateFormat: 'dd MM yy',
    monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
    minDate: new Date(),
    buttonImage: 'http://www.torredeldiamante.com/images/calendar.gif',
    buttonImageOnly: true,
    showOn: "both",
    firstDay: 1,
    onSelect: function() {
      var dataArrivo = $('#arrivo').datepicker("getDate");
      if(dataArrivo != null){
        var dataPartenza = dataArrivo;
        dataPartenza.setDate(dataPartenza.getDate()+1);
        $('#partenza').datepicker("setDate", dataPartenza);
      }
    }
  });
    $('#partenza').datepicker({
    dateFormat: 'dd MM yy',
    monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
    minDate: new Date(),
    buttonImage: 'http://www.torredeldiamante.com/images/calendar.gif',
    buttonImageOnly: true,
    showOn: "both",
    firstDay: 1
  });

    $('#arrivo_form').datepicker({
    dateFormat: 'dd MM yy',
    monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
    minDate: new Date(),
    firstDay: 1,
    onSelect: function() {
      var dataArrivo = $('#arrivo_form').datepicker("getDate");
      if(dataArrivo != null){
        var dataPartenza = dataArrivo;
        dataPartenza.setDate(dataPartenza.getDate()+1);
        $('#partenza_form').datepicker("setDate", dataPartenza);
      }
    }
  });
    $('#partenza_form').datepicker({
    dateFormat: 'dd MM yy',
    monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
    minDate: new Date(),
    firstDay: 1
  });
});
