/* BEGIN LICENSE BLOCK ----------------------------------
*
* This file is part of Jcmag, a Dotclear 2 theme.
*
* Copyright (c) 2003-2008 Olivier Meunier and contributors
* Licensed under the GPL version 2.0 license.
* See LICENSE file or
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* -- END LICENSE BLOCK --------------------------------- */

// Comment form display
$(function() {
	if ($('body.dc-post, body.dc-page').length == 0) { return; }
	if ($('#pr').length > 0) { return; }
	
	var link = $('<a href="#">' + $('#comment-form h3:first').text() + '</a>').click(function() {
		$('#comment-form fieldset:first').show(200);
		$('#c_name').focus();
		$(this).parent().removeClass('add-comment').html($(this).text());
		return false;
	});
	$('#comment-form h3:first').empty().append(link).addClass('add-comment');
	$('#comment-form fieldset:first').hide();
});

// Tags list display
$(function() {
	var tags = $('#extra .tags li:has(a[class^=tag])').filter(function() {
		var c = $('a',this).attr('class').substr(3);
		return c <= 10;	// We display only tags with % > 10
	}).hide();
	
	if (tags.length > 0) {
		var all_tags = $('<a href="#">' + jcmag.all_tags + '</a>').click(function() {
			$('#extra .tags li:hidden').show().css('opacity',0.2).fadeTo(1600,1);
			$('#extra .tags p').remove();
			return false;
		});
		$('#extra .tags').append($('<p></p>').append(all_tags));
	}
});