
$(document).ready(function(){var table_width=$('#mainTable').width();$('div.well').width(function(discard,these){var padding=$(this).innerWidth()-$(this).width();return table_width-padding;});if($('#nxti-is-used')[0].checked){$('.nxti-only').show();}
else{$('.nxti-only').hide();}
$('.show-partial-traps').click(function(){var mib_name=$(this).data('mib-name');var query={mode:'partial-traps',mib_name:mib_name};var url=base_url+'/admin/mibs.php';$.post(url,query,function(data){$('.mib-trap-contents').html(data);$('.mib-name').html(mib_name);$('#viewPartialAssociatedTrapsModal').modal('show');},'html');});$('#nxti-is-used').click(function(){$('.nxti-only').toggle();$('.mibs-process').each(function(){if($(this).hasClass('wrong-processing')){$(this).removeClass('wrong-processing');$(this).addClass('correct-processing');}
else if($(this).hasClass('correct-processing')){$(this).addClass('wrong-processing');$(this).removeClass('correct-processing');}})
do_buttons();do_tooltips();var url=base_url+'/admin/mibs.php';var post={mode:'change-processing-mode',new_value:this.checked,};$.post(url,post,function(data){if(data.status!=='success'){alert(data);}},'json');});$('#view-file-permissions').click(function(){$('#filePermissionsModal').modal('show');});$('#view-associated-traps').click(function(){$('#viewAllAssociatedTrapsModal').modal('show');});$('#process-all-traps').click(function(){$('#process-all-throbber').css('display','inline');$('#undo-all-throbber').css('display','none');});$('#undo-all-processing').click(function(){$('#undo-all-throbber').css('display','inline');$('#process-all-throbber').css('display','none');});function do_tooltips(first_time){if(typeof first_time==='undefined'){first_time=false;}
$('span.processing').each(function(){if(first_time){$(this).tooltip();return;}
$(this).tooltip('destroy');if($(this).hasClass('wrong-processing')){$(this).attr('title','');$(this).removeClass('wrong-processing');}
else{$(this).attr('title',$(this).data('maybe-title'));$(this).addClass('wrong-processing');$(this).tooltip();}});$('img.tt-bind-dynamic').each(function(){$(this).tooltip('destroy');$(this).tooltip();});}
function do_buttons(){var undo_default=$('#title-undo-default').html();var undo_is_upload=$('#title-is-upload').html();var undo_missing_file=$('#title-missing-file-undo').html();var process_default=$('#title-process-default').html();var process_wrong_processing=$('#title-wrong-processing').html();var process_missing_file=$('#title-missing-file-process').html();var save_default=$('#title-save-default').html();var save_missing_file=$('#title-missing-file-save').html();$('.mibs-process').each(function(){var title_string=process_default;var href=$(this).parent().data('href');if($(this).hasClass('wrong-processing')){title_string=process_wrong_processing;href='#';$(this).css('opacity',0.4);}
if($(this).hasClass('missing-file')){title_string=process_missing_file;href='#';$(this).css('opacity',0.4);}
$(this).attr('title',title_string);$(this).parent()[0].href=href;});$('.mibs-undo').each(function(){var title_string=undo_default;var href=$(this).parent().data('href');if($(this).hasClass('is-upload')){title_string=undo_is_upload;href='#';$(this).css('opacity',0.4);}
if($(this).hasClass('missing-file')){title_string=process_missing_file;href='#';$(this).css('opacity',0.4);}
$(this).attr('title',title_string);$(this).parent()[0].href=href;});$('.mibs-save').each(function(){var title_string=save_default;href=$(this).parent().data('href');if($(this).hasClass('file-missing')){title_string=save_missing_file;href='#';$(this).css('opacity',0.4);}
$(this).attr('title',title_string);$(this).parent()[0].href=href;});}
do_buttons();do_tooltips(true);});