
var timerID = null;
var timerRunning = false;
function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function startclock () {
        // Make sure the clock is stopped
        stopclock();
        showtime();
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds();

        var date = now.getDate();
        var month = now.getMonth() + 1;
        var year = now.getYear();
        if (year < 1000)
         year+=1900
        
        var timeValue = "" + ((hours < 10 ) ? "0" : "") + hours
        // var timeValue = "" + ((hours >12) ? hours -12 :hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        // timeValue += (hours >= 12) ? " P.M." : " A.M."
        
        


         if (seconds == 0) {
        window.status = "Another minute closer to the Siriusware Seminar!";
        document.clock.face.value = "Another minute closer to the Siriusware Seminar!";
         }
        if (minutes == 0 && seconds == 0) {
        window.status = "One hour closer!";
        document.clock.face.value = "One hour closer!";
        
         }
        if (hours == 0 && minutes == 0 && seconds == 0) {
        window.status = "Midnight!";
        document.clock.face.value = "Midnight!";
         }

       else if (seconds > 0) {
        document.clock.face.value = timeValue + "  " + date + "/" +  month + "-" + year;        
        window.status = timeValue + "  Days remaining based on this time and date!     "  + date + "/" + month + "-" + year;
                       }
 
        nextXmas = new Date("May 30, 2009")
        nextXmas.setYear(year)
        msPerDay = 24 * 60 * 60 * 1000 ; // Number of milliseconds per day
        daysLeft = (nextXmas.getTime() - now.getTime()) / msPerDay;
        daysLeft = Math.round(daysLeft);
        document.Frame2.First.value =  daysLeft + " days";
        
        nextXmas = new Date("August 15, 2009")
        nextXmas.setYear(year)
        msPerDay = 24 * 60 * 60 * 1000 ; // Number of milliseconds per day
        daysLeft = (nextXmas.getTime() - now.getTime()) / msPerDay;
        daysLeft = Math.round(daysLeft);
        document.Frame3.Second.value = daysLeft + " days";
          
		nextXmas = new Date("August 31, 2009")
        nextXmas.setYear(year)
        msPerDay = 24 * 60 * 60 * 1000 ; // Number of milliseconds per day
        daysLeft = (nextXmas.getTime() - now.getTime()) / msPerDay;
        daysLeft = Math.round(daysLeft);
        document.Frame4.Third.value = daysLeft + " days"; 
		  
        timerID = setTimeout("showtime()",1000);

        timerRunning = true;
}

