(function($){
$.sidebar = {
related: function($id){
	if ($id) $.sidebar.id = $id;
	if (!$.thread.s.completed) {
		setTimeout("$.sidebar.related();", 1000);
		return false;
	}
	var _h = $('#thread').height();
	$.post('/--/modules',{related: $.sidebar.id, limit: parseInt(_h/100,10)},function($j){
		var _o = JSON.parse($j);
		if (_o.status)
			return false;

		var _col = $('#content table.columns tr td:nth-child(2) div.col');

		var _draw = function($o) {
			$('<div class="corners3">'
			+($o.n==0 ? '':'<img src="/=i_new.gif"> ')
			+'<a href="/'+$o.id+'">'+$o.title+'<\/a> '+$o.text
			+' '+$.Trans.By+' '+$o.login+' <i>'
			+$.aqStamp($o.uts,true)+'<\/i>'
			+'<\/div>')
			.css({backgroundColor: $o.score == -1?$.mau.s2:$.mau.s4})
			.appendTo(_col);
		};

		for (var i=0;i<_o.length;i++) {
			_draw(_o[i]);
			if (_col.height()+200 > _h) {
				if (i < _o.length-1 && _o[_o.length-1].score == -1)
					_draw(_o[_o.length-1]);
				break;
			}
		}

		_col.addClass('noprint').find('div.corners3')
			.css({width: '180px',padding: '9px'})
			.corners();
	});
}
};
})(jQuery);


