﻿
var osd = "      << ...  "
osd += "Benvenuto in AnnunciNoStop ";
osd += "Qui' puoi inserire un tuo Annuncio e Ripubblicarlo quando e quanto vuoi. ";
osd += "Buona Navigazione";
osd +=    " ... >> ";
var timer;
var msg = "";
function scrollMaster() {
    msg = customDateSpring(new Date())
    clearTimeout(timer)
    msg += " " + showtime() + " " + osd
   for (var i = 0; i < 10; i++) {
        msg = " " + msg;
    }
    scrollMe()
}
function scrollMe() {
    
    window.status = msg;
    msg = msg.substring(1, msg.length) + msg.substring(0, 1);
    timer = setTimeout("scrollMe()", 200);
}
function showtime() {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var months = now.getMonth();
    var dates = now.getDate();
    var years = now.getYear();
    var timeValue = ""
    timeValue += ((months > 9) ? "" : " ")
    timeValue += ((dates > 9) ? "" : " ")
    timeValue = (months + 1)
    timeValue += "/" + dates
    timeValue += "/" + years
    var ap = "A.M."
    if (hours == 12) {
        ap = "P.M."
    }
    if (hours == 0) {
        hours = 12
    }
    if (hours >= 13) {
        hours -= 12;
        ap = "P.M."
    }
    var timeValue2 = " " + hours
    timeValue2 += ((minutes < 10) ? ":0" : ":") + minutes + " " + ap
    return timeValue2;
}
function MakeArray(n) {
    this.length = n
    return this
}
monthNames = new MakeArray(12)
monthNames[1] = "Gen."
monthNames[2] = "Feb."
monthNames[3] = "Mar."
monthNames[4] = "Apr."
monthNames[5] = "Mag."
monthNames[6] = "Giu."
monthNames[7] = "Lug."
monthNames[8] = "Ago."
monthNames[9] = "Set."
monthNames[10] = "Ott."
monthNames[11] = "Nov."
monthNames[12] = "Dic."
daysNames = new MakeArray(7)
daysNames[1] = "Domenica"
daysNames[2] = "Lunedi'"
daysNames[3] = "Martedi'"
daysNames[4] = "Mercoledi'"
daysNames[5] = "Giovedi'"
daysNames[6] = "Venerdi'"
daysNames[7] = "Sabato"
function customDateSpring(oneDate) {
    var theDay = daysNames[oneDate.getDay() + 1]
    var theDate = oneDate.getDate()
    var theMonth = monthNames[oneDate.getMonth() + 1]
    
    return theDay + ", " + theMonth + " " + theDate + ","
}
scrollMaster();