//  ShowTime - to show the actual time at call-time
//  ---------------------------------------------------------------------------

//  ---------------------------------------------------------------------------
function makeTime() {
//  var dayarray=new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Sonnabend");
//  var montharray=new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"); 

  var mydate=new Date();
  var year=mydate.getYear();

  if (year < 1000)
      year+=1900;

  var day=mydate.getDay();
  var month=mydate.getMonth();
  var daym=mydate.getDate();

  if (month < 10)
      month="0"+month;
  if (daym < 10)
      daym="0"+daym;

  var hours=mydate.getHours();
  var minutes=mydate.getMinutes();
  var seconds=mydate.getSeconds();

  if (hours < 10)
      hours="0"+hours;
  if (minutes < 10)
      minutes="0"+minutes;
  if (seconds < 10)
      seconds="0"+seconds;

  return (year+"-"+month+"-"+daym+" "+hours+":"+minutes);/**/
}

//  ---------------------------------------------------------------------------
function showTime() {
  document.getElementById("time").firstChild.nodeValue = makeTime ();
}

  var timer = null;

//  ---------------------------------------------------------------------------
function stopClock() {
  clearTimeout(timer);
}

//  ---------------------------------------------------------------------------
function startClock() { 
  var time = new Date();
  var hours = time.getHours();
  var minutes = time.getMinutes();
  minutes=((minutes < 10) ? "0" : "") + minutes;
  var seconds = time.getSeconds();
  seconds=((seconds < 10) ? "0" : "") + seconds;
  var clock = hours + ":" + minutes + ":" + seconds;
//  document.forms[0].display.value = clock;
  document.write (clock);/*
  timer = setTimeout("startClock()",1000);*/
}

//  ---------------------------------------------------------------------------
// Copyright (c) 1996 Tomer Shiran. All rights reserved. 
// Permission given to use this script provided that the copyright 
// notice remains as is. Additional scripts and information are  
// available at http://www.geocities.com/SiliconValley/9000/ 
// set initial values 
var timerRunning = false 
var timerID = null 
// create instance of Date object representing current time 
var initial = new Date() 
// start timer 

function start() {  
 // set the button's label to "stop"  
  document.forms[0].general.value = "stop"  
 // assign the stop function reference to the button's onClick event handler  
  document.forms[0].general.onclick = stop  
 // ask the user if to reset the timer  
  if (confirm("Would you like to reset the timer?"))   
 // set global variable to new time   
  initial = new Date()    
 // assign milliseconds since 1970 to global variable  
  startTime = initial.getTime()  
 // make sure the timer is stopped  
  stopTimer()  
 // run and display timer  
  showTimer() 
} 

// set button to initial settings 

function stop() {  
 // set the button's label to "start"  
  document.forms[0].general.value = "start"  
 // assign the start function reference to the button's onClick event handler  
  document.forms[0].general.onclick = start  
 // stop timer  
  stopTimer() 
} 
 // stop timer 

function stopTimer() {  
 // if the timer is currently running  
  if (timerRunning)   
 // clear the current timeout (stop the timer)   
  clearTimeout(timerID)  
 // assign false to global variable because timer is not running  
  timerRunning = false 
} 

function showTimer() {  
 // create instance of Date representing current timer  
  var current = new Date()  
 // assign milliseconds since 1970 to local variable  
  var curTime = current.getTime()  
 // assign difference in milliseconds since timer was cleared  
  var dif = curTime - startTime   
 // assign difference in seconds to local variable  
  var result = dif / 1000  
 // is result is not positive  
  if (result < 1)   
 // attach an initial "0" to beginning   
  result = "0" + result   
 // convert result to string  
  result = result.toString()  
 // if result is integer  
  if (result.indexOf(".") == -1)   
 // attach ".00" to end   
  result += ".00"  
 // is result contains only one digit after decimal point  
  if (result.length - result.indexOf(".") <= 2)   
 // add a second digit after point   
  result += "0"  
 // place result in text field  
  document.forms[0].display.value = result  
 // call function recursively immediately (must use setTimeout to avoid overflow)  
  timerID = setTimeout("showTimer()", 0)  
 // timer is currently running  
  timerRunning = true 
} 