/* FUNCION QUE REDUCE ESPACIOS EN LOCALIZACION DE BANNERS VACIOS */
/* CON http://ads.grupozeta.es/RealMedia/ads/Creatives/default/empty.gif DENTRO */

function OcultaEspacioBannersVacios () {
	var ua = navigator.userAgent.toLowerCase();
	function detect(text) {
	   stringposition = ua.indexOf(text) + 1;
	   data = text;
	   return stringposition;
	}
	var Capas = document.getElementsByTagName("div");
	for (var i=0; i<Capas.length; i++) {
		if (detect('msie')){
			if (Capas[i].getAttribute("className")=="Publicidadx01" || Capas[i].getAttribute("className")=="PublicidadTop3" || Capas[i].getAttribute("className")=="PublicidadTop1" || Capas[i].getAttribute("className")=="PublicidadTop2" || Capas[i].getAttribute("className")=="PublicidadBottom1" || Capas[i].getAttribute("className")=="PublicidadPosition1" || Capas[i].getAttribute("className")=="PublicidadPosition4" || Capas[i].getAttribute("className")=="PublicidadTopLeft" || Capas[i].getAttribute("className")=="PublicidadLeft3" || Capas[i].getAttribute("className")=="PublicidadMiddle1" || Capas[i].getAttribute("className")=="PublicidadFrame2" || Capas[i].getAttribute("className")=="PublicidadBottom2") {
				var BannerImg = Capas[i].getElementsByTagName("img");
				if (BannerImg!=null) {
					for (var n=0; n<BannerImg.length; n++) {
						ContieneEspacioVacio=BannerImg[n].getAttribute("src");
						if(ContieneEspacioVacio =='http://ads.grupozeta.es/RealMedia/ads/Creatives/default/empty.gif'){
							Capas[i].style.display = "none";
						}
					}
				}
			}	 
			if (Capas[i].getAttribute("className")=="Megabanner") {
				var BannerImg = Capas[i].getElementsByTagName("img");
				if (BannerImg!=null) {
					for (var n=0; n<BannerImg.length; n++) {
						ContieneEspacioVacio=BannerImg[n].getAttribute("src");
						if(ContieneEspacioVacio =='http://ads.grupozeta.es/RealMedia/ads/Creatives/default/empty.gif'){
							document.getElementById('CajaPromocionCabecera').style.display = "none";
						}
					}
				}
			}
			if (Capas[i].getAttribute("className")=="Megabanner") {
				if (Capas[i].innerHTML.indexOf('<!--  -->')!=-1){
					Capas[i].style.display = "none";
					document.getElementById('CajaPromocionCabecera').style.display = "none";
				}
			}			
		}else{
			if (Capas[i].getAttribute("class")=="Publicidadx01" || Capas[i].getAttribute("class")=="PublicidadTop3" || Capas[i].getAttribute("class")=="PublicidadTop1" || Capas[i].getAttribute("class")=="PublicidadTop2" || Capas[i].getAttribute("class")=="PublicidadBottom1" || Capas[i].getAttribute("class")=="PublicidadPosition1" || Capas[i].getAttribute("class")=="PublicidadPosition4" || Capas[i].getAttribute("class")=="PublicidadTopLeft" || Capas[i].getAttribute("class")=="PublicidadLeft3" || Capas[i].getAttribute("class")=="PublicidadMiddle1" || Capas[i].getAttribute("class")=="PublicidadFrame2" || Capas[i].getAttribute("class")=="PublicidadBottom2") {
				var BannerImg = Capas[i].getElementsByTagName("img");
				if (BannerImg!=null) {
					for (var n=0; n<BannerImg.length; n++) {
						ContieneEspacioVacio=BannerImg[n].getAttribute("src");
						if(ContieneEspacioVacio =='http://ads.grupozeta.es/RealMedia/ads/Creatives/default/empty.gif'){
							Capas[i].style.display = "none";
						}
					}
				}
			}
			if (Capas[i].getAttribute("class")=="Megabanner") {
				if (Capas[i].innerHTML.indexOf('<!--  -->')!=-1){
					Capas[i].style.display = "none";
					document.getElementById('CajaPromocionCabecera').style.display = "none";
				}
			}
		}
	}
}



