var patient = {
    settings: {
        company_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        insurance_autocompleteUrl: '',
        state_autocompleteUrl: '',
        postalCode_autocompleteUrl: '',
        city_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);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(patient.settings.company_autocompleteUrl, '#form-company-desc', '#form-company-id');
        global.autocomplete.bind(patient.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(patient.settings.insurance_autocompleteUrl, '#form-insurance', '#form-insurance-id');
        global.autocomplete.bind(patient.settings.state_autocompleteUrl, '#form-province', '#form-province-id');
        global.autocomplete.bind(patient.settings.postalCode_autocompleteUrl, '#form-postalCode', '#form-postalCode-id');
        global.autocomplete.bind(patient.settings.referring_health_facility_autocomplete_url, '#form-referring-affiliate', '#form-referring-affiliate-id');
        global.autocomplete.bind(patient.settings.referring_provider_autocomplete_url, '#form-referring-physician', '#form-referring-physician-id');
        global.autocomplete.bind(patient.settings.city_autocomplete_url, '#form-city-desc', '#form-city-id');

    }
};