$(document).ready(function(){function initSolvedFlagSelect(id)
{if(id)
var selectEl=$('#'+id+' .solved-flag-select')
else
var selectEl=$('.solved-flag-select');selectEl.show();selectEl.unbind('change').change(function(){var self=$(this);var formEl=self.closest('form');var rowEl=self.closest('div.row')
var rowElId=rowEl.attr('id');data={authenticity_token:formEl.find('[name=authenticity_token]').val(),solved_flag:self.val()};$.post(formEl.attr('action'),data,function(newRowEl){if(newRowEl!='')
{rowEl.replaceWith(newRowEl);var noticeBox=$('#'+rowElId+' .box-notice');noticeBox.hide().slideDown(200);setTimeout(function(){noticeBox.slideUp(200);},2000);initSolvedFlagSelect(rowElId);}});});};var noticeBox=$('.box-notice').filter(':not(.permanent)');setTimeout(function(){noticeBox.slideUp(200);},3000);$('.publish-button').click(function(){var self=$(this);var formEl=self.closest('form');var rowEl=self.closest('div.row');data={authenticity_token:formEl.find('[name=authenticity_token]').val()}
$.post(formEl.attr('action'),data,function(newRowEl){if(newRowEl!='')
{rowEl.replaceWith(newRowEl);initSolvedFlagSelect();}});return false;});initSolvedFlagSelect();$('select.autosubmit').change(function(){$(this).closest('form').submit();});$('.autohide').hide();})