//-----------------------------------------------
//	LSRS.ro
//	Copyright (c) 2008 - 2009 LSRS
//	
//	This code is the property of LSRS
//	Do not copy, distribute, or modify this code. 
//	Un-licensed use of this code is prohibited.
//-----------------------------------------------

// Server Time Clock
var stH;
var stM;
var stS;
var stT=null;
function sClock()
{
  if(stT){clearInterval(stT);stT=null;}
  stT=setInterval("work();",1000);
}

function twoDigit(_v)
{
  if(_v<10)_v="0"+_v;
  return _v;
}

function work()
{
  var runTime = new Date();
  var dn = "AM";
  var sstH = stH;
  var sstM = stM;
  var sstS = stS;
  if (sstH >= 12)
  {
    dn = "PM";
    sstH-=12;
  }
  if (!sstH) sstH = 12;
  sstM=twoDigit(sstM);
  sstS=twoDigit(sstS);
  sstH=twoDigit(sstH);
  movingtime = ""+ sstH + ":" + sstM +":"+sstS+" " + dn;
  var o = document.getElementById("clock");
  if(!o)
  	return;
  o.innerHTML='' + movingtime;

  if(++stS>59)
  {
    stS=0;
    if(++stM>59)
    {
      stM=0;
      if(++stH>23)
      {
        stH=0;
      }
    }
  }
}
// end of Server Time Clock

