/**
 * Created by JetBrains PhpStorm.
 * User: mbakirov
 * Date: 19.08.11
 * Time: 13:10
 * To change this template use File | Settings | File Templates.
 */

$(document).ready(function(){
    clocks($('#clocks .date'), $('#clocks .time'));
    $("#clocks .preloader").fadeOut(200);
    setInterval("clocks($('#clocks .date'), $('#clocks .time'))",1000);
});

function clocks (datePlaceholder, timePlaceholder) {
    var date = new Date(),
        time_to_display = "",
        month = parseInt(date.getMonth())+1,
        month_stting = "",
        hours = parseInt(date.getHours()),
        minutes = parseInt(date.getMinutes()),
        seconds = parseInt(date.getSeconds());

    if(month < 10) month_stting = 0+month.toString(); else month_stting = month.toString();

    datePlaceholder.html(date.getDate()+"."+month_stting+"."+date.getFullYear());

    if(hours < 10) hours = 0+hours.toString(); else hours = hours.toString();
    if(minutes < 10) minutes = 0+minutes.toString(); else minutes = minutes.toString();
    if(seconds < 10) seconds = 0+seconds.toString(); else  seconds = seconds.toString();

    timePlaceholder.html(hours+":"+minutes+":"+seconds);
    //time_to_display = (hours+":"+minutes+":"+seconds).split('');

    /*$.each(time_to_display, function(key, value) {
        //if(value == ":") value = "s";
        timePlaceholder.children('div').eq(key).html(value);
    });*/
}

