/*

Copyright (C) 2008  Anton Katsarov <anton@katsarov.org>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/

window.addEvent('domready', function(){
        var update_date = function () {
            var tDate = new Date();
            var hours = tDate.getHours();
            var minutes = tDate.getMinutes();
            var seconds = tDate.getSeconds();
            var calc = ((minutes*5)/60).toInt();
            $('hours').set('text',((hours%12)*5)+calc);
            $('minutes').set('text',":"+minutes);
            $('seconds').set('text',":"+seconds);
            $('seconds').set('styles',{
                    'background-position': '-' + seconds + '00px -200px'
                        });
            $('minutes').set('styles',{
                    'background-position': '-' + minutes + '00px -100px'
                        });
            $('hours').set('styles',{
                    'background-position': '-' + (((hours%12)*5)+calc) + '00px 0'
                        });
        };
        update_date();
        update_date.periodical(1000);

    });