try{
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
document.write(unescape("%3Cscript src='/js/fganalytics.js' type='text/javascript'%3E%3C/script%3E"));
}catch(e){
}

/**ABRE BANCA A DISTANCIA A UNA OPERATORIA*******/
function contratarCD(operacion, vrs, camino){
   escribeformuAccesoCD();
   enviaCD(operac,vrs,camino);
}
function enviaCD(operac,vrs,camino)
	{
		
		document.getElementById("formuCD").PGDESTI.value=operac;
		document.getElementById("formuCD").OPERACION.value='LOGIN2';
		document.getElementById("formuCD").CAMINO.value=camino;
		document.getElementById("formuCD").VRS.value=vrs;
		document.getElementById("formuCD").submit();
	}
function escribeformuAccesoCD()
{
	//document.write('<form id="formuCD" action="https://asturvia.cajastur.es/cgi-bin/INclient_4048" method="post" enctype="application/x-www-form-urlencoded" target="_blank">');
	document.write('<form id="formuCD" action="https://asturvia.cajastur.es/cgi-bin/INclient_4048" method="post" enctype="application/x-www-form-urlencoded">');
	document.write('<div><input name="OPERACION" type="hidden" value="" />');
	document.write('<input name="IDIOMA" type="hidden" value="01" />')
	document.write('<input name="CAJA" type="hidden" value="2048" />')
	document.write('<input name="CAMINO" type="hidden" value="" />')
	document.write('<input type="hidden" name="PGDESTI" value="" />');
	document.write('<input type="hidden" name="VRS" value="" />')
	document.write('<input type="hidden" name="BROKER" value="SI" />');
	document.write('</div></form>');
}
/* Abre popup. */
	function popup(sURL)
	  {newwindow=open(sURL,"popupnav","scrollbars=no,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=710,height=475,screenX=20,screenY=20,left=20,top=20");}
	function popup2(sURL)
	  {newwindow=open(sURL,"popupnav","scrollbars=no,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=470,height=375,screenX=20,screenY=20,left=20,top=20");}	  
	function popup3(sURL)
	  {newwindow=open(sURL,"popupnav3","scrollbars=yes,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=470,height=375,screenX=20,screenY=20,left=20,top=20");}	  
/* FIn Abre popup */

/***BUSCADOR**/
function escribebuscador()
{
 /*funcionalidad disponible*/
			//es la buena
			//document.write('<form name="fbuscador" method="get" action="/buscador/servlet/busca"><div class="" style="text-align:right;position:relative;top:36px" ><input type="text" name="value"  size="20" style="vertical-align:middle;font-family:verdana,arial;"/><input type="image" class="lupa" src="/comunes/btn_buscador.gif" alt="buscar" style="vertical-align:middle;margin-left:4px" /></div><input type="hidden" name="col" value="particulares"><input type="hidden" name="col" value="empresas"><input type="hidden" name="col" value="generaciona"><input type="hidden" name="col" value="doblea"><input type="hidden" name="col" value="osyc"><input type="hidden" name="col" value="conozcacajastur"></form>');
	
	
	//document.write('<form name="fbuscador" method="get" action="https://www.cajastur.es/searchblox/servlet/SearchServlet"><div class="buscador"><input type="image" class="lupa" src="/images/btnbuscar.gif" alt="buscar" width="61" height="16" /><input type="text" name="query"  size="30" /></div><input type="hidden" name="col" value="1"><input type="hidden" name="col" value="2"><input type="hidden" name="col" value="3"><input type="hidden" name="col" value="4"></form>');
//	document.write('<div style="margin-top:29px"><img src="/images/sizer.gif" alt="" width="1" height="1"/></div>');

/*funcionalidad no disponible*/
	//document.write('<form name="fbuscador" method="get" action="https://www.cajastur.es/searchblox/servlet/SearchServlet" onSubmit="alert(\'Funcionalidad no disponible en estos momentos\');return false;"><div class="buscador"><a href="#" onClick="alert(\'Funcionalidad no disponible en estos momentos\')"><img class="lupa" src="/images/btnbuscar.gif" alt="buscar" width="61" height="16" /></a><input type="text" name="query"  size="30" /></div><input type="hidden" name="col" value="1"><input type="hidden" name="col" value="2"><input type="hidden" name="col" value="3"><input type="hidden" name="col" value="4"><input type="hidden" name="col" value="5"><input type="hidden" name="col" value="6"></form>');
}

