var marketingEncounter = {
    settings: {
        patient_autocompleteUrl: '',
        company_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        encounter_autocompleteUrl: '',
        marketingStaff_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(marketingEncounter.settings.patient_autocompleteUrl, '#form-patient', '#form-patient-id');
        global.autocomplete.bind(marketingEncounter.settings.company_autocompleteUrl, '#form-company-desc', '#form-company-id');
        global.autocomplete.bind(marketingEncounter.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(marketingEncounter.settings.encounter_autocompleteUrl, '#form-encounterType', '#form-encounterType-id');
        global.autocomplete.bind(marketingEncounter.settings.marketingStaff_autocompleteUrl, '#form-marketingStaff', '#form-marketingStaff-id');
        global.autocomplete.bind(marketingEncounter.settings.accountUser_autocomplete_url, '#form-user-fullName', '#form-user-id');
    }
};