	var contCapaInterstitial = 0;
				
				
	function comprobarCapaInt()
	{
		
		
		if (document.getElementById("pagina")==null)
		{
			return false;
		}
		return true;
	
	}
	
	
	function Poner_Publicidad()
	{	
		if (!comprobarCapaInt() && contCapaInterstitial < 10)
		{
			contCapaInterstitial ++;
	
			setTimeout("Poner_Publicidad()",500);
			return;
		}
		else
		{
			if (comprobarCapaInt())
			{                
				document.getElementById("pagina").style.display = "none";
			}
			document.getElementById("interstitialOAS").style.display = "block";
			Time_Out();
		}
	}
	
	
	
	function Quitar_Publicidad()
	{
		
		if (comprobarCapaInt())
		{
			document.getElementById("pagina").style.display = "block";
		}
		document.getElementById("interstitialOAS").style.display = "none";
	
		prepareTargetBlank();
	
	}
	


	
	function Time_Out()
	{
		setTimeout('Quitar_Publicidad()',5000);
	}
	



	
	//Hay que cambiar "cierralayer()" por la funcion que sale en el error al darle al aspa de cierre del interstitial
	
	function cierralayer()
	{
		Quitar_Publicidad();
	}
	
	
	
	
	// Función que habilita los target blank de loMás leido/votado/último. 
	// Si no se incluye aquí deja de funcionar
	
	function prepareTargetBlank(){
		var className = 'servicio_enlacepeq';
		var as = document.getElementsByTagName('a');
		for(i=0;i<as.length;i++){
			var a = as[i];
			r=new RegExp("(^| )"+className+"($| )");
			if(r.test(a.className)){
				a.onclick = function(){
					window.open(this.href);
					return false;
				}
			}
		}
	}