// Configure the search area
function ConfigSearch() {
	var initialValue = 'Search...';
	var Search = $('#s');

	Search.val(initialValue);
	
	Search.click(function() {
		this.value = (this.value == initialValue ? '' : this.value);
		if (!$(this).hasClass('active'))
			$(this).addClass('active');
	});
	Search.blur(function() {
		if (this.value == '') {
			this.value = initialValue;
			$(this).removeClass('active');
		}
	});
}

function ConfigComments() {
	var commentcount = $('#commentcount').html();

	if (commentcount > 1)
		$('#commentsplural').css('display', 'inline');
	else if (commentcount == 0)
		$('#togglecomments').css('display', 'none');

	$('#togglecomments').click(function() {
		$('#comments').toggle('slow');
		$('.commenttoggletext').toggle();
	});
}
function ConfigTags() {
	$('#toggletags').click(function() {
		$('#tagcloud').toggle('slow');
		$('.tagstoggletext').toggle();
	});
}

$(document).ready(function() {
	ConfigSearch();
	ConfigComments();
	ConfigTags();
});
