var referral_marketing = {
    settings: {
        company_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        patient_autocompleteUrl: '',
        provider_autocompleteUrl: '',
        referring_physician_autocompleteUrl: '',
        referring_afilliate_autocompleteUrl: '',
        salesAgent_autocompleteUrl: '',
    },
    init: function() {
        this.bindAutoComplete();
        jQ('#branches').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-id').val(val);
        });

        jQ('#companies').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-company-id').val(val);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(referral_marketing.settings.company_autocompleteUrl, '#form-company-desc', '#form-branch-id');
        global.autocomplete.bind(referral_marketing.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(referral_marketing.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(referral_marketing.settings.provider_autocompleteUrl, '#form-provider-fullName', '#form-provider-id');
        global.autocomplete.bind(referral_marketing.settings.referring_physician_autocompleteUrl, '#form-referring-physician', '#form-referring-physician-id');
        global.autocomplete.bind(referral_marketing.settings.referring_afilliate_autocompleteUrl, '#form-referring-affiliate', '#form-referring-affiliate-id');
        global.autocomplete.bind(referral_marketing.settings.salesAgent_autocompleteUrl, '#form-agent-fullName', '#form-agent-id');

    }
};