function addLoadEventJS(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

/* menú inferior izda . Acceso a Banca a Distancia */
function menubancadistancia(){
	document.write('<div class="inf">')
	if (location.href.indexOf('https://')!=-1)/*Si va por seguro*/
	{
		document.write('<div class="cuadrogris" >')
		if(document.location.href.indexOf('/empresas')!=-1){/*Si es empresas*/
			document.write('<iframe id="framebancadistancia" src="https://cajasturdirecto.cajastur.es/BEWeb/2048/5048/portal_inicio_identificacion.action" name="loginCECA" id="loginCECA" width="160" height="115" frameborder="0" title="Acceso al servicio de Asturvía para clientes Cajastur">');
			document.write('<a href="https://asturvia.cajastur.es/5048" >Acceda a su banca por internet desde entorno seguro</a>');
			document.write('</iframe>');
			
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-bottom:-15px;"><a href="/claves/index.html" onclick="popup2(this.href);return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Has olvidado tus claves?</a></p>');
			document.write('<br/><p class="alertaseguridad" style="border-bottom:1px solid #DFDFDF;text-align:left;padding:10pt 0 8% 4%;"><a href="/recseguridad/indexw.html" style="color:#FF1900;" style="text-align:left;">Aviso importante de seguridad</a></p>');	
		}						
		else{/*Si es particular*/
			document.write('<iframe id="framebancadistancia" src="https://cajasturdirecto.cajastur.es/BEWeb/2048/4048/portal_inicio_identificacion.action" name="loginCECA" id="loginCECA" width="160" height="115" frameborder="0" title="Acceso al servicio de Cajastur Directo para clientes Cajastur">');
			document.write('<a href="https://asturvia.cajastur.es/4048" >Accede a tu banca por internet desde entorno seguro</a>');
			document.write('</iframe>');
			
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-bottom:-10px;"><a href="/claves/index.html" onclick="popup2(this.href);return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Has olvidado tus claves?</a></p>');
			document.write('<p class="alertaseguridad" style="border-bottom:1px solid #DFDFDF;text-align:left;padding:10pt 0 8% 4%;margin-top:10px;"><a href="/recseguridad/indexw.html" style="color:#FF1900;" style="text-align:left;">Aviso importante de seguridad</a></p>');
		}
		document.write('</div>')
		document.write('<div style="background-color:#ECECEC">')
		if(document.location.href.indexOf('/empresas')!=-1)/*Si es empresa*/
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:0px;"><a href="/empresas/bancadistancia/banca3.html" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p>')	
		else
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:0px;"><a href="/contratacion/" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p>')	
		
		if(document.location.href.indexOf('/empresas')!=-1)/*Si es empresa*/
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a href="/demo/5048/index.html">Ver demostración</a></p>')
		else{
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a href="/demo/4048/index.html">Ver demostración</a></p>');
			
			// Empresas no tiene este enlace
			// Tanto Particulares como GeneracionA(jovenes) tienen sus propios JS (particularesinicio.js y funcionesGA.js)
			if (document.location.href.indexOf('/osyc')!=-1)
				document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a onclick="pageTracker._trackEvent(\'Banca Electronica\', \'DNIe\', \'Acceso desde OSYC\')" href="https://cajasturdirecto.cajastur.es/BEWeb/2048/4048/inicio_identificacion_DNIE.action">Acceso con DNI electrónico</a></p>');
			else if (document.location.href.indexOf('/conozcacajastur')!=-1)
				document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a onclick="pageTracker._trackEvent(\'Banca Electronica\', \'DNIe\', \'Acceso desde Conozca Cajastur\')" href="https://cajasturdirecto.cajastur.es/BEWeb/2048/4048/inicio_identificacion_DNIE.action">Acceso con DNI electrónico</a></p>');
			else
				document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a onclick="pageTracker._trackEvent(\'Banca Electronica\', \'DNIe\', \'Acceso desde una Promocion\')" href="https://cajasturdirecto.cajastur.es/BEWeb/2048/4048/inicio_identificacion_DNIE.action">Acceso con DNI electrónico</a></p>');	
			}
			
		document.write('</div>')
		
		
		addLoadEventJS(function() {
	
			try { // EN IE FALLA, PERO ES LO QUE QUEREMOS, PUES EL ENLACE QUE ESTAMOS AÑADIENDO APARECE BIEN EN EL IE SIN TENER QUE HACER ESTOS TEMAS...
	
				var fr = document.getElementById("framebancadistancia");
				for (var i=fr.childNodes.length-1; i>=0; i--) {
					var hijo = fr.childNodes[i];
					fr.removeChild(hijo);
				}
				
				var a = document.createElement("a");
				a.href = "https://asturvia.cajastur.es/4048";
				a.innerHTML = "Accede a tu banca por internet desde entorno seguro";
	
				fr.appendChild(a);
				
			} catch (e) {
			
			}

		});
		
		
	}	
	else {
		document.write('<div class="cuadrogris" >')
		document.write('<strong>Acceso a clientes<br />de Banca por Internet:</strong><br /><br />');
		if(document.location.href.indexOf('/empresas')!=-1){
			document.write('Por motivos de seguridad se ha deshabilitado el acceso desde esta página, ya que usted está accediendo desde un entorno no seguro (http, en lugar de https). <br /><br /><a href="https://asturvia.cajastur.es/5048" >Acceda a su banca por internet desde entorno seguro</a> ');
			document.write('</div>')
			document.write('<p style="text-align:left;padding:0 0 0 4%;"><a href="/empresas/bancadistancia/banca3.html" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p><br/>')		
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:-15px;"><a href="/demo/5048/">Ver demostración</a></p><br/>')
		}	
		else{
			document.write('Por motivos de seguridad se ha deshabilitado el acceso desde esta página, ya que estás accediendo desde un entorno no seguro (http, en lugar de https). <br /><br /><a href="https://asturvia.cajastur.es/4048" >Accede a tu banca por internet desde entorno seguro</a> ');
			document.write('</div>')	
			document.write('<p style="text-align:left;padding:0 0 0 4%;"><a href="/contratacion/" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p><br/>')		
			document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:-15px;"><a href="/demo/4048/">Ver demostración</a></p><br/>')	
		}
	}
	document.write('</div>')			
}
/* menú inferior izda . Acceso a Banca a Distancia (desde una Promocion de Empresas) */
function menubancadistanciapromoempresa(){
	document.write('<div class="inf">')
	if (location.href.indexOf('https://')!=-1)/*Si va por seguro*/
	{
		document.write('<div class="cuadrogris" >')
		
		document.write('<iframe src="https://cajasturdirecto.cajastur.es/BEWeb/2048/5048/portal_inicio_identificacion.action" name="loginCECA" id="loginCECA" width="160" height="115" frameborder="0" title="Acceso al servicio de Asturvía para clientes Cajastur">');
		document.write('<a href="https://asturvia.cajastur.es/5048" >Acceda a su banca por internet desde entorno seguro</a>');
		document.write('</iframe>');
		
		document.write('<p style="text-align:left;padding:0 0 0 4%;margin-bottom:-15px;"><a href="/claves/index.html" onclick="popup2(this.href);return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Has olvidado tus claves?</a></p>');
		document.write('<br/><p class="alertaseguridad" style="border-bottom:1px solid #DFDFDF;text-align:left;padding:10pt 0 8% 4%;"><a href="/recseguridad/indexw.html" style="color:#FF1900;" style="text-align:left;">Aviso importante de seguridad</a></p>');	
		
		document.write('</div>')
		document.write('<div style="background-color:#ECECEC">')
		document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:0px;"><a href="/empresas/bancadistancia/banca3.html" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p>')
		
		document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:10px;"><a href="/demo/5048/index.html">Ver demostración</a></p>');
		
		document.write('</div>')
	}	
	else {
		document.write('<div class="cuadrogris" >')
		document.write('<strong>Acceso a clientes<br />de Banca por Internet:</strong><br /><br />');
		
		document.write('Por motivos de seguridad se ha deshabilitado el acceso desde esta página, ya que estás accediendo desde un entorno no seguro (http, en lugar de https). <br /><br /><a href="https://asturvia.cajastur.es/4048" >Accede a tu banca por internet desde entorno seguro</a> ');
		document.write('</div>')	
		document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:0px;"><a href="/empresas/bancadistancia/banca3.html" onclick="abrecontratacion();return false" target="_blank" title="abre en ventana nueva" style="text-align:left;">¿Cómo empezar a operar por internet?</a></p>')	
		document.write('<p style="text-align:left;padding:0 0 0 4%;margin-top:-5px;"><a href="/demo/5048/index.html">Ver demostración</a></p><br/>')	
	}
	document.write('</div>')			
}
			
/* Fin /menú inferior izda . Acceso a Banca a Distancia */			
/**************CAJASTUR DIRECTO FUNCIONES ***********************************/
var recibo=0;

function abrecajadirecto()
	{
		var fecha = new Date();
		var dia=fecha.getDate();
		var mes=fecha.getMonth()+1;
		var hora=fecha.getHours();
		if ((document.getElementById('formuBanca').PAN1.value!='')&&(document.getElementById('formuBanca').PIN1.value!=''))
			{	
				document.getElementById('formuBanca').PAN.value=document.getElementById('formuBanca').PAN1.value.toUpperCase();
				document.getElementById('formuBanca').PIN.value=document.getElementById('formuBanca').PIN1.value;
				document.getElementById('formuBanca').PAN1.value='';
				document.getElementById('formuBanca').PIN1.value='';
				document.getElementById('formuBanca').OPERACION.value='CORP';
				document.getElementById('formuBanca').submit();
			}
	}

function cajadirecto()
{
	if ((document.getElementById('formuBanca').PAN1.value!='')&&(document.getElementById('formuBanca').PIN1.value!=''))
	{
		setTimeout("abrecajadirecto()",1500);
	}
}
/**************/ /*CAJASTUR DIRECTO FUNCIONES*******************************/


/* menu superior */
function menusup(){
	document.write('<div class="opcion"><a href="/mapaweb/?titulo='+document.title+'">Mapa Web</a></div>')
  	document.write('<div class="opcion"><a href="/conozcacajastur/contacto/contacto.html?titulo='+document.title+'">Contacto</a><img src="../images/sizer.gif" alt="" width="7" height="1" /><img src="../images/barrasep.gif" alt="" width="1" height="10" /></div>')
  	document.write('<div class="opcion"><a href="#">Preguntas frecuentes</a><img src="../images/sizer.gif" alt="" width="7" height="1" /><img src="../images/barrasep.gif" alt="" width="1" height="10" /></div>')
  	document.write('<div class="opcion"><a href="/oficinasycajeros/?titulo='+document.title+'">Oficinas y cajeros</a><img src="../images/sizer.gif" alt="" width="7" height="1" /><img src="../images/barrasep.gif" alt="" width="1" height="10" /></div>')
	  	
}
/* /menu superior */




/* Abre popups de promociones */
function abrepromo()
{
    newwindow=open('/promociones/promo.html',"popupcon","scrollbars=yes,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=727,height=480,screenX=20,screenY=20,left=20,top=20");
}
function abrepromologin()
{
    newwindow=open('/promociones/promologin.html',"popupcon","scrollbars=yes,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=727,height=480,screenX=20,screenY=20,left=20,top=20");
}
/* /Abre popups de promociones */

/* Abre popup de contratación de banca a distancia */
function abrecontratacion()
{
    newwindow=open('/contratacion/',"popupcon","scrollbars=yes,location=no,toolbar=no,directories=no,menubar=no,resizable=no,resize=no,status=no,width=710,height=470,screenX=20,screenY=20,left=20,top=20");
}

/* /Abre popup de contratación de banca a distancia */

/* rellena el combo para búsqueda por temas de publicaciones */
function vertemas () {
		document.write('<select id="idtema" name="idtema" >');
		document.write('<option value="-1" >Seleccione Tema</option>');
		document.write('<option value="1">Arqueología</option>');       
		document.write('<option value="2">Arquitectura</option>');      
		document.write('<option value="3">Arte</option>');              
		document.write('<option value="4">Asturias</option>');          
		document.write('<option value="5">Biografias</option>');        
		document.write('<option value="6">Ciencias Naturales</option>');
		document.write('<option value="7">Ciencias Sociales</option>'); 
		document.write('<option value="8">Cine</option>');              
		document.write('<option value="9">Derecho</option>');           
		document.write('<option value="10">Diseño</option>');           
		document.write('<option value="11">Escultura</option>');        
		document.write('<option value="12">Etnografia</option>');       
		document.write('<option value="13">Fotografia</option>');       
		document.write('<option value="14">Geografia</option>');        
		document.write('<option value="15">Grabado</option>');          
		document.write('<option value="16">Historia</option>');         
		document.write('<option value="17">Lengua</option>');           
		document.write('<option value="18">Literatura</option>');       
		document.write('<option value="19">Musica</option>');           
		document.write('<option value="20">Pintura</option>');          
		document.write('</select>');
}

/* //rellena el combo para búsqueda por temas de publicaciones */
/* FORMATMILES */
function formatmiles(num)
  {
    var straux=num.toString();
    var strfinal='';
    var len=straux.length;
    var nptos=(len-1)/3;
    var ptoactual=1;

    if (straux.indexOf(',')!=-1)
    	{
        var comp=straux.split(",");
        strfinal=formatmiles(comp[0])+','+comp[1];
        return strfinal
    	}
    else
    	{
			if (len>3)
				{
					for(i=len-1;i>=0;i--)
						{
							if (nptos!=0)
								{
									if (len-i-1==ptoactual*3)
										{strfinal='.'+strfinal;nptos--;ptoactual=2;}
								}
							strfinal=straux.charAt(i)+strfinal;
						}
					return strfinal
				}
			else return num
		}    
  }
/* /FORMATMILES */  
  

/* COMBO PARA VER MÁS NOTICIAS */
	function vermasnoticias () {
		document.write('<form name="formusel" id="formusel" onsubmit="self.location.href= this.selectnoticias.value; return false" >');
		//document.write('<select id="selectnoticias" name="" onchange="self.location.href= this.value ;" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;" >');
		document.write('<label for="selectnoticias" style=" margin-left:3%;">Seleccione portal:</label><br />');
		document.write('<select id="selectnoticias" name="selectnoticias" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:1em; margin-left:3%;" >');
		//document.write('<option >Seleccione para ver otras noticias</option>');
		document.write('<option value="/particulares/noticias/listadonoticias1.html">Particulares</option>');
		document.write('<option value="/jovenes/noticias/listadonoticias2.html">Generación A</option>');
		document.write('<option value="/osyc/listadonoticias1.html">Obra Social y Cultural</option>');
		document.write('<option value="/empresas/listadonoticias4.html">Empresas</option>');
/*		document.write('<option value="/osyc/asocial/discapacitados.html">Discapacitados</option>');
		document.write('<option value="/osyc/asocial/marginados.html">Marginados</option>');
		document.write('<option value="/osyc/asocial/centros.html">Tercera Edad</option>');
		document.write('<option value="/osyc/asocial/cooperacion.html">Cooperación</option>');
		document.write('<option value="/osyc/asocial/convenios.html">Convenios</option>');
		document.write('<option value="/osyc/asocial/ferias.html">Ferias</option>');
		document.write('<option value="/osyc/adocente/becas.html">Becas de Investigación</option>');
		document.write('<option value="/osyc/adocente/premios.html">Premios</option>');
		document.write('<option value="/osyc/adocente/universidad.html">Universidad</option>');
		document.write('<option value="/osyc/adocente/escolares.html">Actividades Escolares</option>');
		document.write('<option value="/osyc/adocente/investigacion.html">Investigaciones Sanitarias</option>');
		document.write('<option value="/osyc/adocente/oncologia.html">Instituto de oncología</option>');*/
		document.write('<option value="/clubdoblea/listadonoticias.html">Club Doble A</option>');
		document.write('<option value="/conozcacajastur/noticias/">Conozca Cajastur</option>');
		document.write('</select>');
		document.write('&nbsp;<input type="submit" value="ver noticias" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:1em;" />');
		document.write('</form><br /><br />');
		
}
/* /COMBO PARA VER MÁS NOTICIAS */

/* CUADRO DE OPCIONES */
function cuadroopciones () {
	document.write('<ul class="cuadroopciones">');
	document.write('<li class="opcion"><a href="#" onclick="imprimir();return false" ><img src="/images/ico_imprimir.gif" alt="" />imprimir</a></li>');
	document.write('<li class="opcion"><a href="#" onclick="favoritos(window.location,window.document.title);return false" ><img src="/images/ico_favoritos.gif" alt="" />añadir a favoritos</a></li>');
	document.write('</ul>');
}
function cuadroopciones2 () {
	document.write('<ul class="cuadroopciones">');
	document.write('<li class="opcion"><a onclick="imprimir();return false"><img src="/images/ico_imprimir.gif" alt="" />imprimir</a></li>');
	document.write('<li class="opcion"><a href="/conozcacajastur/recomendar.html?urlinfo='+document.location+'&titulo='+document.title+'"><img src="/images/ico_recomendar.gif" alt=" " />recomendar página</a></li>');
	document.write('</ul>');
}

function imprimir() {
	document.getElementById('logo').style.display='none';
	document.getElementById('superior').style.display='none';
	document.getElementById('menu').style.display='none';
	
	document.getElementById('contenido').style.width='auto';
	document.getElementById('contenido').style.border='0';
	document.getElementById('contenido').style.margin='0 5%';
	document.getElementById('contenido').style.padding='0';

	self.print();
	
	document.getElementById('contenido').style.margin='0px 0px 0px 0px';
	document.getElementById('logo').style.display='block';
	document.getElementById('superior').style.display='block';
	document.getElementById('menu').style.display='block';
}

function cuadroopcionesrecomendar () {
	document.write('<ul class="cuadroopciones">');
	document.write('<li class="opcion"><a href="#" onclick="imprimir();return false" ><img src="/images/ico_imprimir.gif" alt=" " />imprimir</span></a></li>');
	document.write('<li class="opcion"><a href="/recomendar/?urlinfo='+document.location+'&titulo='+document.title+'"><img src="/images/ico_recomendar.gif" alt=" " />recomendar página</a></li>');
	document.write('<li class="opcion"><a href="#" onclick="favoritos(window.location,window.document.title);return false" ><img src="/images/ico_favoritos.gif" alt=" " />añadir a favoritos</span></a></li>');
	document.write('</ul>');
}

/* /CUADRO DE OPCIONES */

/* MENÚ INFERIOR */
function menuinferior () {
	document.write('<ul class="separa menuinferior">');
	document.write('<li><a href="/avisolegal/?titulo='+document.title+'">Aviso legal</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/tablonanuncios/?titulo='+document.title+'">Tablón de anuncios</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/politicaprivacidad/?titulo='+document.title+'">Política de Privacidad y Seguridad</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/conozcacajastur/infolegal/infolegal.html?titulo='+document.title+'">Información para inversores</a></li>');
	document.write('</ul>');
}
function menuinferiorcorto () {
	document.write('<ul class="separa menuinferior">');
	document.write('<li><a href="/avisolegal/?titulo='+document.title+'">Aviso legal</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/tablonanuncios/?titulo='+document.title+'">Tablón de anuncios</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/politicaprivacidad/?titulo='+document.title+'">Política de Privacidad y Seguridad</a><span class="barrasepara">|</span></li>');
	document.write('<li><a href="/conozcacajastur/infolegal/infolegal.html">Información para inversores</a></li>');
	document.write('</ul>');
}
/* /MENÚ INFERIOR */

/* TELÉFONOS */
function muestraDireccion(valor) {
	// Mostramos las paginas segun la opcion escogida 
	self.location.href='donde_telefonos_' + valor + '.html';				
}
/* /TELÉFONOS */

/* FUNCION ABRE COMBO EDIFICIOS */
function abrepagina(valor) {
	
	if(valor=="gijon"){
		
		self.location.href='/conozcacajastur/donde/donde_edificios_' + valor + '1.html';
	}else{
		
		self.location.href='/conozcacajastur/donde/donde_edificios_' + valor + '.html';
	     }
}
/* /FUNCION ABRE COMBO EDIFICIOS */

/* BORRA CAMPOS */
function borracampos () {
	document.getElementById('formusolicitud').reset();
}

/* /BORRA CAMPOS */


/* CONTADOR */
cont=0;

function inicializacont() {
	cont=0;
}
function aumentacont() {
	cont++;
}

/* /CONTADOR */

/* MUESTRACAPAS */
function muestracapas(valor) {
	// Encontramos un horario habitual 
	valormin=valor.toLowerCase();
	if (valormin.indexOf('habitual')!=-1) {
		document.getElementById('buena').innerHTML=document.getElementById('contenedora2').innerHTML;
	}
}
function muestradatos(valor) {
	// Según la opción que pulsen
	
	if (valor==1) 
	    document.getElementById('buena').innerHTML=document.getElementById('general').innerHTML;
	else if (valor==2)
		 document.getElementById('buena').innerHTML=document.getElementById('fiscalidad').innerHTML;	
	     else if(valor==3)
	     	    document.getElementById('buena').innerHTML=document.getElementById('seguros').innerHTML;
	     	  else if(valor==4)
	     	  	  document.getElementById('buena').innerHTML=document.getElementById('documentos').innerHTML;
	     	       else
	     	       	  document.getElementById('buena').innerHTML=document.getElementById('simulador').innerHTML;
}

function cierraoficina() {
	// Ocultar tablahorarios
	document.getElementById('tabla1').style.visibility='hidden';
	// Mostrar tablaagenda
	document.getElementById('tabla2').style.visibility='visible';				
}

function cierrahorarios() {
	document.getElementById('buena').innerHTML=document.getElementById('contenedora1').innerHTML;
}

/* /MUESTRACAPAS */


/* FAVORITOS */
function favoritos(direccion,descripcion){ 
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>3)){ 
		window.external.AddFavorite(direccion,descripcion); 
	} 
	else if((navigator.appName == "Netscape") || (navigator.appName == "Mozilla")) { 
		alert("Presione Crtl+D para agregar esta página a sus 'Favoritos'"); 
	} 
	else if(navigator.appName == "Opera") { 
		alert("Presione Crtl+Alt+B para agregar esta página a sus 'Favoritos'"); 
	} 
	else
		alert("Su navegador no dispone de esta opción"); 
} 
/* /FAVORITOS */



