var encounter = {
    settings: {
        patient_autocompleteUrl: '',
        company_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        encounter_autocompleteUrl: '',
        provider_autocompleteUrl: '',
        accountUser_autocomplete_url: ''
    },
    init: function() {
        this.bindAutoComplete();
        jQ('#companies').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-company-id').val(val);
        });

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

        jQ('#encounterTypes').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-encounterType-id').val(val);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(encounter.settings.patient_autocompleteUrl, '#form-patient', '#form-patient-id');
        global.autocomplete.bind(encounter.settings.company_autocompleteUrl, '#form-company-desc', '#form-company-id');
        global.autocomplete.bind(encounter.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(encounter.settings.encounter_autocompleteUrl, '#form-encounterType', '#form-encounterType-id');
        global.autocomplete.bind(encounter.settings.provider_autocompleteUrl, '#form-clinician', '#form-clinician-id');
        global.autocomplete.bind(encounter.settings.accountUser_autocomplete_url, '#form-user-fullName', '#form-user-id');
    }
};