
  $(function(){

    // nice messages
    var a = setTimeout( function(){
      $('.error, .message').fadeOut(2000);
    }, 5000);

    $.tablesorter.defaults.widgets = ['zebra']; 
    //$('hr:last').remove();
    
    $('.slide').click(function(){ $(this).parent().next().slideToggle('slow'); return false; });
    
    init();
    
  });

  
function init(obj){
  
    // remember last sorted header    
    $('table:has(thead):has(tbody:has(tr))', obj).addClass('tablesorter').tablesorter({
      sortList:  [ $.cookie(cookiesortname) ? $.cookie(cookiesortname).split('.') : [0,0] ] ,
      dateFormat: 'uk' //, debug: true
    }).bind('sortEnd', function(){
      var el = $('.headerSortUp, .headerSortDown',this);
      var co = [ el.index() , el.is('.headerSortUp')?'1':'0' ].join('.');
      $.cookie(cookiesortname, co , {expires: 7, path: cookiesortpath } );
    });
}
