/* -------------------------------------------------------
|                                                         |
|  Code by Andrea Scarso                                  |
|                                                         |
|  View details of the license                            |
|  http://creativecommons.org/licenses/by-nc-sa/1.0/      |
|                                                         |
------------------------------------------------------- */

var timerID = null;
var timerRunning = false;

function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}


function showtime () {
        var months = new Array(13);
        months[1]="Genn."; months[2]="Febb."; months[3]="Mar";
        months[4]="Apr"; months[5]="Mag"; months[6]="Giu";
        months[7]="Lug"; months[8]="Ago"; months[9]="Sett";
        months[10]="Ott"; months[11]="Nov"; months[12]="Dic";


        var time = new Date();
        var lmonth = months[time.getMonth() + 1];
        var date = time.getDate();
        var year = time.getYear();
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = (hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	if (year < 2000) year = year + 1900;
	document.clock.face.value = date + " " + lmonth + " " + year;
        document.clock.face2.value = timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}

function startclock () {
    stopclock();
    showtime();
}