/* Caja flotante de datos */

	function position(event){
	   var x = event.clientX+document.body.scrollLeft;
	   var y = event.clientY+document.body.scrollTop+document.documentElement.scrollTop;
	   if (document.getElementById('CajaEnMapa')) {
		   document.getElementById('CajaEnMapa').style.top= (y-30)+'px';
		   document.getElementById('CajaEnMapa').style.left= (x-210)+'px';  
	   }
	}
	
	function MostrarInformacion(IDPadre) {
		document.getElementById('CajaEnMapa').style.display = 'block';
		document.getElementById('TextoCajaEnMapa').innerHTML  = document.getElementById(IDPadre).alt;
	}
	
	function OcultarInformacion() {
		document.getElementById('CajaEnMapa').style.display = 'none';
	}	
	
	

function MostrarTextoCompletoComarcas() {
	document.getElementById('Texto').style.display='none';
	document.getElementById('Texto2').style.display='block';
	document.getElementById('MostrarTexto').style.display='none';
	document.getElementById('OcultarTexto').style.display='block';		
}

function OcultarTextoCompletoComarcas() {
	document.getElementById('Texto2').style.display='none';
	document.getElementById('Texto').style.display='block';
	document.getElementById('MostrarTexto').style.display='block';
	document.getElementById('OcultarTexto').style.display='none';		
}


if (self != top) { top.location.href = self.location.href }

function Ir(canal) {
parent.top.location = 'http://www.redextremadura.com/' + canal;
	} 
	
function Ir2(canal) {
parent.top.location = canal;
	} 

 function IrNumero(numero,tipo)
{
	parent.top.location = 'default.asp?numero=' + numero ;
} 
	
function openw(foto,ancho,alto)
	{ window.open(foto,"IWIN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width="+ancho+",height="+alto)
}

