/**
 * Koreos Date
 *
 * @author smanu85
 * @version 1.0
 * @package koreos
 */

function KoreosClock(_parent) {

    //var $ = jQuery;
    var _class = this;
    var _el = $("#clock_date").find(".cont");
    var _months = ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"];
    var _dateInterval;
    var _delay = 60000;

    /**
     * Constructor
     */
    (function() {
        date();
        _dateInterval = setInterval(date, _delay);
    })();

    /**
     * Print current date
     */
    function date() {  
        var myDate = new Date();
        var hours = myDate.getHours();
        var mins = myDate.getMinutes();
        if (hours < 10) {
            hours = "0"+hours;
        }
        if (mins < 10) {
            mins = "0"+mins;
        }
        var output = '<div class="date">'+myDate.getDate()+' '+_months[myDate.getMonth()]+' '+myDate.getFullYear()+'</div><div class="clock">'+hours+':'+mins+'</div';
        _el.html(output);
    }

}; // end of Class
