jQuery(document).ready(function($){

	$("#services .service .photo").boxShadow(0, 0, 16, "#060606" );
	$("#content").boxShadow(0, 190, 16, "#060606" );
	$("#loginbox").boxShadow($("#loginbox").parent().width() - $("#loginbox").width(), -80, 16, "#060606" );
	

	$("#services a").hover(
	function(){
		$(this).children(".description").stop().animate({'margin-top': '4px'}, 400);
	},
	function(){
		$(this).children(".description").stop().animate({'margin-top': '-6px'}, 400);
	});
	
	$("#loginbox a.toggle").toggle(function(){
		$(this).children("img").hide().eq(1).show();
		$("#loginbox").animate({'top': '0px'}, 500);
		return false;
	},
	function(){
		$(this).children("img").hide().eq(0).show();
		$("#loginbox").animate({'top': '-80px'}, 500);
		return false;
	});
	
	
	$("#loginbox form").submit(function(){
		
		$.ajax({
			type: "POST",
			url: $("#loginbox form").attr('action'),
			data: $("#loginbox form").serialize(),
			success: function(data){
				if (data.substring(0,2) == "OK"){
					// alert(data);
					// return false;
					document.location.href = data.substring(3, data.length);
				}
				else
					$("#loginbox form").children(".error").text("Erreur");
			},
			error: function(xhr,data){
				// alert(data);
				$("#loginbox form").children(".error").text("Erreur");
			}
		});
		return false;
	});

});
