if (isNS4){
	//document.write('<img src="images/header_fondo.gif" height="105" border="0">');

	document.write('<img src="images/header_fondo.gif" height="105" border="0"><layer class="clock" name="clockContainer" pageX="275" pageY="85" width="300" height="150"></layer>');
/*	clockLayer = new Layer(300);
	clockLayer.name = 'clockContainer';
	clockLayer.id = 'clockContainer';
	clockLayer.pageX = 275;
	clockLayer.pageY = 85;
	clockLayer.height = 150

	clockLayer.document.write('');
	clockLayer.document.close();*/
}
if (isIE4 || isDOM) document.write('<div class="clock"  id="clockContainer"></div>');

function writeTime(lang) {
	var enDays = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var spDays = new Array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');

	var enMonths = new Array('January','February','March','April','May','June','July','August','September','October','November','December')
	var spMonths = new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre')

	var today = new Date();
	var hours = today.getHours();
	var minutes = today.getMinutes();
	var seconds = today.getSeconds();
	var ampm;

	if (lang=='en')
		ampm = ((hours>11) ? 'pm' : 'am');
	else
		ampm = ((hours>11) ? 'p.m.' : 'a.m.');
	hours = ((hours<1) ? 12 : hours);
	hours = ((hours>12) ? hours-12 : hours);
	minutes = paddNumber(minutes);
	seconds = paddNumber(seconds);
	var the_time = hours + ':' + minutes + ':' + seconds + ' ' + ampm;

	var weekday = eval(lang+'Days['+today.getDay()+']');
	var day = today.getDate();
	var month = eval(lang+'Months['+today.getMonth()+']');
	var year = today.getFullYear();
	if (screen.width>800){
		if (lang=='en')
			var the_date = weekday + ' ' + month + ' ' + day + ', ' + year;
		else
			var the_date = weekday + ' ' + day + ' de ' + month + ', ' + year;
	}else{
		if (lang=='en')
			var the_date = month + ' ' + day + ', ' + year;
		else
			var the_date = day + '/' + month.substr(0,3) + '/' + year;
	}

	if (isNS4){
		document.layers['clockContainer'].document.write('<span class="clock">'+the_time+'<br>'+the_date+'</span>');
		document.layers['clockContainer'].document.close();
	}
	if (isDOM) document.getElementById('clockContainer').innerHTML = the_time+'<br>'+the_date;
	if (isIE4) document.all['clockContainer'].innerHTML = the_time+'<br>'+the_date;

	// run this function again in half a second
	the_timeout= setTimeout('writeTime("'+lang+'");',500);
}

function paddNumber(number) {
	if ( parseInt(number)<10 ) {
		number = '0' + number;
	}
	return number;
}
