﻿function LoadTime() {
    var Ora = new Date();

    /*var giornimancanti = 1;
    if (Ora.getMonth() == 8) {
        giornimancanti = 30 - Ora.getDate();
        giornimancanti = giornimancanti + 82;
    }
    if (Ora.getMonth() == 9) {
        giornimancanti = 31 - Ora.getDate();
        giornimancanti = giornimancanti + 51;
    }
    if (Ora.getMonth() == 10) {
        giornimancanti = 30 - Ora.getDate();
        giornimancanti = giornimancanti + 21;
    }
    if (Ora.getMonth() == 11) {
        giornimancanti = 21 - Ora.getDate();
    }*/

    /*var ore = (15 - Ora.getHours());
    var minutes = (45 - Ora.getMinutes());
    if (parseInt(minutes) < 0) {
        minutes == minutes+45;
        ore--;
    }
    var second = (59 - Ora.getSeconds());*/
    giornimancanti = document.getElementById("timer_day").innerHTML;
    ore = document.getElementById("timer_hour").innerHTML;
    minutes = document.getElementById("timer_minutes").innerHTML;
    second = document.getElementById("timer_seconds").innerHTML;

    second--;
    if (second <= 0) {
        second = 60;
        minutes--;
        if (minutes <= 0) {
            minutes = 60;
            ore--;
            if (ore <= 0)
                ore==24;
                {giornimancanti == 0;}
        }
    }
    
    document.getElementById("timer_day").innerHTML = giornimancanti;
    document.getElementById("timer_hour").innerHTML = ore;
    document.getElementById("timer_minutes").innerHTML = minutes;
    document.getElementById("timer_seconds").innerHTML = second;


    setTimeout("LoadTime()", 1000);
}

function load() {
}

function GUnload() {
}