/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */





var timerID = null;          //Identidad del temporizador
var timerRunning = false;    //Flag para saber si el reloj esta activo

function stopTimer()
{        //Para el reloj
if(timerRunning)
	{
	clearTimeout(timerID);
	timerRunning = false;
	}
}

function startTimer()
	{     // Para el reloj, si esta activo y lo arranca.
	stopTimer();
	runClock();
	}

function runClock()
	{
	var Hora=timeNow();		// Solo para evitar hacer varias llamadas
//	var Dia=fechahoy();
	// Mostrar la hora en los elementos que se desee
//	window.document.getElementById("reloj").innerHTML= Dia + " " + Hora;
    window.document.getElementById("reloj").innerHTML= Hora;

	timerID = setTimeout("runClock()",1000);	//setTimeout() se llama a si mismo.
	timerRunning = true;
	}

function timeNow()
	{        //Toma la hora y la formatea
	now = new Date();
	hours = now.getUTCHours()+2;
	minutes = now.getUTCMinutes();
	seconds = now.getUTCSeconds();
	timeStr = ((hours < 10) ? "0" : "") + hours;
	timeStr += ((minutes < 10) ? ":0" : ":") + minutes;
	timeStr += ((seconds < 10) ? ":0" : ":") + seconds;
	return timeStr;
	}

function fechahoy()
	{

	var ahora;
	var fecha = new Date();
	var mes = fecha.getMonth() + 1;
	
	var num = fecha.getDate();
	var ano=fecha.getFullYear();
	ahora =   num + "/" +mes + "/" + ano;
	return ahora;
	}

















