$(function() {
	$("html").attr("xmlns:fb", "http://www.facebook.com/2008/fbml");

	$("#addSocial_friends_pictures img").live('click', function() {
		if ($("#addSocial_friends_selected img").length < max_friends) {
			$("<img/>").attr({
		   		"src": $(this).attr("src"),
		   		"data-name": $(this).attr("data-name"),		           		
		   		"data-sex": $(this).attr("data-sex"),		           		
		   		"data-uid": $(this).attr("data-uid"),
		   		"title" : $(this).attr("data-name")
		   	}).appendTo("#addSocial_friends_selected").fadeIn();
		}
	});	
	
	$("#fb_filter").bind('keyup', function() {
		if ($("#fb_filter").val()) {
			$("#addSocial_friends_pictures img:not([data-filtername^='"+$("#fb_filter").val().toLowerCase()+"'])").fadeOut("fast");
		    $("#addSocial_friends_pictures img[data-filtername^='"+$("#fb_filter").val().toLowerCase()+"']").fadeIn("slow");
		} else {
			$("#addSocial_friends_pictures img").show();
		}
	});

	$("#addSocial_friends_selected img").live('click', function() {
		$(this).fadeOut("fast", function() {
			$(this).remove();
		});
	});

//Beachparty!
	$("#addSocial").overlay({
		top: 60,
		closeOnClick: false,
		load: true	
	});
		
}); //END jQuery onLoad


//addSocial_friends_pictures CTRL
function fade_female() {
	$("#images img[data-sex='kvinde']").fadeOut();
	$("#images img[data-sex='']").fadeOut();

}

function fade_male() {
	$("#images img[data-sex='mand']").fadeOut();
		$("#images img[data-sex='']").fadeOut();

}

function show_all() {
	$("#addSocial_friends_pictures img:hidden").fadeIn();
}
		 

