////////////////////////////////////////////////////////////////////////////////
//                                MADE Clock
//
//  Version: 1.0
//  Author: Fábio Salles (fsalles@made.com.br)
//
////////////////////////////MADE//Internet//Services////////////////////////////

// Clock Constants
clockMonths = [ "Janeiro", "Fevereiro", "Mar&ccedil;o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" ] ;


// Control Variables
var clockTS = 0 ;
var clockArea = null ;

// Date functions

// Returns month's name
function getClockMonthName( month ) {
	return clockMonths[ month ] ;
}


// Starts the clock
function startClock( area, initialTS ) {
	clockTS = initialTS + 1000 ;
	clockArea = area ;
	setTimeout( 'tickClock()', 0 ) ;
}


// Runs the clock
function tickClock() {
	var dt = new Date( clockTS ) ;
	var now = "" ;

	now += ( dt.getDate() < 10 ? "0"+dt.getDate() : ""+dt.getDate() ) ;
	now += " de " ;
	now += getClockMonthName( dt.getMonth() ) ;
	now += " de " ;
	now += dt.getFullYear() ;
//	now += " | " ;
//	now += ( dt.getHours() < 10 ? "0"+dt.getHours() : ""+dt.getHours() ) ;
//	now += ":" ;
//	now += ( dt.getMinutes() < 10 ? "0"+dt.getMinutes() : ""+dt.getMinutes() ) ;
//	now += ":" ;
//	now += ( dt.getSeconds() < 10 ? "0"+dt.getSeconds() : ""+dt.getSeconds() ) ;
	
	clockArea.innerHTML = now ;
	
	clockTS += 1000 ;
	setTimeout( 'tickClock()', 1000 ) ;
}
