// Ajout pour bloc nous joindre dans le footer
(function($){
	$(document).ready(function() {
		var open = false;
	
		var isIe7 = $('html').attr('class');
			isIe7 = isIe7.search('ie7') ? true : false;
		var btn_contact = $("#btn_contact"),
			myList = btn_contact.find("ul"),
			bar_foot = $("#bar_foot");
			btn_contact.on("click","button", function(){
					//var pos = $(this).position().left;
					var menuHide = $(this).next("ul");
					//var menuHide = $(this).next("ul").toggle();
					if (open) {
						menuHide.fadeOut('fast', function () {
						open = false;
						menuHide.attr('aria-expanded',false);
						// console.log('expanded false')
					});
				}
					else {
					menuHide.fadeIn('fast', function () {
					open = true;
					menuHide.attr('aria-expanded',true);
					//console.log('expanded true')
					});
				}
				}).on("focus","button", function(){
					$(this).trigger('click') ;
				}).on("click","a", function(){
					var myLink = $(this);
					if(!myLink.hasClass("active")){
						var myDiv = myLink.data("contact"),
						myText = $(this).text();
						myList.hide().find(".active").removeClass("active");
						myLink.addClass("active");
						bar_foot.find(".nous_content").hide().end()
						.find("button").text(myText);
						$("#" + myDiv).fadeIn().addClass("active");
					}
				}
			);
			bar_foot.on("change","select", function(){
				myVal = $(this).val();
				myText = $('option:selected', this).text();
				bar_foot.find(".nous_content").hide();
				$("#nous_" + myVal).fadeIn().addClass("active");
	
				//stuff for bigger version in case window is resized
				myList.find(".active").removeClass("active");
				$(".nous_" + myVal).addClass("active");
				bar_foot.find("button").text(myText);
			});
			$('#sitemap a.link:first').focus(function(){
				open = false;
			});
	
			$('.residentiel.section a:first').focus(function(){
				$("#btn_contact ul").hide();
			});
		       

	});
}(jQuery));