$(document).ready( function() {

	/************************************
	* 							 INIT CSS
	*************************************/
	$("#espaceMembre").addClass('javascript');
	$("#userland").css('height','auto');
	
	/************************************
	* 						HIDE ELEMENTS
	*************************************/
    $("#accountOptionsBox").hide();

	
    /************************************
	* 					EFFECTS LISTENERS
	*************************************/	
    $("#accountAccessButton").mouseover(function() {
		$("#accountOptionsBox").slideDown('normal');
    });

	
	var timer;
	$("#userland").hover(	
		function() {
			//alert('clear');
			clearTimeout(timer);
		},
		function(){
			timer = setTimeout( function()
						{
							$("#accountOptionsBox").slideUp('normal');
						}, 1500);
		}
	);
	

	/************************************
	* 					  CLICK LISTENERS
	*************************************/
    $("#disconnectButton").click(function() {
		var lang = $(this).attr("lang");
		$.ajax({
			url      : lang+ '/logout', // who cares about the language, it's ajax !
			type     : 'POST',
			dataType : 'html',
			timeout  : 3000, // bigger timeout lets the php script use sleep() to minimize DDOS attempts
			error: function(e) {
				// server or network error
			},
			success: function(html) {
				top.location = top.location;
			}
		});
    });
});