
  timerRunning=false;
  position=new Array();
  lastValue=new Array();
  digit=new Array();

  function setupClock()
   {
    for (var i=0;i<12;i++)
     {
      digit[i]=new Image(widthDigit, heightImg);
      digit[i].src=style+i+".gif";
     }
    digit[10].src=style+"am.gif";
    digit[11].src=style+"pm.gif";
    digit[12]=new Image(widthSemi,heightImg);
    digit[12].src=style+"c.gif";
    digit[13]=new Image(widthSemi,heightImg);
    digit[13].src=style+"b.gif";
    for (i=0;i<6;i++) lastValue[i]=0;
    lastValue[2]=12;

    var openImage="<IMG SRC=\""+style;
    var closeImage=".gif\" HEIGHT=21 WIDTH=16>";
    var nullImage=openImage+"0"+closeImage;
    document.write(nullImage+nullImage+openImage+"c.gif\" HEIGHT=21 WIDTH=9 NAME=\"SEMICOLON\">"+nullImage + nullImage + openImage + "am" + closeImage);
    start=startImg("SEMICOLON")-2;
    if(timerRunning)
     {
      clearTimeout(timerID);
      timerRunning = false
     };
    setClock();
   }

  function startImg(imgName)
   {
    for (var i=0;;i++) if (document.images[i].name==imgName) return i;
    return 100;
   }

  function setClock()
   {
    getDigit();
    for(var i=0;i<6;i++) if (position[i]!=lastValue[i]) document.images[start+i].src = digit[lastValue[i]=position[i]].src;
    timerID = setTimeout("setClock()",1000);
    timerRunning = true;
   }

  function getDigit()
   {
    var now=new Date();
    var hour=now.getHours();
    var min=now.getMinutes();
    position[5]=(hour>=12) ? 11 : 10;
    hour=(hour-1)%12+1;
    position[0]=Math.floor(hour/10);
    position[1]=hour%10;
    position[2]=(position[2]==12) ? 13 : 12;
    position[3]=Math.floor(min/10);
    position[4]=min%10;
   }


