$(document).ready(function()
{
	friendhover();

	/*
	$("h3 a.befriend").bind("click", befriend);
	$("h3 a.defriend").bind("click", defriend);

	
	function befriend()
	{
		$(this).fadeTo("fast", 0, function()
		{
			var checkthisout = $(this);
			
			$(this).load(checkthisout.attr("href"), function(e)
			{
				var newhref = checkthisout.attr("href").replace("add", "remove");
			
				checkthisout.removeClass("befriend").addClass("defriend").attr("href", newhref);
				checkthisout.fadeTo("fast", 1).unbind().bind("click", defriend);
				
				$("div.ajax_friends").load("/profile/user/" + $("div.username a").html() + " div.ajax_friends", function()
				{
					$("h3 a.befriend").bind("click", befriend);
					$("h3 a.defriend").bind("click", defriend);
					friendhover();
				});
			});
			
		});
		
		return false;
	}
	
	function defriend()
	{
	
		$(this).fadeTo("fast", 0, function()
		{
			var checkthisout = $(this);
				
			$(this).load(checkthisout.attr("href"), function(e)
			{
				var newhref = checkthisout.attr("href").replace("remove", "add");
				
				checkthisout.removeClass("defriend").addClass("befriend").attr("href", newhref);
				checkthisout.fadeTo("fast", 1).unbind().bind("click", befriend);
				
				$("li#user_" + $("a.username").html()).fadeOut();
				
			});
			
		});
		
		return false;
	}
	*/
	
	function friendhover()
	{
		fixZi();
	
	
		$("ul.friends li a").unbind().hover(function()
		{
			$(this).parent().children("span.friend_info").show();
		},
		function()
		{
			$(this).parent().children("span.friend_info").hide();
		});
	}
	
	function fixZi()
	{
		var zIndexNumber = 10000;
		
		$("#content div, #content span, #content li").each(function()
		{
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	}
});