$(function() {

	// window control
	$(".socialMenu .tw a", "#updates").click(function() { window.open(this.href,'shareWindow','width=400,height=300,menubar=no,toolbar=no,scrollbars=yes'); return false; });
	$(".socialMenu .fb a", "#updates").click(function() { this.target = "_blank"; });
	$(".socialMenu .gr a", "#updates").click(function() { this.target = "_blank"; });
	$(".socialMenu .mx a", "#updates").click(function() { this.target = "_blank"; });

	// set closer size
	$("#closer")
		.height($(document).height()-25)
		.width($(document).width()-25);
	$(".socialCurrentCloser", "#updates").each(function() {
		$(this)
			.height($(this).parent().outerHeight())
			.width($(this).parent().outerWidth());
	});

	// open social button
	$(".socialButton", "#updates").click(function() {
		$(".socialMenu", "#updates").hide();
		$(this).parent().toggleClass("lift");
		socialButton = $(this);
		$(socialButton).siblings(".socialMenu")
			.css("top", socialButton.position().top-25)
			.css("left", socialButton.position().left-5)
			.fadeIn("fast");
		$(socialButton).siblings(".socialCurrentCloser").show();
		$("#closer").show();
	});

	// close social button
	function closeSocialMenu() {
		$(".socialMenu", "#updates").hide();
		$(".lift", "#updates").toggleClass("lift");;
		$("#closer").hide();
		$(".socialCurrentCloser", "#updates").hide();
	}
	$(".socialMenuCloseBox", "#updates").click(function() {
		closeSocialMenu();
	});
	$(".socialCurrentCloser", "#updates").click(function() {
		closeSocialMenu();
	});
	$("#closer").click(function() {
		closeSocialMenu();
	});

	// closer check
	/*
	$("#closer").css({backgroundColor:"yellow",opacity:0.5});
	$(".socialCurrentCloser").css({backgroundColor:"red",opacity:0.5});
	*/

});

