$(function() {

	// Function to get height(s) of doc :
	function get_document_dimensions() 
	{
		var height_window = 0;
		var height_body = 0;

		var body = document.body,
		html = document.documentElement;

		var height_body = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );

		if( typeof( window.innerWidth ) == 'number' ) 
		{ //Non-IE
			height_window = window.innerHeight;
		} 
		else if( document.documentElement && document.documentElement.clientHeight ) 
		{ //IE 6+ in 'standards compliant mode'
			height_window = document.documentElement.clientHeight;
		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
		{ //IE 4 compatible
			height_window = document.body.clientHeight;
		}
		return [height_window, height_body];
	}

	// Get back dimensions :
	var height = get_document_dimensions();
	var height_header = $("#header").height();
	var height_window = height[0];
	var height_body = height[1];
	
	// Set height of menu according to previous values :
	var height_menu = 0;
	((height_body<height_window) ? height_menu = height_window-height_header : height_menu = height_body-height_header);

	$("#container_bis #left").height(height_menu);
	
	// Set selected item in menu : 
	var url = window.location.href;
    url = url.slice(7);
    url = url.split("/");
	url = url[url.length-1].substr(0, url[url.length-1].length-4);
	
	if(url[0] != "?") $("#menu_"+url+" a").addClass("selected");
});