/* FECHA */
var pong;
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

// standard date display function with y2k compatibility

var this_month = new makeArray(12);
this_month[0]  = "enero";
this_month[1]  = "febrero";
this_month[2]  = "marzo";
this_month[3]  = "abril";
this_month[4]  = "Mayo";
this_month[5]  = "junio";
this_month[6]  = "julio";
this_month[7]  = "agosto";
this_month[8]  = "septiembre";
this_month[9]  = "octubre";
this_month[10] = "noviembre";
this_month[11] = "diciembre";

var this_day_e = new makeArray(7);
this_day_e[0]  = "domingo";
this_day_e[1]  = "lunes";
this_day_e[2]  = "martes";
this_day_e[3]  = "Miércoles";
this_day_e[4]  = "jueves";
this_day_e[5]  = "viernes";
this_day_e[6]  = "sábado";

var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = today.getYear();
var dia = today.getDay();
if (year < 1000) 
{
   year += 1900; 
}
  

function escribefecha() {
  return( " " + this_day_e[dia] + ", " + day + " de " + this_month[month] + " de " + year + " ");
}
function escribefechadoblea1() {
  return(" " + this_day_e[dia] + ", " + day + " ");
}
function escribefechadoblea2() {
  return(" " + this_month[month] + " ");
}
function escribefechadoblea3() {
  return(year);
}
/* /FECHA */



