var diagnosis = {
    settings: {
        specialist_autocompleteUrl: '',
        referring_affiliate_autocompleteUrl: '',
        chart_type_autocompleteUrl: '',
        diagnosis_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(diagnosis.settings.specialist_autocompleteUrl, '#form-specialist', '#form-specialist-id');
        global.autocomplete.bind(diagnosis.settings.referring_affiliate_autocompleteUrl, '#form-referring-affiliate', '#form-referring-affiliate-id');
        global.autocomplete.bind(diagnosis.settings.chart_type_autocompleteUrl, '#form-chart-type', '#form-chart-type-id');
        global.autocomplete.bind(diagnosis.settings.diagnosis_autocompleteUrl, '#form-diagnosis', '#form-diagnosis-id');

    }
};