var ar_summary = {
    settings: {
        patient_autocompleteUrl: '',
        health_facility_autocomplete_url: '',
        company_autocomplete_url: ''
    },
    init: function() {

        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('#billingBranchAddress').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-address-id').val(val);
        });

        this.bindAutoComplete();
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(ar_summary.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(ar_summary.settings.health_facility_autocomplete_url, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(ar_summary.settings.health_facility_autocomplete_url, '#form-branch-address', '#form-branch-address-id');
        global.autocomplete.bind(ar_summary.settings.company_autocomplete_url, '#form-company', '#form-company-id');
    }
};