	function my_rate_news(rate, id)
	{
		$.ajax({
			type: "POST",
			url: "/ajax/rate_news.php",
			data: "rate="+rate+"&id="+id,

			beforeSend: function()
			{
				$("#rate_result").fadeOut(500, function()
					{
						$("#rate_indicator").fadeIn(500);
					}
				);
			},

			success: function(msg)
			{
				$("#rate_indicator").fadeOut(500, function()
					{
						$("#rate_result").html(msg);
						$("#rate_result").fadeIn(500);
					}
				);
			}
		});
	}


	function yes_no(vote, id, tag)
	{
		$.ajax({
			type: "POST",
			url: "/ajax/rate_yes_no.php",
			data: "vote="+vote+"&id="+id+"&tag="+tag,

			beforeSend: function()
			{
				$("#yes_no_result_"+id).fadeOut(500, function()
					{
						$("#yes_no_indicator_"+id).fadeIn(500);
					}
				);
			},

			success: function(msg)
			{
				$("#yes_no_indicator_"+id).fadeOut(500, function()
					{
						$("#yes_no_result_"+id).html(msg);
						$("#yes_no_result_"+id).fadeIn(500);
					}
				);
			}
		});

	}

	function my_rate_game(rate,id)
	{
		$.ajax({
			type: "POST",
			url: "/ajax/rate_game.php",
			data: "rate="+rate+"&id="+id,

			beforeSend: function()
			{
				$("#rate_result").fadeOut(500, function()
					{
						$("#rate_indicator").fadeIn(500);
					}
				);
			},

			success: function(msg)
			{
				$("#rate_indicator").fadeOut(500, function()
					{
						$("#rate_result").html(msg);
						$("#rate_result").fadeIn(500);
					}
				);
			}
		});
	}

	$(document).ready(function()
	{
		$("#notes").append("<ol id=\"footnotes\"></ol>");
		footnote = 1;
		$("ref[cite],ref[title],blockquote[cite],blockquote[title]").addClass("footnote");
		$(".footnote").each(function() {
			$(this).append("<sup id=\"sn"+footnote+"\"><a href=\"#sl"+footnote+"\">"+footnote+"</a></sup>");
			cite="<li id=\"sl"+footnote+"\">";
			url=$(this).attr("cite");
			title=$(this).attr("title");
			if(title && url) {
				cite+="<a href=\""+url+"\">"+title+"</a> <a href=\"#sn"+footnote+"\">К цитате</a>";
			} else if(title) {
				cite+=title;
			} else if(url) {
				cite+="<a href=\""+url+"\">"+url+"</a> <a href=\"#sn"+footnote+"\">К цитате</a>";
			}
			cite+="</li>";
			$("#footnotes").append(cite);
			footnote++;
		});
	});


	// Вставить имя в поле ввода
	function ins(name)
	{
		var insert = 'To: <b>'+name+'</b><p>';

		if ($.browser.opera)
		{
			var insert = 'To: '+name+'<p>';
		}

		tinyMCE.execCommand('mceInsertContent', false, insert);
	}

	// Цитатник
	function pasteQ()
	{
		if(txt.length < 1)
		{
			alert('Для цитаты, необходимо выделить текст.');
		}
		else
		{
			//$("#mestxt").append(txt2);
			tinyMCE.execCommand('mceInsertContent', false, txt2);
		}
	}
	function copyQ()
	{
		txt=''

		if (document.getSelection)
		{
			txt=document.getSelection()
		}
		else if (document.selection)
		{
			txt=document.selection.createRange().text;
		}
		txt2='[quote]'+txt+'[/quote]<p>'
	}
