document.write('<style type="text/css">#menu{display:none;}<\/style>');
jQuery(document).ready(function($) {
	// Twitter hack
	///////////////
	$('<div class="rss"><a href="http://twitter.com/statuses/user_timeline/182972834.rss" title="Le flux RSS du Twitter de Eco habitat Bretagne"><img src="http://www.eco-habitat-bretagne.org/wp-content/themes/eco-habitat-bretagne/images/logo-twitter-rss.gif" height="18" width="18" alt="Le flux RSS du Twitter de Eco habitat Bretagne" /></a></div>').insertBefore($('ul.twitter'));
	

	// Menu
	///////
	$("#menu").css("display", "block");
	
	
	$("#main-menu ul.sub-menu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.sub-menu
	$("#main-menu ul.sub-menu").attr('style', 'display:none;');
	$("#main-menu ul.menu li").mouseover(function() { //When trigger is clicked...
		//Following events are applied to the sub-menu itself (moving sub-menu up and down)
		$(this).find("ul.sub-menu").slideDown('fast').show(); //Drop down the sub-menu on click
		$(this).hover(function() {
		}, function(){	
			$(this).parent().find("ul.sub-menu").slideUp('slow'); //When the mouse hovers out of the sub-menu, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	$("#menu ul.sub-menu li:last-child a").css("border-bottom", "0 none");
	
	menuWidth = $("ul#menu").width();
	$("ul#menu").css('width', menuWidth);
	correctMargin = Math.round((950 - menuWidth) / 2);
	$("ul#menu").css('margin', '0px '+correctMargin+'px');
	
	// CORNERS
	//////////
	$("#access").corner("bottom");
	$("#search-wrap").corner("5px");
	$("#menu ul.sub-menu").corner("bottom 5px");
	
	function adjustMyFooterPlease(){ // Scalable footer height depending on the rest of the content's height
		var newHeight= Math.round($(window).height() - $('#container').height());
		 if (newHeight >30){
			$('#footer').height(newHeight);
		}else{
			$('#footer').height(30);
		}
	}
	$(document).ready(function() {
		adjustMyFooterPlease();
		$(window).resize(adjustMyFooterPlease);
	});
	
	// sidebar separations
	$("#sidebar-right li.widget_lizu_cal").after('<li class="sidebar-sep"></li>');
	$("#sidebar-right li.widget-simpletags").after('<li class="sidebar-sep"></li>');
	$("#sidebar-right li.widget_twitter").after('<li class="sidebar-sep"></li>');

});
