var productivity = {
    settings: {
        branch_autocompleteUrl: '',
        examType_autocompleteUrl: '',
        clinician_autocompleteUrl: ''
    },
    init: function() {
        this.bindAutoComplete();

        jQ('#encounterType').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-encounterType-id').val(val);
        });

        jQ('#branches').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-id').val(val);
        });

        jQ('#clinicians').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-clinician-id').val(val);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(productivity.settings.branch_autocompleteUrl, '#branch', '#branch_id');
        global.autocomplete.bind(productivity.settings.examType_autocompleteUrl, '#exam_type', '#exam_type_id');
        global.autocomplete.bind(productivity.settings.clinician_autocompleteUrl, '#form-clinician', '#form-clinician-id');

    }
};