function sortNumber(a, b) { return a - b; }

jQuery.ajaxSetup({
	complete: function ()
	{ 
		$('#AjaxLoading').hide(); 
	}, 
	beforeSend: function ()
	{ 
		$('#AjaxLoading').show();
	}
});

$(function()
{	
	$("#ChangeCaptcha, IMG#captcha").click(function(){ $("IMG#captcha").attr('src', '/captcha.php?' + Math.random()); });

	$(".close-unread").click(function(){
		jQuery("#unr").hide();
	})

	$(".tag-option").toggle(
		function() {
			$(this).next().dequeue().slideDown("fast");
			$(this).next().find("IMG").show();
		},
		function() {
			$(this).next().dequeue().slideUp("fast");
	});
	
	$("#NewsBlock .title").click(function()
	{
		var body = $(this).next();
		if ( body.hasClass("opened") ) 
			body.removeClass("opened").hide();
		else 
			body.addClass("opened").show();

		return false;
	});
	
	// Auth Block
	$("#ButtonLogin").click(function(){
		$("#Overlay").show();
		$("#FormAuth").show();
		return false;
	});
	
	$("#Overlay, #FormAuth .close").click(function() { $("#Overlay").hide(); });
	
	$("#Overlay, #FormAuth .close").click(function()
	{
		$("#FormAuth").hide();
		$("#FormLogin").show();
		$("#FormRecover").hide();
	});

	$("#FormLogin .recover A").click(function()
	{
		$("#FormLogin").hide();
		$("#FormRecover").show();
		
		return false;
	});
	
});