//  Javascript Server-Seeded Clock (C)#year(now())# VelocityChicken Amalgamated LLC http://www.velocitychicken.com/
//  used with permission by WelcomeDriver LLC
//  variables for current time "hh" "mm" "ss" must be defined before this script is included!
var hh = (hh>12)?hh-12:hh;
var curTime=""; var timerID = null; var timerRunning = false; var isshown=true;

// Arrays to hold values for time
hrs = new Array(13); xmin = new Array(60); sec = new Array(60);
for (i=1; i<13; i++) {hrs[i]=(i<10)?"0"+i:i;}
for (i=0; i<60; i++) {xmin[i]=(i<10)?"0"+i:i; sec[i]=(i<10)?"0"+i:i;}

// function clears timer if running
function stopclock(){
  if(timerRunning) {clearTimeout(timerID); timerRunning = false;}
}

// function for onload command to start clock
function startclock(){
  stopclock(); showtime();
}

// function changes the content of the layer
function change_content(layername,content){
  document.rclock.footer.value = content;
}

// Adds a value of one each second
function showtime() {
  ss++;
  if(ss==60){ss=0; mm++;}
  if(mm==60){mm=0; hh++;}
  if(hh==13){hh=1;}
  if(hh==0){hh=1;}
  curTime=hrs[hh]+":"+xmin[mm]+":"+sec[ss]; change_content("clock",curTime); timerID = setTimeout("showtime()",1000); timerRunning=true;
}
//  End 
