var healthFacility_form = {
    settings: {
        healthFacilityType_autocomplete_url: '',
        city_autocomplete_url: '',
        account_autocomplete_url: '',
        postalCode_autocomplete_url: '',
        company_autocomplete_url: ''
    },
    init: function() {
        this.initAutocomplete();
        this.showQueueTime();
    },
    initAutocomplete: function() {
        global.autocomplete.bind(this.settings.healthFacilityType_autocomplete_url, '#healthFacility_healthFacility_type_desc', '#healthFacility_healthFacility_type');
            global.autocomplete.bind(this.settings.city_autocomplete_url, '#healthFacility_city_desc', '#healthFacility_city');
        global.autocomplete.bind(this.settings.account_autocomplete_url, '#healthFacility_account_desc', '#healthFacility_account');
        global.autocomplete.bind(this.settings.postalCode_autocomplete_url, '#healthFacility_postalCode_desc', '#healthFacility_postalCode',{
            onSelect: function (c) {
                jQ('#healthFacility_city_desc').val(c.city);
                jQ('#healthFacility_city').val(c.cityId);
            }
        });
        global.autocomplete.bind(this.settings.company_autocomplete_url, '#healthFacility_company_desc', '#healthFacility_company');
    },
    showQueueTime: function () {
        jQ('#healthFacility_schedule_type').unbind('change').bind('change', function(){
            if(jQ(this).val()==='Queued') {
                jQ('#rxgrab-healthFacility-form-queueuing-time-container').removeClass('hide');
            } else {
                jQ('#rxgrab-healthFacility-form-queueuing-time-container').addClass('hide');
            }
        }).change();
    }
};