/* TELÉFONOS */
function muestraDireccion(valor) {
	// Mostramos las paginas segun la opcion escogida 
	self.location.href='donde_telefonos_' + valor + '.html';				
}
/* /TELÉFONOS */


// FUNCIONES DE MANEJO DEL ÁRBOL
var valores=new String();
divs=document.getElementsByTagName("DIV");

function Toggle(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   key=document.getElementById("x" + item);
   if (visible) {
     obj.style.display="none";
     key.innerHTML="<img src='/conozcacajastur/spv/images/closedfolder.gif' width='11' height='9' hspace='0' vspace='0' border='0'>";
   } else {
      obj.style.display="block";
      key.innerHTML="<img src='/conozcacajastur/spv/images/openfolder.gif' width='14' height='9' hspace='0' vspace='0' border='0'>";
   }
   
   valores='';
   for (i=0;i<divs.length;i++) {
   	  valores+=divs[i].style.display+"%";
   }  
   mandarGalleta("estadoarbol",valores,null);
}

function Expand() {
   for (i=0;i<divs.length;i++) {
   	if ( (divs[i].id != "")  && (divs[i].className=='arbol1') )
   	{
     divs[i].style.display="block";
     key=document.getElementById("x" + divs[i].id);
	 key.innerHTML="<img src='/conozcacajastur/spv/images/openfolder.gif' width='14' height='9' hspace='0' vspace='0' border='0'>";
	 valores+=divs[i].style.display+"%";
	}
   }
   mandarGalleta("estadoarbol",valores,null);
}

