$_ = jQuery;

$_(document).ready(function(){

	var commentshow = 10;
	var showmoretext = 'Show more comments';
	if ( lang == 'de' ){
		showmoretext = 'Weitere Kommentare anzeigen';
	}
	
	if ( $_('.comments .comment').length <= commentshow ){
		return;
	}
	
	var commentcount = 0;
	
	$_('.comments .comment').each(function(){
		commentcount++;
		
		if ( commentcount > commentshow ){
			$_(this).hide();
		}
	});

	var showmorelink = '<p id="showmorecomments"><a href="#">' + showmoretext + '</a></p>';
	
	$_('#add_a_comment').before(showmorelink);
	$_('#showmorecomments').css('text-align', 'right');
	$_('#showmorecomments').css('font-weight', 'bold');
	
	$_('#showmorecomments a').click(function(){
		var height = $_('.comments').height();
		//alert(height);
		$_('.comments .comment').show("slow");
		$_('.comments .comment').wrapAll('<div id="commentscroller"></div>');
		$_('.comments #commentscroller').css('max-height', height + 'px');
		$_('.comments #commentscroller').css('overflow', 'auto');
		$_('#showmorecomments').hide();
		return false;
	});

}); 
