var clock = 0;
function UpdateClock() {
   if(clock) {
      clearTimeout(clock);
      clock = 0;
   }
   document.getElementById('clock').innerHTML = GetTime();
   clock = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clock = setTimeout("UpdateClock()", 500);
}
function GetTime(){
   var dayarray=new Array("domingo","segunda-feira","ter&ccedil;a-feira","quarta-feira","quinta-feira","sexta-feira","s&aacute;bado")
   var montharray=new Array("janeiro","fevereiro","jar&ccedil;o","abril","maio","junho","julho","agosto","setembro","outrubro","novembro","dezembro")
   var tDate = new Date();
   day = ''+tDate.getDay();
   daym = ''+tDate.getDate();
   month = ''+tDate.getMonth();
   year = ''+tDate.getYear();
   if(year < 1000){ year = parseInt(year)+parseInt(1900); }
   hour = ''+tDate.getHours();
   minutes = ''+tDate.getMinutes();
   seconds = ''+tDate.getSeconds();
   if(hour.length == 1){ hour = '0'+hour; }
   if(minutes.length == 1){ minutes = '0'+minutes; }
   if(seconds.length == 1){ seconds = '0'+seconds; }
   var greeting="";
   if (hour>6 && hour<12) greeting="Bom dia ";
   else if(hour>=12 && hour<18) greeting="Boa tarde ";
   else greeting="Boa noite ";
   return ''+greeting+'Brasil e mundo! Hoje &eacute; '+dayarray[day]+', '+daym+' de '+montharray[month]+' de '+year+' 	&#64; '+hour+':'+minutes+':'+seconds+'';
}
function KillClock() {
   if(clock) {
      clearTimeout(clock);
      clock = 0;
   }
}