var payment = {
    settings: {
        branch_autocompleteUrl: '',
        patient_autocompleteUrl: '',
    },
    init: function() {
        this.bindAutoComplete();

        jQ('#companies').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-company-id').val(val);
        });

        jQ('#billingBranches').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-id').val(val);
        });

        jQ('#billingBranchAddresses').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-address-id').val(val);
        });

        jQ('#financingCompany').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-financingCompany-id').val(val);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(payment.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(payment.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
    }
};