$(document).ready(function() {
$(function () {
	var tabContainers = $('div#sidebar-content > div');
	tabContainers.hide().filter(':first').show();

	$('ul#sidebar-content-nav a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('ul#sidebar-content-nav a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();
});
$(function() {
	$('li.clickable').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	$('li.clickable').css('cursor', 'pointer').click(function() {
		window.location = $('a', this).attr('href');
	});
});
$('a.emoticon').click(function(event) {
	event.preventDefault();
	$('textarea#reply').val($('textarea#reply').val()+$(this).attr("title")); 
});

$("a.c_reply").click(function() {
	var author = $(this).parents("li").find(".author span").html();
	var authlink = $(this).parents("li").attr("id");
	var text = $("textarea#reply").attr("value");
	$('textarea#reply').attr("value",text+"[url comment='#"+authlink+"']@"+author+"[/url]: ").focus();
});
$("a.c_quote").click(function() {
	var author = $(this).parents("li").find(".author span").html();
	var authlink = $(this).parents("li").attr('id');
	var text = $("textarea#reply").attr("value");
	var quote = $(this).parents("li").find(".comment-text").html();
	$('textarea#reply').attr('value',text+'[quote author="'+author+'" comment="'+authlink+'"]'+quote+'[/quote]').focus();
	$('textarea#reply').val($('textarea#reply').val().replace(/<blockquote([^\]]*)\/blockquote>/g,'').replace(/\n/g,'').replace(/<\/p>\[\/quote\]/g,'[\/quote\]').replace(/<p>/g,'').replace(/<\/p>/g,'\n\n').replace(/<\/P>\[\/quote\]/g,'[\/quote\]').replace(/<P>/g,'').replace(/<\/P>/g,'\n\n'));
	
});
});