Cufon.replace('.encabezado');
$(document).ready(function() {
	// FancyBox - Inicialización
	$("a.fancy").fancybox();
	$("[rel=fancy]").fancybox();
	var efectos = $(".fancy_oculto a[rel=fancy]");
	efectos.fancybox({
		'autoScale' : true,
		'speedIn'		:	1000, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'hideOnContentClick': true
	});	
	//Lista desplegable del menu 
	$(".dldesplegable dd").hide();
	$(".dldesplegable dt").each(function(){
		$(this).click(function(){
			$(this).next().slideToggle();			  
		});
	});
	$(".dldesplegable a.volveratras").each(function(){
		$(this).click(function(){	
			$(this).parents('dd').slideUp();
			return(false);
		});
	});
	//Menu desplegable del menu superior
	$(".menulogin ul li").each(function(){
		$(this).mouseover(function(){
								   
			$(this).stop(true,true).animate({
				marginLeft:"-110px"
			}, 500, function(){
			});
		});
		$(this).stop(true,false).mouseleave(function(){
			$(this).animate({
				marginLeft:"0px"
			}, 100, function(){
				
			});
		});
	});
	//Desplegable de volver atrás
	$(".volverdiv").mouseover(function(){
		$(this).mouseover(function(){
			$("a.volver").animate({
				width:"99px"
			}, 500, function(){
			});
		});
		$(this).mouseleave(function(){
			$("a.volver").animate({
				width:"17px"
			}, 100, function(){
				
			});
		});
	});
	//Novedades li p
	$("ol.novedades li").mouseover(function(){
		$(this).find("p").css("backgroundColor","#eddfcd");									 
	});
	$("ol.novedades li").mouseleave(function(){
		$(this).find("p").css("backgroundColor","#fcfaf7");									 
	});
	//Menu desplegable de los bloques de inicio
	$(".bloqueinicio").click(function(){
		//Cerramos la que esté visible
		if( $(this).find("ul.lista").is(':not(:visible)') ) $("ul.lista:visible").slideUp('fast');
		$(this).find("ul.lista").slideToggle();
		
	});
	$(".bloqueinicio span.cerrarmenu").click(function(){ $($this).parents("ul.lista").hide(); });
	
	//Para la portada e inndex
	$("#centrar").css("min-height", "510px");
	
	//Redes Sociales
	$(".facebook").each(function(){ $(this).attr({"href":"http://www.facebook.com/sharer/sharer.php?src=bm&u="+ encodeURIComponent("http://"+document.domain+"/"+$(this).attr("href")) + "&v=3","target":"_blank"}); });
	
	$(".twitter").each(function(){ $(this).attr({"href":"http://twitter.com/home?status="+ encodeURIComponent("Leyendo http://"+document.domain+"/"+$(this).attr("href")+" en AECERIBER.es"),"target":"_blank"}); });
	
	$(".tuenti").each(function(){ $(this).attr({"href":"http://www.tuenti.com/share?url="+ encodeURIComponent("http://"+document.domain+"/"+$(this).attr("href")),"target":"_blank"}); });
	
	
	//Para el buscador
	$('#busc_fecha').hide();
	$('#buscador ul li :radio').click(function(){
		if( $(this).val() == 'lf'){
			$('#busc_texto').slideUp('fast');
			$('#busc_fecha').slideDown('fast');
		} else if( $(this).val() == 'lt'){
			$('#busc_fecha').slideUp('fast');
			$('#busc_texto').slideDown('fast');
		}
	});
});
