// JavaScript Document
function mueveReloj(){ 
    momentoActual = new Date(); 
    hora = momentoActual.getHours(); 
    minuto = momentoActual.getMinutes(); 
    segundo = momentoActual.getSeconds();
	dia = (momentoActual.getDate() < 10 ? "0" + momentoActual.getDate() : momentoActual.getDate());
	diasem = momentoActual.getDay();
	var nomsem = new Array(
      'Domingo','Lunes','Martes',
      'Miércoles','Jueves','Viernes','Sábado');
	mes = momentoActual.getMonth();
	anio = momentoActual.getYear(); 
	
	var nommes = new Array( 
			"enero",
			"febrero",
			"marzo",
			"abril",
			"mayo",
			"junio",
			"julio",
			"agosto",
			"septiembre",
			"octubre",
			"noviembre",
			"diciembre");
	
	if( anio < 2000 )
		anio = eval(1900+anio);
		
    str_segundo = new String (segundo) 
    if (str_segundo.length == 1) 
       segundo = "0" + segundo; 

    str_minuto = new String (minuto) 
    if (str_minuto.length == 1) 
       minuto = "0" + minuto; 

    str_hora = new String (hora) 
    if (str_hora.length == 1) 
       hora = "0" + hora; 

    horaImprimible = hora + ":" + minuto + ":" + segundo; 
	diaImprimible = nomsem[diasem] + ", " + dia + " de " + nommes[mes] + " de " + anio;
	if( document.getElementById('horaspan') != null )
	    document.getElementById('horaspan').innerHTML = horaImprimible; 
	if( document.getElementById('diaspan') != null )
	    document.getElementById('diaspan').innerHTML = diaImprimible; 

    setTimeout("mueveReloj()",1000); 
} 