$(window).on('load', function(){ 
    $.when(
    $(".chosen-select,.chosen-multiple-select").select2({
        width: '100%',
        allowClear: true,
        placeholder :'Selecione...'
    })).done(function(e){
        if(typeof fields_ajax !== "undefined" && typeof load_fields_ajax === "function")
        {     
            for(var slt in e)
            {
                if(typeof e[slt] == 'object' && typeof e[slt].id !== 'undefined' && typeof e[slt].id !== null)
                {      
                    if(fields_ajax.hasOwnProperty(e[slt].id.substring(9))){
                        load_fields_ajax(e[slt].id.substring(9))
                  
                    }
                }
            }
        }
    });
    
	$(".chosen-select-95").select2({width:"95%",allowClear: true});
	
	$(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
	    
        $(".chosen-select,.chosen-multiple-select").trigger('update');
        $(".chosen-select-95").trigger('update');
    });
});

function isFunction(functionToCheck) {
 return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
}