﻿/*
Uhr-Script (c) 2006 by BACAL software.
*/

var hours;
var minutes;
var seconds;
var Digital;
var dn;
var clockMessage;
var colophon1=":";
var trigger1=true;
var colophon2=":";
var trigger2=true;
var anima=0;

function whatTime()
{
whatHours();
whatMinutes();
whatSeconds();
}

function whatHours()
{
   return hours=Digital.getHours();
}

function whatMinutes()
{
   return minutes=Digital.getMinutes();
}

function whatSeconds()
{
   return seconds=Digital.getSeconds();
}

function showTime(){
 if (!document.layers&&!document.all&&!document.getElementById)
 {
    return;
 }
Digital=new Date();
whatTime();

setMode(false);
myclock="<font size='5' face='Arial' ><b><font size='1'>"+clockMessage+"</font></br>"+hours+getColophon1()+minutes+getColophon2()+seconds+" "+dn+"</b></font>";
if (document.layers){
document.layers.digiuhr.document.write(myclock);
document.layers.digiuhr.document.close();
}
else if (document.all) {
digiuhr.innerHTML=myclock;
}
else if (document.getElementById) {
document.getElementById("digiuhr").innerHTML=myclock;
}
setTimeout("showTime()",1000);
}
function setMode(mode)
{
   if(mode)
   {
      clockMessage="Current Time";
      if (hours>12) {
            dn="PM";
            hours=hours-12;
         }
         else {
            dn="AM";
         }
         if (hours==0) {
            hours=12;
         }
      }
      else {
         if(anima>3)
         {
            anima=0;
         }
         switch(anima)
         {
         case 0:
         dn="\u25E4";
         anima++;
         break;
         case 1:
         dn="\u25E5";
         anima++;
         break;
         case 2:
         dn="\u25E2";
         anima++;
         break;
         case 3:
         dn="\u25E3";
         anima++;
         break;
      }
      if(hours<9)
      {
         hours="0"+hours;
      }
         clockMessage="Aktuelle Zeit";
      }
      if (minutes<=9) {
         minutes="0"+minutes;
      }
         if (seconds<=9) {
         seconds="0"+seconds;
      }
}

function getColophon1()
{
   if(trigger1)
   {
      trigger1=false;
      colophon1=" ";
   } else {
      trigger1=true;
      colophon1=":";
   }
   return colophon1;
}

function getColophon2()
{
   if(trigger2)
   {
      trigger2=false;
      colophon2=" ";
   } else {
      trigger2=true;
      colophon2=":";
   }
   return colophon2;
}