function Collapse() {
   for (i=0;i<divs.length;i++) {
   	if ( (divs[i].id != "")  && (divs[i].className=='arbol1') )
   	{
     divs[i].style.display="none";
     key=document.getElementById("x" + divs[i].id);
     key.innerHTML="<img src='/conozcacajastur/spv/images/closedfolder.gif' width='11' height='9' hspace='0' vspace='0' border='0'>";
	 valores+=divs[i].style.display+"%";
	}
   }
   mandarGalleta("estadoarbol",valores,null);
}

function buscarcookie() {
	var valores=consultarGalleta("estadoarbol");
	if (!valores)
		{}
	else {
		//código de inicio... para dejar algunos abiertos...
		var mat=valores.split('%');
		var cont=0;
		for (i=0;i<divs.length;i++) {
		   	if ( (divs[i].id != "")  && (divs[i].className=='arbol1') )
				if (mat[cont]=='block') {
					divs[i].style.display="block";
					key=document.getElementById("x" + divs[i].id);
					key.innerHTML="<img src='/conozcacajastur/spv/images/openfolder.gif' width='14' height='9' hspace='0' vspace='0' border='0' />";
				}
				else {
					divs[i].style.display="none";
					key=document.getElementById("x" + divs[i].id);
					key.innerHTML="<img src='/conozcacajastur/spv/images/closedfolder.gif' width='11' height='9' hspace='0' vspace='0' border='0' />";					
				}
				cont++;
		}			
	}

}
function mandarGalleta(nombre, valor, caducidad) {
  document.cookie = nombre + "=" + escape(valor) 
  + ((caducidad == null) ? "" : ("; expires=" + caducidad.toGMTString()))	
}

function consultarGalleta(nombre) {
  var buscamos = nombre + "=";
  if (document.cookie.length > 0) {
	i = document.cookie.indexOf(buscamos);
	if (i != -1) {
	  i += buscamos.length;
	  j = document.cookie.indexOf(";", i);
	  if (j == -1)
		j = document.cookie.length;
	  return unescape(document.cookie.substring(i,j));
	}
  }
}
/* /CONSTRUCCIÓN DEL ÁRBOL */



/* SCROLL TEXTO */

/**********************************************************************************   
ScrollText 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/
/************************************************************************************
Modificado por Carlos Revillo para aceptar también scroll horizontal
*************************************************************************************/
function iniciar() {
	cargado=1;
	scrolltextInit();
}
function lib_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()

var speed = 30

var loop, timer

function makeObj(obj,nest){
	
    nest=(!nest) ? "":'document.'+nest+'.'

	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	/************************************/
	this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;
	this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth;
	this.right=goRight;this.left=goLeft;
	/*************************************/
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object";
	
    eval(this.obj + "=this")
	
    return this
	
}

var px = bw.ns4||window.opera?"":"px";

