// FUNCIONES DE JQUERY
document.write('<style type="text/css">body{display:none}</style>');
jQuery(function($) {
	$('body').css('display','block');
});
$(document).ready(function() {
				
	// Preload all rollovers
	$("#cabecera li img, #cuerpo .mapa .google, #cuerpo .grafica p img, #leyendaSemana img, #columna img, #desplazamiento img, .enlaces img,#volver img, #bloqueCategorias img, #foto img,#izda img, #decha img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"-over.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#cabecera li a, #cuerpo .mapa a, #cuerpo .grafica p a, #leyendaSemana a,#columna a, #desplazamiento a,  .enlaces a, #volver a,#bloqueCategorias a, #foto a,#izda a, #decha a").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/-over/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"-over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
		}
	});	
	
	$("#cabecera li a, #cuerpo .mapa a, #cuerpo .grafica p a, #leyendaSemana a, #columna a, #desplazamiento a,  .enlaces a, #volver a, #bloqueCategorias a, #foto a,#izda a, #decha a").mouseout(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/-over/);
		
		// don't do the rollover if state is already ON
		if (matches) {
			imgsrcON = imgsrc.replace(/-over.gif$/ig,".gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
		}							 
	});				
	
});

function abrirVentana(url)
{	
	var ancho = 600;
	var alto = 540;
	var x = (screen.width/2)-(ancho/2);
	var y = (screen.height/2)-(alto/2);

	window.open(url,'avaicAvisoLegal','titlebars=0, toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+ancho+',height='+alto+',left='+x+',top='+y);
}

function abrirVentanaMail(pagina)
{	
	var ancho = 500;
	var alto = 340;
	var x = (screen.width/2)-(ancho/2);
	var y = (screen.height/2)-(alto/2);
		
	window.open('/includes/recomendar.php?pagina='+pagina,'avaicRecomendar','titlebars=0, toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+ancho+',height='+alto+',left='+x+',top='+y);
}

function abrirVentanaNivelesPolen()
{	
	var ancho = 340;
	var alto = 250;
	var x = (screen.width/2)-(ancho/2);
	var y = (screen.height/2)-(alto/2);
		
	window.open('/includes/popupInterpretacion.html','avaicNivelesPolen','titlebars=0, toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+ancho+',height='+alto+',left='+x+',top='+y);

}