//Esta captura de eventos anula la muestra de errores en la barra de status inferior de los navegadores
//provocada por las funciones imagen_on() e imagen_off(). (NOTA: además, anula la muestra de cualquier posible error)
//window.onerror = new Function("return true;");
//inicio RollOver
fechaReloj = true
function carga_imagenes() {			//Función PreCarga Imágenes
	// Repaso todas la imágenes del documento para precargar sus imágenes respectivas
	for (i = 0; i < document.images.length; ++i){
		// Si la imagen es de las que acaban en _on.gif o _off.gif, me interesa
		p = document.images [i].src.indexOf ("_off.gif")
		if (p == -1) p = document.images [i].src.indexOf ("_on.gif")
		if (p != -1) {
			nombre_raiz = document.images [i].src.substring (0, p)
			// Creo la imagen ON
			eval (document.images [i].name + "_on = new Image ()")
			eval (document.images [i].name + "_on.src = '" + nombre_raiz + "_on.gif'")
			// Creo la imagen OFF
			eval (document.images [i].name + "_off = new Image ()")
			eval (document.images [i].name + "_off.src = '" + nombre_raiz + "_off.gif'")
		}
	}
}

function imagen_on(name_imagen) {		//Función Cambia Imagen
	imagenOn = eval(name_imagen + "_on");
	// Comprueba que el objeto existe para evitar errores
	if (imagenOn.complete) document [name_imagen].src = imagenOn.src;		
}

function imagen_off(name_imagen) {		//Función Restaura Imagen
	imagenOff = eval(name_imagen + "_off");
	// Comprueba que el objeto existe para evitar errores
	if (imagenOff.complete) document [name_imagen].src = imagenOff.src;			
}

//Fin RollOver

//Inicio Reloj
function Reloj(bInicio){					//Función Reloj Actualizado

//	if (!bInicio || bInicio == null)
//		fechaReloj = new Date(fechaReloj.getFullYear(),fechaReloj.getMonth(),fechaReloj.getDate(),fechaReloj.getHours(),fechaReloj.getMinutes(),fechaReloj.getSeconds()+1)

	if (fechaReloj)
		fechaReloj = new Date()
		
	dia = fechaReloj.getDate();			// Separo dia, mes, año, horas, minutos y segundos.
	mes = (fechaReloj.getMonth()+1);
	anho = fechaReloj.getFullYear();
	hor	= fechaReloj.getHours();
	horItime = fechaReloj.getUTCHours();
	minu	= fechaReloj.getMinutes();
	seg = fechaReloj.getSeconds();	
	
	if(dia<10) {dia="0"+dia;}		// Doy formato a dia, mes, hora y minutos
	if(mes<10) {mes="0"+mes;}		// si son menores de 10 -> 01,02,etc.
	if(hor<10) {hor="0"+hor;}
	if(minu<10) {minu="0"+minu;}
				
	fecha = dia + "." + mes + "." + anho
	
	if (document.all){
		if ((seg % 2)==0){	
			hora = "<table width='160' border='0' cellspacing='0' cellpadding='0'><tr><td class='reloj' align='center'>"+fecha+"</td><td width='25' class='reloj'>&nbsp;</td><td class='reloj' align='right'>"+hor+"</td><td width='4' class='reloj'>:</td><td class='reloj'>"+minu+"</td></tr></table>";
   		}else{
			hora = "<table width='160' border='0' cellspacing='0' cellpadding='0'><tr><td class='reloj' align='center'>"+fecha+"</td><td width='25' class='reloj'>&nbsp;</td><td class='reloj' align='right'>"+hor+"</td><td width='4' class='reloj'>&nbsp;</td><td class='reloj'>"+minu+"</td></tr></table>";
   		}
	} else if (document.layers||document.getElementById){
		if ((seg % 2)==0){	
			hora = "<span class='reloj'>" + fecha + "<img src='../img/pix.gif' width='25' height='1' border='0'>" + hor + ":" + minu + "</span>"; //+ ":" + seg;//Junto y doy formato a la cadena
		}else{
			hora = "<span class='reloj'>" + fecha + "<img src='../img/pix.gif' width='25' height='1' border='0'>" + hor + "<img src='../img/pix.gif' width='3' height='1'>" + minu + "</span>";
		}
	}
			
	if (document.layers) {
		clockpos = document.ahoraNS;
		liveclock = clockpos.document.ahoraNS2;
		liveclock.document.write(hora);
		liveclock.document.close();
	} else if (document.all) {
		document.all.ahora.innerHTML = hora;
	} else if (document.getElementById) {
		document.getElementById("ahora").innerHTML = hora;
	}
	
	setTimeout('Reloj()',1000);			//Recargo cada segundo
}
//Fin Reloj

    function openWin(pagina, nombre, params) 
    { 
        /* abirir ventana */ 
        ventana = window.open (pagina, nombre, params); 
    } 
	
	
	
//IMPRIMIR CONTENIDO
function printer_version (encabezado)
{
    var id_zona= 'imprimible';

 	var pie='<div align="center"><br>Coordinación de la información: Centros Europeos de Empresas e Innovación de Castilla y León.<br>ceiva@jcyl.es<br>Telf: 983 54 80 15 / Fax: 983 54 80 57</div>';
		
  	if (!document.all) {
		window.print ()
		return
	}
	
	contenido = eval ("document.all." + id_zona + ".innerHTML")
	
	ventana = window.open ("", "_blank", "width=100,height=100")
	ventana.blur()
	ventana.moveTo (-200,-200)

	ventana.document.open ()
	ventana.document.write (encabezado)
	ventana.document.write (contenido)
	ventana.document.write (pie)
	ventana.document.close ()

	ventana.print ()
	ventana.close ()
}
//FIN IMPRIMIR CONTENIDO