var timerID = null;
var timerRunning = false;
fecha = new Date();

yearMonths = new Array()

yearMonths[0] = "Enero"
yearMonths[1] = "Febrero"
yearMonths[2] = "Marzo"
yearMonths[3] = "Abril"
yearMonths[4] = "Mayo"
yearMonths[5] = "Junio"
yearMonths[6] = "Julio"
yearMonths[7] = "Agosto"
yearMonths[8] = "Septiembre"
yearMonths[9] = "Octubre"
yearMonths[10] = "Noviembre"
yearMonths[11] = "Diciembre"

//Today is
function fechahoy() {

	dia = fecha.getDate()
	mes = fecha.getMonth()
	ano = fecha.getYear()

	mescad = yearMonths[mes]
	if (document.layers || ns6) ano += 1900

hoy = "<span class='lahora'>" + 'Hoy es&nbsp;' + dia + "&nbsp;de&nbsp;" + mescad + "&nbsp;de&nbsp;" + ano + "</span>"

if (ie) {
	fechaactual.innerHTML = hoy
	}
if (ns)
	{
	document.fechaactual.document.open()
	document.fechaactual.document.write(hoy)
	document.fechaactual.document.close()
	}
	if (ns6) {
		document.getElementById("fechaactual").innerHTML = hoy
	}
	
//Arrancar el reloj

startTimer()

}

function stopTimer()
{
      //stop the clock
   if(timerRunning)
	{
		clearTimeout(timerID);
		timerRunning = false;
	}

} 


function startTimer()
{
     // Stop the clock (in case it's running), then make it go.
    stopTimer();
    runClock();
}


function runClock()
{
	hora = new Date();
	hours = hora.getHours();
	minutes = hora.getMinutes();
	seconds = hora.getSeconds();
	diferen = 0;
	timeStr = "";

	timeStr  += (hours) + diferen;
	timeStr  += ((minutes < 10) ? ":0" : ":") + minutes;
	//timeStr  += ((seconds < 10) ? ":0" : ":") + seconds;

	if (ie) {
	 horaactual.innerHTML = "<span class='lahora'>Hora local&nbsp;" + timeStr + "</span>";
	}
	
	if (ns)		{
		document.horaactual.document.open()
		document.horaactual.document.write("<span class='lahora'>Hora local&nbsp;" + timeStr + "</span>")
		document.horaactual.document.close()
	}
	
	if (ns6) {
		document.getElementById("horaactual").innerHTML = "<span class='lahora'>Hora local&nbsp;" + timeStr + "</span>"
	}

	timerID = setTimeout("runClock()",60000);
	timerRunning = true;

}

function openCalendar(objFrm, elemName) {

	window.open('showCalendar.php?frmNew[objFrm]='+objFrm.name+'&frmNew[objElem]='+elemName+'&frmNew[date]='+objFrm.elements[elemName].value, 'libonCalend', 'width=165,height=130');

}

function setDayOpener(objFrm, elemName, curDate) {

	window.opener.document.forms[objFrm].elements[elemName].value=curDate;

}
