var invoice = {
    settings: {
        patient_autocompleteUrl: '',
        branch_autocompleteUrl: '',
        company_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);
        });

        jQ('#branchAddress').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-address-id').val(val);
        });
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(invoice.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(invoice.settings.branch_autocompleteUrl, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(invoice.settings.company_autocompleteUrl, '#form-company-desc', '#form-company-id');

    }
};