$(document).ready(function() {
getUrl = $("div.tab > span").attr("id");
	$("div.tab > span.off").live("click", function() {
		getSpan = $(this).parent().children("span");
		if ($(getSpan).hasClass("on")) { $(getSpan).removeClass("on").addClass("off"); }
		$(this).removeClass("off").addClass("on");
		getUrl = $(this).attr("id");
		getSel  = $(this).parent().children("div.content-tab");
		getProc = $(this).parent().children("span.loader");
		if (getUrl.indexOf("/comments/")!=-1) {
			$.ajax({
				type: "POST",
				url: getUrl,
				beforeSend: function() {
					$(getProc).css({display:"block"});
				},
				data: "PHPSESSID="+session_id,
				success: function(msg){
					$.getScript("/js/comment.js");
					$(getSel).html(msg.content);
					$("textarea[class]").wysiwyg();
					$('textarea[class]').html(msg);
					$(getProc).css({display:"none"});
					last_comment_id = msg.last_id;
				},
				dataType: "json"
			});
		} else {
			$.ajax({
				type: "post",
				url: getUrl,
				beforeSend: function() {
					$(getProc).css({display:"block"});
				},
				success: function(getContent) {
					$(getProc).css({display:"none"});
					$(getSel).html(getContent);
				},
				dataType: "html"
			});
		}
	});
});
function goToPage(data) {
	$.ajax({
		type: "post",
		url: getUrl+data,
		beforeSend: function() {
			$("span.loader").css({display:"block"});
		},
		success: function(getContent) {
			$("span.loader").css({display:"none"});
			$("div.content-tab").html(getContent);
		},
		dataType: "html"
	});
}