//INIT
$(document).ready(function() {
	//tooltips
 	$('sup').mouseover(function(){
  		muestra_tooltip(this);
	});
	$('sup').mouseout(function(){
  		oculta_tooltip();
	});
	$('sup').click(function(){
  		goto_url(this);
	});
});
function ajustar_altura(){
	//ajusto altura para footer
	//alert("contenedor: "+$("div.contenedor").height()+" contenido: "+$("div.contenido").height()+" menu izq: "+$("div.subbotonera").height()+" caja_central: "+$("div.caja_central").height()+" noticia: "+$("div.noticia_detalle").height());
	var contenedor = $("div.contenedor").height();
	var contenido = $("div.contenido").height() + 100;
	var menu_izq = 	$("div.subbotonera").height() + 120;
	var caja_central =  $("div.caja_central").height() + 120;
	var noticia_detalle =  $("div.noticia_detalle").height() + 120;
	if(menu_izq > contenedor){
		$("div.contenedor").css("height",menu_izq);
	}
	if(contenido > contenedor){
		$("div.contenedor").css("height",contenido);
	}
	if(caja_central > contenedor){
		$("div.contenedor").css("height",caja_central);
	}
	if(noticia_detalle > contenedor){
		$("div.contenedor").css("height",noticia_detalle);
	}
	if($("div.subbotonera").height() > 300){
		$("div.contenedor").css("height",$("div.subbotonera").height() + 80);
	}
}
//TOOLTIPS EN NOTICIAS
function muestra_tooltip(yo){
	var num = $(yo).html();
	$("#tooltip").show();
	$("#tooltip").html(cadenas[num]);	
	
	var p = $(yo).position();
	var pt = p.top;
	var pl = p.left+20;
	
	$("#tooltip").css({"top":pt,"left":pl});		
}
function goto_url(yo){
	var num = $(yo).html();
	var url = urls[num];
	if(url != ""){
		window.open(url);
	}
}
function oculta_tooltip(){
	$("#tooltip").hide();
}
//FORMULARIO ZONA CLIENTES
function comprobar_zonaclientes(msg){
	var tots = 0;
	var req = 0;
	if(document.clientes.login.value == "" || document.clientes.pass.value == ""){
		alert(msg);
	}else{
		document.clientes.submit();
		$("#ftpweb").show();
		$("#formftp").hide();
	}
}
