jQuery(function($){
	$("#listado_ciudades a").hover(function(event){
		var punto=$(this).attr("punto");		
		$("#punto_mapa").css({
			"background":"url('/wp-content/themes/red_salud/images/fondos/"+punto+".png')  19px 5px no-repeat"
		})
	},function(event){
		$("#punto_mapa").css({
			"background":"none"
		})
	});
	$("#listado_ciudades a").click(function(event){
		
		if($("#acercamiento_mapa").css("height") != "0px")
			return false;
		
		event.preventDefault();
		var nombre=$(this).attr("name");
		var coord=$(this).attr("coord");
		$("#acercamiento_mapa")
			.css({
				"background-position":coord,
				"overflow":"visible"
			})
			.animate({
			"height":"300px"
		});
		$("#listado_"+nombre).css("display","block");
			$("#listado_"+nombre+" li").css("display","block");
			$("#listado_"+nombre+" div").css("display","none");
			$("#listado_"+nombre+" span").css("display","none");
			$("#listado_"+nombre+" a").hover(function(){
				$(this).siblings("div").stop(true,true).fadeIn();
				$(this).siblings("span").stop(true,true).fadeIn();
				$(this).parent().css('z-index','999');
			},function(){
				$(this).siblings("div").stop(true,true).fadeOut();
				$(this).siblings("span").stop(true,true).fadeOut();
				$(this).parent().css('z-index','1');
			});
		return false;
	})
	
	$("#cerrar_mapa").click(function(){
		$("#acercamiento_mapa").css("overflow","hidden").animate({
			"height":"0px"
		});	
		$("#listado_centros li").css({"display":"none"});
	});
	
	$("#acercamiento_mapa a").click(function(){
		return false;
	})
});

