function openNewsRow(row, link) {
	$.ajax(
		{
			url: link.attr('href') + '?ajax=1',
			dataType: 'html',
			success: function(data) {
				row.removeClass('news_row');
				row.html(data);
				resetWidgetButtons();
				
				row.find('.widget.comments').each(
					function(i) {
						bindCommentsForm($(this));
						bindCommentRatings($(this));
						row.find('form.rating_form').each(
							function() {
								bindRatingsForm($(this));
							}
						);
					}
				);
			}
		}
	);
}

$(document).ready(
	function() {
		$('.news_row a.widget-open').bind('click',
			function(e) {
				row = $(this).parent().parent();
				openNewsRow(row, $(this));
				
				return false;
			}
		);
		
		$('.news_row h4 a').bind('click',
			function(e) {
				row = $(this).parent().parent().parent();
				openNewsRow(row, $(this));
				
				return false;
			}
		);
	}
);