function moveIt(x,y){
	
	this.x = x
	this.y = y
	this.css.left = this.x+px
	this.css.top = this.y+px
	
}

function goDown(move,obj){
	if (this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if (loop) setTimeout(this.obj+".down("+move+")",speed)
		//swapimg('arriba',arrows[3].src);
	}
	else {
	//swapimg('abajo',arrows[2].src);
	}
}
function goUp(move){

	if (this.y<0){
		this.moveIt(0,this.y-move)
			if (loop) setTimeout(this.obj+".up("+move+")",speed)
		//swapimg('abajo',arrows[4].src);
	}
	else {
	//swapimg('arriba',arrows[1].src);
	}
}

function goRight(move) {


	if (this.x>-this.scrollWidth+oCont2.clipWidth) {

		this.moveIt(this.x-move,0);
			if (loop) setTimeout(this.obj+".right("+move+")",speed);
	}
	
}

function goLeft(move) {
	if (this.x<0) {
		this.moveIt(this.x-move,0);
			if (loop) setTimeout(this.obj+".left("+move+")",speed);
	}
	
}
function scroll(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed>0) oScroll.down(speed)
		else oScroll.up(speed)
	}
}
function scrollado(speed) {
	if (scrolltextLoaded2){
		loop = true;
		if (speed>0) oScroll2.right(speed)
		else oScroll2.left(speed)
	}
}

function noScroll(){
	loop = false
	if (timer) clearTimeout(timer)
}

var scrolltextLoaded = false
function scrolltextInit(){

	oCont = new makeObj('divScrollTextCont')
	oScroll = new makeObj('divText','divScrollTextCont')
	oScroll.moveIt(0,0)

	oCont.css.visibility = "visible"
	scrolltextLoaded = true
}

var scrolltextLoaded2 = false
function scrolltextInit2(){
	oCont = new makeObj('divScrollTextCont');
	oCont2 = new makeObj('divScrollTextCont2');
	oScroll = new makeObj('divText','divScrollTextCont')
	oScroll2 = new makeObj('divText2','divScrollTextCont2')
	oScroll.moveIt(0,0)
	oScroll2.moveIt(0,0);
	oCont.css.visibility = "visible"
	oCont2.css.visibility = "visible"
	scrolltextLoaded = true
	scrolltextLoaded2 = true
}


//if (bw.bw) onload = scrolltextInit
/* /SCROLL TEXTO */


/*/AGENDA.BUSCADOR DE EVENTOS OSYC **********************************************************************/
function movercursor(e)
	{
		if (is.ie) {
			pointer.moveTo(event.clientX-250,event.clientY+12+document.body.scrollTop)
		}
			
		if (is.ns) {
			 pointer.moveTo(e.pageX-260,e.pageY+12);
		}
	}
function detectamov(texto)
	{
		if (cargado)
			{
				if (is.ns)
					{
						document.captureEvents(Event.MOUSEMOVE)
						document.onmousemove = movercursor;
					}
				else
				{ document.onmousemove=movercursor}
				pointer.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td></td><td bgcolor="#D0D5E8" ><table border="0" cellspacing="1" cellpadding="5" width="250"><tr><td nowrap bgcolor="#FFFFFF"  width="250"><font color="#244AA1">'+texto+' </font></td></tr></table></td></tr></table>');
				pointer.show();
			}
	}
function endMov()
{
	setInterval('',500);
}
function detectamovoff()
	{
		if (cargado)
			{
				pointer.hide();
				if (is.ns6) document.captureEvents(null)
				else 
				{
				document.onmousemove=endMov;
				}
			}
	}

function DynLayer(id,nestref,frame) {
	if (!DynLayer.set && !frame) DynLayerInit()
	this.frame = frame || self
	if (is.ns)
		{
			if (is.ns4)
				{
					if (!frame)
						{
							if (!nestref) var nestref = DynLayer.nestRefArray[id]
							if (!DynLayerTest(id,nestref)) return
							this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
						}
					else
						this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
					this.elm = this.event = this.css
					this.doc = this.css.document
					this.x = this.css.left
					this.y = this.css.top
					this.w = this.css.clip.width
					this.h = this.css.clip.height
				}
			else if (is.ns5)
				{
					this.elm = document.getElementById(id)
					this.css = this.elm.style
					this.doc = document
					var auxx=this.css.left;
					this.x = auxx.substring(0,auxx.indexOf('px'))
					var auxy=this.css.top;
					this.y = auxy.substring(0,auxy.indexOf('px'))
					this.w = this.elm.offsetWidth
					this.h = this.elm.offsetHeight
				}
		}
	else if (is.ie)
		{
			this.elm = this.event = this.frame.document.all[id]
			this.css = this.frame.document.all[id].style
			this.doc = document
			this.x = this.elm.offsetLeft
			this.y = this.elm.offsetTop
			this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
			this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
		}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DynLayer"
	eval(this.obj + "=this")
}

function DynLayerShow() {
	this.css.visibility = (is.ns4)? "show" : "visible"
}

function DynLayerHide() {
	this.css.visibility = (is.ns4)? "hide" : "hidden"
}

function DynLayerMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (is.ns) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (is.ns) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}

function DynLayerWrite(html)
	{
		if (is.ns4)
			{
				this.doc.open()
				this.doc.write(html)
				this.doc.close()
			}
		else if (is.ns5)
			{this.elm.innerHTML = html}
		else if (is.ie)
			{this.event.innerHTML = html}
	}

DynLayer.prototype.write = DynLayerWrite
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayerTest = new Function('return true')

function DynLayerInit(nestref) {
	if (!DynLayer.set) DynLayer.set = true
	if ((is.ns)&&(!is.ns5))
		{
			if (nestref)
				ref = eval('document.'+nestref+'.document')
			else
				{nestref = ''; ref = document;}

			for (var i=0; i<ref.layers.length; i++)
				{
					var divname = ref.layers[i].name
					DynLayer.nestRefArray[divname] = nestref
					var index = divname.indexOf("Div")
					if (index > 0)
						{eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')}
					if (ref.layers[i].document.layers.length > 0)
						{DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name}
				}
			if (DynLayer.refArray.i < DynLayer.refArray.length)
				{DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])}
		}
	else if (is.ie)
		{
			for (var i=0; i<document.all.tags("DIV").length; i++)
				{
					var divname = document.all.tags("DIV")[i].id
					var index = divname.indexOf("Div")
					if (index > 0)
						{eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')}
				}
		}
	else if (is.ns5)
		{
			for (var i=0; i<document.getElementsByTagName("DIV").length; i++)
				{
					var divname = document.getElementsByTagName("DIV")[i].id
					var index = divname.indexOf("Div")
					if (index > 0)
						{eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')}
				}
		}
	return true
}

DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ns6 = (this.b=="ns" && this.v==6)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
}
is = new BrowserCheck()

