
var dtMyTime=null;var dtStartThreshold=null;var dtStartTime=null;var dtStopThreshold=null;var dtStopTime=null;var clockTarget=null;function formatDate(dt){var weekday=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var tOut=weekday[dt.getDay()]+" ";var h=dt.getHours();var m=dt.getMinutes();var s=dt.getSeconds();if(h===0){am="AM";h=12;}else if(h<12){am="AM";}else if(h==12){am="PM";}else{am="PM";h=h-12;}
if(m<10){m="0"+m;}
if(s<10){s="0"+s;}
tOut+=h+":"+m+":"+s+" "+am;return tOut;}
function updateTime(){var dtDisplay=null;dtMyTime.setTime(dtMyTime.getTime()+1000);if(dtMyTime.getTime()<dtStartThreshold){dtDisplay=dtStartTime;}else if(dtMyTime.getTime()>=dtStartThreshold&&dtMyTime.getTime()<=dtStopThreshold){dtDisplay=new Date(dtMyTime.getTime()+2*60*60*1000);}else{dtDisplay=dtStopTime;}
var el=document.getElementById(clockTarget);if(el){el.innerHTML=formatDate(dtDisplay);}
setTimeout(updateTime,1000);}
function clockInit(CurrentTime,StartThreshold,StartTime,StopThreshold,StopTime,target){dtMyTime=new Date(Date.parse(CurrentTime));dtStartThreshold=Date.parse(StartThreshold);dtStartTime=new Date(Date.parse(StartTime));dtStopThreshold=Date.parse(StopThreshold);dtStopTime=new Date(Date.parse(StopTime));clockTarget=target;updateTime();}