// JavaScript Document
// Original:  Tomleung (lok_2000_tom@hotmail.com) This tag should not be removed
// Server time ticking clock v2.0 Updated by js-x.com
function MakeArrayday(size)
{
  this.length = size;
  for(var i = 1; i <= size; i++)
    this[i] = "";
  return this;
}
function MakeArraymonth(size)
{
  this.length = size;
  for(var i = 1; i <= size; i++)
    this[i] = "";
  return this;
}


var timer=null;
function sClock()
{
  /*hours=<?=date('H')?>;
  minutes=<?=date('i')?>;
  seconds=<?=date('s')?>;
	aushours=<?=date('H', strtotime("+4 hours 30 minutes"))?>;
  ausminutes=<?=date('i', strtotime("+4 hours 30 minutes"))?>;
  ausseconds=<?=date('s', strtotime("+4 hours 30 minutes"))?>;*/
  if(timer){clearInterval(timer);timer=null;}
  timer=setInterval("work();",1000);
}

function twoDigit(_v)
{
  if(_v<10)_v="0"+_v;
  return _v;
}

function work()
{
  if (!document.layers && !document.all && !document.getElementById) return;
  var runTime = new Date();
  var dn = "AM";
  var shours = hours;
  var sminutes = minutes;
  var sseconds = seconds;
  if (shours >= 12)
  {
    dn = "PM";
    shours-=12;
  }
  if (!shours) shours = 12;
  sminutes=twoDigit(sminutes);
  sseconds=twoDigit(sseconds);
  shours  =twoDigit(shours  );
  movingtime = ""+ shours + ":" + sminutes +":"+sseconds+"" + dn;
	//aus time
	if (!document.layers && !document.all && !document.getElementById) return;
  var runTime = new Date();
  var dn = "AM";
	var shours = aushours;
  var sminutes = ausminutes;
  var sseconds = ausseconds;
  if (shours >= 12)
  {
    dn = "PM";
    shours-=12;
  }
  if (!shours) shours = 12;
  sminutes=twoDigit(sminutes);
  sseconds=twoDigit(sseconds);
  shours  =twoDigit(shours  );
  aus_movingtime = ""+ shours + ":" + sminutes +":"+sseconds+"" + dn;	
	////////////////////////////
  if (document.getElementById)	{
//    document.getElementById("clock").innerHTML=movingtime;
		//document.getElementById("clocks").innerHTML=aus_movingtime;
	}	
  else if (document.layers)
  {
    document.layers.clock.document.open();
    document.layers.clock.document.write(movingtime);
    document.layers.clock.document.close();
		document.layers.clocks.document.open();
    document.layers.clocks.document.write(aus_movingtime);
    document.layers.clocks.document.close();
  }
  else if (document.all)	{
    clock.innerHTML = movingtime;
		clocks.innerHTML = aus_movingtime;
	}

  if(++seconds>59)
  {
    seconds=0;
    if(++minutes>59)
    {
      minutes=0;
      if(++hours>23)
      {
        hours=0;
      }
    }
  }
  if(++ausseconds>59)
  {
    ausseconds=0;
    if(++ausminutes>59)
    {
      ausminutes=0;
      if(++aushours>23)
      {
        aushours=0;
      }
    }
  }	
}
