$(function(){ 
	//Boutons teasers avec roll-over
	//-------------------------------
	if($(".dynamic_image_default").length>0){
		$(".dynamic_image_default").each(function(){
			var image_default = $(this);
			if(image_default.next(".dynamic_image_hover").length>0){
				var image_over = image_default.next(".dynamic_image_hover");
				image_default.hover(
					function(){	image_over.show();image_default.hide();},
					function(){	}
				);
				image_over.hover(
					function(){	},
					function(){	image_default.show();image_over.hide();}
				);
			}
		});
	}
	
	
	//Home news : defilement
	//-------------------------------
	if($(".home_newsandlink_news").length>0){
		$(".home_newsandlink_news").each( function() {
			var div = $(this);
			var size = div.children("ul").children("li").size() - 1;
			if(div.children("ul").children("li").size() > 1){
	    		var current = 0;
	    		$(this).everyTime(6000, function(i) {
			      	var currentElement = div.children("ul").children("li.selected");
			      	currentElement.hide().removeClass("selected");
			      	current = (current == size) ? 0 : (current + 1);
			      	var nextElement = currentElement.next();
			      	if (current == 0){
			      		nextElement = currentElement.parent().children(".first");
			      	}
			      	nextElement.show("slow",function(){ 
			      		nextElement.addClass("selected");
			      	});
			      	
			    }, 0);
		    }
		});
	}
	
	//Agences : rollover
	//-------------------------------
	if($(".agencies_viewer").length>0){
		$(".agencies_viewer").each( function() {
			var div = $(this);
			div.children().children().children().children().children(".agencies_region").hide();
			div.children().children().children().children().children(".agencies_region").children("ul").children("li").each( function() {
				$(this).hover(
					function(){	$(this).addClass("hover");},
					function(){	$(this).removeClass("hover");}
				);
			});
			
			/*div.children().children().children().children().children(".agencies_region").each( function(i) {
				if(i==0){
					$(this).show();
				}
			});*/
		});
	}
	
}); 

/**
*	Affiche la DIV de la region d'id idArea.
* 	Rappel id : id="agencies_region_<%=navRegion.getFileName().replaceAll("/","") %>"
*/
function displayAgenciesMapArea(idArea){
	if($("#"+idArea).length>0){
		$(".agencies_region").hide();
		$("#"+idArea).show();
	}
} 



