$(document).ready(function()
{
	var opened = false;
	$("div.login-btn").click(function()
	{
		$(this).toggleClass("opened");
		if($(this).hasClass("opened"))
		{
			$(this).parent().find(".login-form").css({"height": 66}).animate({marginLeft: 0});
			opened = true;
		}
		else
		{
			$(this).parent().find(".login-form").animate({marginLeft: -239}, function() { $(this).parent().find(".login-form").css({"height": 0})});
			opened = false;
		}
		return false;
	});
	$("div.login-box").hover(
		function ()
		{
			if(!opened)
			{
				$(this).find(".login-form").css({"height": 66}).animate({marginLeft: 0});
			}
		}, 
		function ()
		{
			if(!opened)
			{
				$(this).find(".login-form").animate({marginLeft: -239}, function() { $(this).parent().find(".login-form").css({"height": 0})});
			}
		}
	);
});
