﻿var DifferenceHour = -1 
var DifferenceMinute = -1 
var DifferenceSecond = -1 
var Tday = new Date("November 06, 2010 23:59:59")  
var daysms = 24 * 60 * 60 * 1000 
var hoursms = 60 * 60 * 1000 
var Secondms = 60 * 1000 
var microsecond = 1000 

function clock_val(year,month,day,hours,minutes,seconds) 
{ 
var time = new Date() 
time.setFullYear(year)
time.setDate(day)
time.setMonth(month-1)
time.setHours(hours)
time.setMinutes(minutes)
time.setSeconds(seconds)
//time.setDate(day)
//alert(time.getDay());
var hour = time.getHours() 
var minute = time.getMinutes() 
var second = time.getSeconds() 
var timevalue = ""+((hour > 12) ? hour-12:hour) 
timevalue +=((minute < 10) ? ":0":":")+minute 
timevalue +=((second < 10) ? ":0":":")+second 
timevalue +=((hour >12 ) ? " PM":" AM") 
// document.formnow.now.value = timevalue 
var convertHour = DifferenceHour 
var convertMinute = DifferenceMinute 
var convertSecond = DifferenceSecond 
var Diffms = Tday.getTime() - time.getTime() 
DifferenceHour = Math.floor(Diffms / daysms) 
Diffms -= DifferenceHour * daysms 
DifferenceMinute = Math.floor(Diffms / hoursms) 
Diffms -= DifferenceMinute * hoursms 
DifferenceSecond = Math.floor(Diffms / Secondms) 
Diffms -= DifferenceSecond * Secondms 
var dSecs = Math.floor(Diffms / microsecond) 
if(convertHour != DifferenceHour) document.getElementById("day").innerHTML=DifferenceHour 
// document.formnow.Tnow.value= DifferenceHour DifferenceMinute + DifferenceSecond + dSecs 
time.setTime(time.getTime()+1) 
//var str ="clock_val(" + year + "," + month + "," + day + "," + hour + "," + minute + "," + second + ");";
month = time.getMonth()+1
var str ="clock_val(" + time.getFullYear() + "," + month + "," + time.getDate() + "," + time.getHours() + "," + time.getMinutes() + "," + time.getSeconds() + ");";
//alert(str);
setTimeout(str,1000) 
} 


function clock() 
{ 
var time = new Date() 
var hour = time.getHours() 
var minute = time.getMinutes() 
var second = time.getSeconds() 
var timevalue = ""+((hour > 12) ? hour-12:hour) 
timevalue +=((minute < 10) ? ":0":":")+minute 
timevalue +=((second < 10) ? ":0":":")+second 
timevalue +=((hour >12 ) ? " PM":" AM") 
// document.formnow.now.value = timevalue 
var convertHour = DifferenceHour 
var convertMinute = DifferenceMinute 
var convertSecond = DifferenceSecond 
var Diffms = Tday.getTime() - time.getTime() 
DifferenceHour = Math.floor(Diffms / daysms) 
Diffms -= DifferenceHour * daysms 
DifferenceMinute = Math.floor(Diffms / hoursms) 
Diffms -= DifferenceMinute * hoursms 
DifferenceSecond = Math.floor(Diffms / Secondms) 
Diffms -= DifferenceSecond * Secondms 
var dSecs = Math.floor(Diffms / microsecond) 
if(convertHour != DifferenceHour) document.getElementById("day").innerHTML=DifferenceHour 
// document.formnow.Tnow.value= DifferenceHour DifferenceMinute + DifferenceSecond + dSecs 
setTimeout("clock()",1000) 
} 
// end hiding --> 
function showtime()
{
today = new Date()
var hour = today.getHours() 
var minute = today.getMinutes() 
var second = today.getSeconds()
var todayday=today.getDay()
if (todayday == 0) todayday = "(星期日)";
if (todayday == 1) todayday = "(星期一)";
if (todayday == 2) todayday = "(星期二)";
if (todayday == 3) todayday = "(星期三)";
if (todayday == 4) todayday = "(星期四)";
if (todayday == 5) todayday = "(星期五)";
if (todayday == 6) todayday = "(星期六)";
 
var timevalue = ""+((hour > 12) ? hour-12:hour) 
timevalue +=((minute < 10) ? ":0":":")+minute 
timevalue +=((second < 10) ? ":0":":")+second 
timevalue +=((hour >12 ) ? " PM":" AM") 
document.getElementById("ALARM").innerHTML = (hour+":"+minute+":"+second).toLocaleString()
document.getElementById("date123").innerHTML = today.getFullYear() + "年" + (today.getMonth()+1) + "月" + today.getDate() + "日" +todayday
TimerID = setTimeout ("showtime()",1000)
}

function showtime2()
{
today = new Date()
var hour = today.getHours() 
var minute = today.getMinutes() 
var second = today.getSeconds()
var todayday=today.getDay()
if (todayday == 0) todayday = "(Sunday)";
if (todayday == 1) todayday = "(Monday)";
if (todayday == 2) todayday = "(Tuesday)";
if (todayday == 3) todayday = "(Wednesday)";
if (todayday == 4) todayday = "(Thursday)";
if (todayday == 5) todayday = "(Friday)";
if (todayday == 6) todayday = "(Saturday)";
 
var timevalue = ""+((hour > 12) ? hour-12:hour) 
timevalue +=((minute < 10) ? ":0":":")+minute 
timevalue +=((second < 10) ? ":0":":")+second 
timevalue +=((hour >12 ) ? " PM":" AM") 
document.getElementById("ALARM").innerHTML = (hour+":"+minute+":"+second).toLocaleString()
document.getElementById("date123").innerHTML = today.getFullYear() + "/" + (today.getMonth()+1) + "/" + today.getDate() + " " +todayday
TimerID = setTimeout ("showtime2()",1000)
}
//-->