// Copyright (c) Katsushi Okada 2007.
function catimecalc() {
var now = new Date();
var pst = new Date(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate(),now.getUTCHours(),now.getUTCMinutes());
var dstbegin = new Date(now.getFullYear(),2,1,2), dstend = new Date(now.getFullYear(),10,1,2);
if (dstbegin.getDay())
dstbegin.setDate(15-dstbegin.getDay());
dstend.setDate(8-dstend.getDay());
if (pst >= dstbegin && pst <= dstend) 
pst.setHours(now.getUTCHours()-7);
else
pst.setHours(now.getUTCHours()-8);
var youbi = new Array("<span class='red'>日</span>","月","火","水","木","金","<span class='blue'>土</span>");
var theYY = pst.getFullYear(), theMM = pst.getMonth()+1, theDD = pst.getDate(), theHH = pst.getHours();
var ampm = "am";
if (theHH >= 12) {
   theHH = theHH - 12;
   ampm = "pm";
}
var theMN = pst.getMinutes();
if (theMN < 10)
   theMN = "0" + theMN;
var YB = youbi[pst.getDay()];
var pstmsg = "現在のカリフォルニア時間：　" + theYY + "年" + theMM + "月" + theDD + "日（" + YB + "）" + theHH + ":" + theMN + ampm;
document.getElementById("caltime").innerHTML = pstmsg;
}
function catime(kankaku) {
   catimecalc();
   setInterval("catimecalc()",kankaku);
}