var hoy = new Date();
var a_meses=new Array('1|ene','2|feb','3|mar','4|abr','5|may','6|jun','7|jul','8|ago','9|sep','10|oct','11|nov','12|dic');
var a_anios=new Array('2001','2002','2003','2004','2005','2006','2007','2008','2009','2010');
var fecha=new Date();
var v_mes;
var v_anio;
function valortupla(tupla,campo){
	if (tupla.indexOf('|')!=-1){
		var matriz=tupla.split('|');
		return matriz[campo-1];
	}
	else	return tupla
}

function selecfechas(){
//mes	
	document.formu.mes.options.length=a_meses.length;
	for (i=0; i<a_meses.length; i++){
		document.formu.mes.options[i].value=valortupla(a_meses[i], 1);
		document.formu.mes.options[i].text=valortupla(a_meses[i], 2);
		if(valortupla(a_meses[i], 1)==v_mes)
			document.formu.mes.selectedIndex=i;
	}
	document.formu.anio.options.length=a_anios.length;
	for (i=0; i<a_anios.length; i++){
        	document.formu.anio.options[i].value=a_anios[i];
        	document.formu.anio.options[i].text=a_anios[i];
         	if(a_anios[i]==v_anio)
			document.formu.anio.selectedIndex=i;
	}
}
function arraymeses(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12){
	this[0]=m0;this[1]=m1;this[2]=m2;this[3]=m3;this[4]=m4;
	this[5]=m5;this[6]=m6;this[7]=m7;this[8]=m8;this[9]=m9;
	this[10]=m10;this[11]=m11;this[12]=m12;
}
var longitudesmeses = new arraymeses('',31,28,31,30,31,30,31,31,30,31,30,31);
if ((( hoy.getFullYear() % 4 == 0) && ( hoy.getFullYear() % 100 != 0)) || (hoy.getFullYear()% 400 == 0))
		longitudesmeses[2] = 29;
		
var NombMes=new Array('','enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre');

// Premios, Área musical, Otros
//var colores=new Array('7F9DD2','FDB006','318B00');

function calendario(mes,anio,vardia,arrayfecha,dactual,mactual,aactual)
	{
		
		ames=mes;
		aanyo=anio;
		var nfilas=6; //filas de cada mes
		var diasmes = longitudesmeses[mes]; //dias que tiene ese mes...
		var fecha = new Date();
		fecha.setDate(1);
		fecha.setMonth(mes-1);	
		fecha.setFullYear(anio);
		var diasemana = fecha.getDay();
		if (diasemana==0) diasemana=7;
		var cont = 1;	
		document.write('<tr>');
		//pìnto espacios antes del primer día
		for (i=1;i<=diasemana-1; i++)
			{document.write('<td align="right"  bgcolor="#ffffff"></td>');}
	
		//pinto primera fila de días
		for (i=diasemana;i<=7; i++) 
			{ 
				
				
				if (devuelvedia(mes,anio,cont,arrayfecha))
					{
						if(dactual==cont)
							{
								document.write('<td align="right"  bgcolor="#'+colores[0]+'"><div style="background-color:#'+colores[1]+';" ><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></div></td>');
							}
						
						else
						{
							document.write('<td align="right"  bgcolor="#'+colores[1]+'"><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></td>');}
					}
				else
					{
						if(dactual==cont)
							{document.write('<td align="right"  bgcolor="#'+colores[0]+'">'+cont+'</td>');}
						else
							{document.write('<td align="right"  bgcolor="#ffffff">'+cont+'</td>');}
					}
				cont++;
			}
		document.write('</tr>');
	
		//las demas filas
		for (j=2;j<=6;j++)
			{
				document.write('<tr>');
				for (h=1;h<=7;h++)
					{
						
						if (cont<=diasmes) 
							{
								if (devuelvedia(mes,anio,cont,arrayfecha))
									
									{
										if(dactual==cont)
											{
											
											document.write('<td align="right"  bgcolor="#'+colores[0]+'" ><div style="background-color:#'+colores[1]+';" ><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></div></td>');
											}
										else
										{document.write('<td align="right"  bgcolor="#'+colores[1]+'"><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></td>');}
									}
								else
								{
									if(dactual==cont)
										{document.write('<td align="right"  bgcolor="#'+colores[0]+'">'+cont+'</td>');}
									else
										{document.write('<td align="right"  bgcolor="#ffffff">'+cont+'</td>');}
								}
							}
						else
							{document.write('<td align="right"  bgcolor="#ffffff">&nbsp;</td>');}
						cont++;
					}
				document.write('</tr>');
			}
}

function calendario1(mes,anio,vardia,arrayfecha)
	{
		ames=mes;
		aanyo=anio;
		dia=vardia;
		var nfilas=6; //filas de cada mes
		var diasmes = longitudesmeses[mes]; //dias que tiene ese mes...
		var fecha = new Date();
		fecha.setDate(1);
		fecha.setMonth(mes-1);	
		fecha.setFullYear(anio);
		var diasemana = fecha.getDay();
		if (diasemana==0) diasemana=7;
		var cont = 1;
		presenta='<tr>';
		//pìnto espacios antes del primer día
		for (i=1;i<=diasemana-1; i++)
			{presenta+='<td align="right"  bgcolor="#ffffff">&nbsp;</td>';}
		
		//pinto primera fila de días
		for (i=diasemana;i<=7; i++) 
			{
				if (devuelvedia(mes,anio,cont,arrayfecha))
					{
						if((dia==cont)&& (eval(document.formu.mesactual.value)==mes)&& (eval(document.formu.anioactual.value)==anio))
							{
							presenta+=('<td align="right"  bgcolor="'+colores[0]+'"><div style="background-color:#'+colores[1]+';" ><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></div></td>');
							}
						else
						{presenta+=('<td align="right"  bgcolor="#'+colores[1]+'"><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></td>');}
					}
				else
					{
						if((dia==cont) && (eval(document.formu.mesactual.value)==mes)&& (eval(document.formu.anioactual.value)==anio))
							{presenta+=('<td align="right"  bgcolor="#'+colores[0]+'">'+cont+'</td>');}
						else
							{presenta+=('<td align="right"  bgcolor="#ffffff">'+cont+'</td>');}
					}
				cont++;
			}

		presenta+='</tr>';
		//las demas filas
		for (j=2;j<=6;j++)
			{
				presenta+='<tr>';
				for (h=1;h<=7;h++)
					{
						if (cont<=diasmes) 
							{
								if (devuelvedia(mes,anio,cont,arrayfecha))
									{
										if((dia==cont) && (eval(document.formu.mesactual.value)==mes)&& (eval(document.formu.anioactual.value)==anio))
											{
											presenta+=('<td align="right"  bgcolor="#'+colores[0]+'"><div style="background-color:#'+colores[1]+';" ><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></div></td>');
											}
										else
										{presenta+=('<td align="right"  bgcolor="#'+colores[1]+'"><a href="javaScript:cambiavalor('+cont+','+ames+','+aanyo+');" >'+cont+'</a></td>');}
									}
								else
								{
									if((dia==cont) && (eval(document.formu.mesactual.value)==mes)&& (eval(document.formu.anioactual.value)==anio))
										{presenta+=('<td align="right"  bgcolor="#'+colores[0]+'">'+cont+'</td>');}
									else
										{presenta+=('<td align="right"  bgcolor="#ffffff">'+cont+'</td>');}
								}
							}
						else
							{presenta+='<td align="right"  bgcolor="#ffffff">&nbsp; </td>';}
						cont++;
					}
				presenta+='</tr>';
			}
		return presenta;
	}

