﻿var clock = new Class({	
    options: 
	{	
	},  
    initialize:function(options)
    {
        this.setOptions(options);                                                       
		if (this.options.initialize) 
		{
		    this.options.initialize.call(this);
		}
		this.update.periodical(1000,this);
				                
    },
    update:function()
    {    
        var now = new Date()
        var day = now.getDate()
        var month = now.getMonth() + 1;
        var year = now.getFullYear()        
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds();

        if (month < 10)
        {
            month = "0" + month;
        }        
        if (day < 10)
        {
            day = "0" + day;
        } 
        if (hours < 10)
        {
            hours = "0" + hours;
        }         
        if (minutes < 10)
        {
            minutes = "0" + minutes;
        }        
        if (seconds < 10)
        {
            seconds = "0" + seconds;
        }        

        this.options.clock.setHTML(year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds);
    }    
       
});
clock.implement(new Options);  

