var marketing = {
    settings: {
        company_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        patient_autocompleteUrl: '',
        referring_physician_autocompleteUrl: '',
        referring_afilliate_autocompleteUrl: '',
        salesAgent_autocompleteUrl: '',
    },
    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);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(marketing.settings.company_autocompleteUrl, '#form-company-desc', '#form-company-id');
        global.autocomplete.bind(marketing.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(marketing.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(marketing.settings.referring_physician_autocompleteUrl, '#form-referring-physician', '#form-referring-physician-id');
        global.autocomplete.bind(marketing.settings.referring_afilliate_autocompleteUrl, '#form-referring-affiliate', '#form-referring-affiliate-id');
        global.autocomplete.bind(marketing.settings.salesAgent_autocompleteUrl, '#form-agent-fullName', '#form-agent-id');

    }
};