function devuelvedia(valormes,valoranio,valordia,arrayfecha)
{
  // recorro el array de fechas buscando si el dia actual está en el array de fechas q tienen actividad
  //primero formo la fecha en la que quiero buscar

  valoranio=valoranio.toString();
  valoranio=valoranio.substring(2,4);
  valormes=valormes.toString();
  valordia=valordia.toString();
  if (valormes.length==1)
    valormes='0'+valormes;
  if (valordia.length==1)
    valordia='0'+valordia;
   var encontrado=false;
  fechaactual=valordia+"/"+valormes+"/"+valoranio;
  for (var i=0;i<arrayfecha.length;i++)
    {
		if (fechaactual==arrayfecha[i])
		{
			encontrado=true;
		}
	}  
  return encontrado;
}



function fanterior()
{
  valor=document.formu.mes.value;
  if ((parseInt(document.formu.mesactual.value)) != (parseInt(valor)+1))
  {
	  if (valor=='01') 
		{
		  mesanterior='12';
		  document.formu.mes.value=mesanterior;
		  anioanterior=eval(document.formu.anio.value)-1;
		  document.formu.anio.value=anioanterior;
		 }
		else
		  {
			mesanterior=eval(document.formu.mes.value)-1;
			ma=mesanterior.toString();
			 if (ma.length == 1)
				document.formu.mes.value='0'+mesanterior;
			else
				document.formu.mes.value=mesanterior;
		  }
	  var me='<b>'+NombMes[eval(mesanterior)]+''+document.formu.anio.value+'</b></td>';
	  var ca='<table border="0" width="100%" cellpadding="2"  cellspacing="1">'+calendario1(eval(document.formu.mes.value), eval(document.formu.anio.value),eval(document.formu.diaactual.value))+'</table>';
	  if (is.ie4)
		 {
				document.all.meses.innerHTML=me;
				document.all.calendar.innerHTML=ca;
		 }
		else
		 {
			document.getElementById('meses').innerHTML=me;
			document.getElementById('calendar').innerHTML=ca;
		 }
	}
	
}
function siguiente()
{
  
  valor=document.formu.mes.value;
  if (valor=='12') 
    {
      mesanterior='01';
	  document.formu.mes.value=mesanterior;
	  anioanterior=eval(document.formu.anio.value)+1;
	  document.formu.anio.value=anioanterior;
	 }
	else
	  {
	    mesanterior=eval(document.formu.mes.value)+1;
		ma=mesanterior.toString();
		 if (ma.length == 1)
		    document.formu.mes.value='0'+mesanterior;
		else
			document.formu.mes.value=mesanterior;
	  }
  var me='<b>'+NombMes[eval(mesanterior)]+''+document.formu.anio.value+'</b></td>';
  var ca='<table border="0" width="100%" cellpadding="2"  cellspacing="1">'+calendario1(eval(document.formu.mes.value), eval(document.formu.anio.value),eval(document.formu.diaactual.value))+'</table>';
  if (is.ie4)
			 {
					document.all.meses.innerHTML=me;
					document.all.calendar.innerHTML=ca;
			 }
			else
			 {
			   	document.getElementById('meses').innerHTML=me;
				document.getElementById('calendar').innerHTML=ca;
			 }

}


/* FIN AGENDA BUSCADOR DE EVENTOS OSYC ****************************************************************/

/* combo para ver más noticias ****************************************************************/
function masnoticias () {
	document.write('<div style="clear:both;"><img src="../images/sizer.gif" width="1" height="15" alt="" /></div>');
	document.write('<div class="separador"><img src="/images/sizer.gif" alt="" width="1" height="1" /></div>');
	document.write('<div>');
	document.write('Seleccione para ver más noticias');
	document.write('<form name="formu" action="" method="" id="">');
	document.write('<select name="masnoticias">');
	document.write('<option value="">Doble A</option>|');
	document.write('<option value="">Jóvenes</option>|');
	document.write('<option value="">Conozcacajastur</option>|');
	document.write('<option value="">Obra Social y Cultural</option>');
	document.write('<option value="">Mercados</option>');
	document.write('</select>');
	document.write('</form>');
	document.write('</div>');
	document.write('<div style="clear:both;"><img src="../images/sizer.gif" width="1" height="15" alt="" /></div>');
}
/* //combo para ver más noticias ****************************************************************/

/******************** Insertar imagen del telefono de atencion 24 horas ************************/

function insertaImagen(tip) {
	document.write('<div class="telefono">');
	if ( (self.location.href.indexOf('/empresas/')!= -1) || (tip=='2')) {
		document.write('<abbr title="Teléfono de Atención al Cliente 24h"><span class="tel">902 105 005</span> <span class="nota">24h</span></abbr> | <abbr title="Teléfono de Atención a Empresas"><span class="tel">902 860 025</span> <span class="nota">empresas</span></abbr>');
	}else{
		document.write('<abbr title="Teléfono de Atención al Cliente 24h"><span class="tel">902 105 005</span> <span class="nota">24h</span></abbr>');
	}
	document.write('</div>');
} 

function insertaImagenBroker() {
	document.write('<div class="telefonoBroker">');
	document.write('<img src="/images/telefono.gif" alt="902 105 005 24h"/>');
	document.write('</div>');
}


