var q;
var Day = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var Month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

var netscape = 0, ie = 0;
if (parseInt(navigator.appVersion)>3)
{
  if (navigator.appName=="Netscape")
  { netscape = 1; }
  if (navigator.appName.indexOf("Microsoft")!=-1)
  { ie = 1; }
}

function Set_up(a,b,c,d)
{
  if (netscape)
  {
    q = document.getElementById(a);
    q.innerHTML = '<form action="" style="margin: 0px; padding: 0px; border-width: 0px;">\r<input id="test" type="text" readonly style="background-color: transparent; text-align: center; margin: 0px; padding: 0px; border-width: 0px;">\r';
    q.innerHTML+='<input id="test1" type="text" readonly style="background-color: transparent; text-align: center; margin: 0px; padding: 0px; border-width: 0px;">\r';
    q.innerHTML+='<input id="test2" type="text" readonly style="background-color: transparent; text-align: center; margin: 0px; padding: 0px; border-width: 0px;">\r</form>';
    q = [document.getElementById('test'),document.getElementById('test1'),document.getElementById('test2')];
    for (i = 0; i < 3; i++)
    {
      var e = q[i].style;
      e.fontFamily = b+", arial";
      e.color = c;
      e.fontSize = d;
    }
  }
  if (ie)
  {
    q = document.getElementById(a);
    var e = q.style;
    e.fontFamily = b+", arial";
    e.color = c;
    e.fontSize = d;
  }
  start();
}
function start()
{
  Run_Clock();
  setInterval("Run_Clock()",100);
}

function Run_Clock()
{
  if (netscape)
  {
    html = write_time();
    q[0].value = html[0];
    q[1].value = html[1];
    q[2].value = html[2];
  }
  if (ie)
  {
    html = write_time();
    var html1 = html[0] + "<br>" + html[1] + "<br>" + html[2];
    q.innerHTML = html1;
  }
}

function write_time()
{
  var text= new Array(3);
  var AM_PM;
  var temp = new Date();

  text[0] = Day[temp.getDay()];
  text[1] = temp.getDate() + " " + Month[temp.getMonth()] + " " + temp.getFullYear();
  if (temp.getHours()==0)
    { text[2] = "12:"; AM_PM = "A.M."}
  if (temp.getHours()>0 && temp.getHours()<12)
    { text[2] = temp.getHours()+":"; AM_PM = "A.M."}
  if (temp.getHours()==12)
    { text[2] = temp.getHours()+":"; AM_PM = "P.M."}
  if (temp.getHours()>12)
    { text[2] = temp.getHours()-12+":"; AM_PM = "P.M."}
  if (temp.getMinutes()<10)
    { text[2] += "0"+temp.getMinutes()+":"; }
  else
    { text[2] += temp.getMinutes()+":"; }
  if (temp.getSeconds()<10)
    { text[2] += "0"+temp.getSeconds()+" "+AM_PM; }
  else
    { text[2] += temp.getSeconds()+" "+AM_PM; }
  return [text[0],text[1],text[2]];
}