function openw2(foto,ancho,alto,scrol)
	{ window.open(foto,"IWIN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrol+",resizable=no,copyhistory=no,width="+ancho+",height="+alto)
}
// AUMENTAR Y REDUCIR TAMAŅO DE FUENTES
var objPage = null; 

// tamaņo en .em de la fuente gral. del cuerpo (se define tambien en la hoja de estilos).
var actual=0.7;

		function AumentarFuente(pageName) { 
			if (detect('msie')) {
					objPage=document.getElementById(pageName); 
					actual=actual+0.05;
					objPage.style.font=actual+"em;"
			}else{
					actual=actual+0.05;
					document.getElementById(pageName).style.fontSize=actual+"em;"
			}
		} 
		function ReducirFuente(pageName) { 
			if (detect('msie')) {		
					objPage=document.getElementById(pageName); 
					actual=actual-0.05;
					objPage.style.font=actual+"em;"
			}else{
					actual=actual-0.05;
					document.getElementById(pageName).style.fontSize=actual+"em;"			
			}			
		} 

	
function validate_busqueda() {
  	validity = true; // asume valido
        var result1=document.busqueda.searchstring.value
        if (result1==0){
        alert("Tienes que buscar algo!!");validity = false;}
  	return validity
}

function cambiarfondo(Elemento) {
	document.getElementById('Boton'+Elemento).style.backgroundColor='#4a70ae';
	document.getElementById('Boton'+Elemento).style.color='#FFFFFF';
	document.getElementById('Boton'+Elemento).style.border='#C65200';
	document.getElementById('Boton'+Elemento).style.cursor='default';
	document.getElementById('Boton'+Elemento).style.paddingLeft='18px';
	document.getElementById('Boton'+Elemento).style.paddingRight='18px';
	document.getElementById('Boton'+Elemento).style.textDecoration='none';			
	document.getElementById('Boton'+Elemento).style.fontSize='1.15em';				
	document.getElementById('Boton'+Elemento).style.fontWeight='bold';
	document.getElementById('Enlace'+Elemento).style.color='#FFFFFF';	
}

function OcultarCapa(IdCapa,idBoton) {
	document.getElementById(IdCapa).style.display='none';
	document.getElementById("Ocultar"+idBoton).style.display='none';
	document.getElementById('Mostrar'+idBoton).style.display='block';	
}
function MostrarCapa(IdCapa,idBoton) {
	document.getElementById(IdCapa).style.display='block';
	document.getElementById('Ocultar'+idBoton).style.display='block';
	document.getElementById('Mostrar'+idBoton).style.display='none';		
}	

function MostrarTextoCompletoComarcas() {
	document.getElementById('Texto').style.display='none';
	document.getElementById('Texto2').style.display='block';
	document.getElementById('MostrarTexto').style.display='none';
	document.getElementById('OcultarTexto').style.display='block';		
}

function OcultarTextoCompletoComarcas() {
	document.getElementById('Texto2').style.display='none';
	document.getElementById('Texto').style.display='block';
	document.getElementById('MostrarTexto').style.display='block';
	document.getElementById('OcultarTexto').style.display='none';		
}

function setPage( t_intPage )
{
	document.getElementById('InputHiddenCurrentPage').value = t_intPage;
	document.getElementById('FormMain').submit();
}

/* funcion que oculta o muestra el mapa en los listados de turismo */
function MostrarOcultarMapa () {
		document.getElementById('mapG').style.display='block';
		document.getElementById('ListadoDeRecursosTuristicos').style.display='none';		
}

function MostrarOcultarListado () {
		document.getElementById('mapG').style.display='none';		
		document.getElementById('ListadoDeRecursosTuristicos').style.display='block';
}

/*
	FUNCION PARA PESTA&Ntilde;AS DE GUIA DE EMPRESAS
	ABEL 19/10/2007

*/


	function MostrarOcultarPestannaGuiaEmpresas (IDPESTANNA,IDOPCION) {
		document.getElementById('ContenidoPestannaFicha1').style.display='none';
		document.getElementById('ContenidoPestannaFicha2').style.display='none';		
		document.getElementById(IDPESTANNA).style.display='block';
		document.getElementById('OpcionPest1').className ='Inactiva';
		document.getElementById('OpcionPest2').className ='Inactiva';		
		document.getElementById(IDOPCION).className='Activa';		
	}
	
	
/*
	FUNCION QUE MUESTRA Y OCULTA LAS PESTA&Ntilde;AS DE DATOS DE USUARIOS
*/	


		function ActivarPestannaDatosUsuarioComentarios(IdActivo,CajaActiva) {
				document.getElementById('Pestanna2').className="Inactivo";
				document.getElementById('CajaUltimosMensajes').style.display="none";					
				document.getElementById(CajaActiva).style.display="block";								
				document.getElementById(IdActivo).className="Activo";
		}
		
		function ActivarPestannaDatosUsuarioMensajes(IdActivo,CajaActiva) {
				document.getElementById('Pestanna1').className="Inactivo";
				document.getElementById('CajaUltimosComentarios').style.display="none";
				document.getElementById(CajaActiva).style.display="block";								
				document.getElementById(IdActivo).className="Activo";
		}		
	
		function ActivarPestannaDatos2Usuario() {
				document.getElementById('CajaUltimosMensajes').style.display="block";								
				document.getElementById('Pestanna2').className="Activo";
		}


/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
*
  Parametros:
	1st: String to trim
	2nd: char to delete
	
  	Without the second parameter, they will trim these characters:
	" " (ASCII 32 (0x20)), an ordinary space. 
	"\t" (ASCII 9 (0x09)), a tab. 
	"\n" (ASCII 10 (0x0A)), a new line (line feed). 
	"\r" (ASCII 13 (0x0D)), a carriage return. 
	"\0" (ASCII 0 (0x00)), the NUL-byte. 
	"\x0B" (ASCII 11 (0x0B)), a vertical tab. 
**/

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}				
	
	
/*-------------------------------------------------------------------------------------*/
/*UTILES GENERALES													   				   */
/*-------------------------------------------------------------------------------------*/
function validarFloat(valor){
	if(valor!=0){
		valor = parseFloat(valor);
		if (isNaN(valor)) {
			return "";
		}
	}
	return valor;
}
function Redondear(x, places){
	return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
}