$(document).ready(function() {

    var frm$ = $('.st-booking-form');
    var summary$ = $('.st-booking-summary');

    var toDateDay$ = $('#fewo_booking_request_toDate_day');
    var toDateMonth$ = $('#fewo_booking_request_toDate_month');
    var toDateYear$ = $('#fewo_booking_request_toDate_year');

    frm$.find('input, select').change(function() {
        var tmp = location.href.split('?');
        var tmp2 = tmp[0].split('/');
        tmp2.pop();
        var url = tmp2.join('/') + '/berechne-gesamtpreis';
        if (tmp[1])
        {
            url += '?'+ tmp[1];
        }

        $.ajax({
            url: url,
            type: 'post',
            data: frm$.serialize()

        }).then(function(r) {
            summary$.html(r);

        }, function() {
            summary$.html('Aufgrund eines Fehlers konnte kein Angebot ermittelt werden.');
        })
    });
});