<!--
fCol='996600'; //face colour.
sCol='FF0000'; //seconds colour.
mCol='0000FF'; //minutes colour.
hCol='000000'; //hours colour.

Ybase=36; //Clock height.
Xbase=36; //Clock width.

H='...';
H=H.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
NS4=(document.layers);
NS6=(document.getElementById&&!document.all);
IE4=(document.all);

function displayClock(idClock){
	dots=12;
	Split=360/dots;
	if (NS6 || IE4){
		for (i=1; i < dots+1; i++){
		document.write('<div id="clockDigits'+idClock+i+'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:#'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
		}
		for (i=0; i < M.length; i++){
		document.write('<div id="clockY'+idClock+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+mCol+'"></div>');
		}
		for (i=0; i < H.length; i++){
		document.write('<div id="clockZ'+idClock+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+hCol+'"></div>');
		}
		for (i=0; i < S.length; i++){
		document.write('<div id="clockX'+idClock+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+sCol+'"></div>');
		}
		document.write('<div id="clockMSG'+idClock+'" style="position:absolute;top:0px;left:0px;width:80px;height:25px"></div>');
	}
	if (NS4){
		dgts='1 2 3 4 5 6 7 8 9 10 11 12';
		dgts=dgts.split(' ')
		for (i=0; i < dots; i++){
		document.write('<layer name=clockDigits'+idClock+i+' top=0 left=0 height=30 width=30><center><font face=Arial size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');
		}
		for (i=0; i < M.length; i++){
		document.write('<layer name=clockY'+idClock+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
		}
		for (i=0; i < H.length; i++){
		document.write('<layer name=clockZ'+idClock+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
		}
		for (i=0; i < S.length; i++){
		document.write('<layer name=clockX'+idClock+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
		}
		document.write('<layer name=clockMSG'+idClock+' top=0 left=0 height=80 width=25></layer>');
	}
}

function clock(idClock, descri, zone, dayl, Ypos, Xpos){
  time = new Date ();
  ofst=time.getTimezoneOffset()/60;
  secs = time.getSeconds();
  sec = -1.57 + Math.PI * secs/30;
  mins = time.getMinutes();
  min = -1.57 + Math.PI * mins/30;
  hr=(zone==0)?time.getHours():(time.getHours() + parseInt(ofst)) + parseInt(zone);
  
  // Day Ligth
  if (dayl==1) {
	  var gmt = new Date;var lsm = new Date;var lso = new Date;
	  lsm.setMonth(2);lsm.setDate(31); var day=lsm.getDay(); lsm.setDate(31-day);
	  lso.setMonth(9);lso.setDate(31); day=lso.getDay(); lso.setDate(31-day);
	  if (gmt>=lsm && gmt<=lso) hr=hr+1;
  }
  hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;

  if (hr < 0) hr+=24;
  if (hr > 23) hr-=24;
  ampm = (hr > 11)?"PM":"AM";
  statusampm = ampm.toLowerCase();
  hr2 = hr;
  if (hr2 == 0) hr2=12;
  (hr2 < 13)?hr2:hr2 %= 12;
  if (hr2<10) hr2="0"+hr2
  var finaltime=hr2+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;

  if (NS6 || IE4){
	/*if (NS6) {
		Ypos=window.pageYOffset+window.innerHeight-Ybase-25;
		Xpos=window.pageXOffset+window.innerWidth-Xbase-30;
	} else {
		Ypos=document.body.scrollTop+window.document.body.clientHeight-Ybase-20;
		Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20;
	}*/
	document.getElementById("clockMSG"+idClock).innerHTML="<center><font face=Arial size=2 color=#"+fCol+"><strong>"+descri+"</strong><br>"+idClock+"<br>"+finaltime+"</font></center>";
    for (i=1; i < dots+1; i++){
      document.getElementById("clockDigits"+idClock+i).style.top=Math.round(Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180))+"px";
      document.getElementById("clockDigits"+idClock+i).style.left=Math.round(Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180))+"px";
    }
	for (i=0; i < S.length; i++){
      document.getElementById("clockX"+idClock+i).style.top=Math.round(Ypos+i*Ybase/4.1*Math.sin(sec))+"px";
      document.getElementById("clockX"+idClock+i).style.left=Math.round(Xpos+i*Xbase/4.1*Math.cos(sec))+"px";
    }
    for (i=0; i < M.length; i++){
      document.getElementById("clockY"+idClock+i).style.top=Math.round(Ypos+i*Ybase/4.1*Math.sin(min))+"px";
      document.getElementById("clockY"+idClock+i).style.left=Math.round(Xpos+i*Xbase/4.1*Math.cos(min))+"px";
    }
    for (i=0; i < H.length; i++){
      document.getElementById("clockZ"+idClock+i).style.top=Math.round(Ypos+i*Ybase/4.1*Math.sin(hrs))+"px";
      document.getElementById("clockZ"+idClock+i).style.left=Math.round(Xpos+i*Xbase/4.1*Math.cos(hrs))+"px";
    }
	document.getElementById("clockMSG"+idClock).style.top=Math.round(Ypos+Ybase+10)+"px";
	document.getElementById("clockMSG"+idClock).style.left=Math.round(Xpos-Xbase-6)+"px";
  }
  if (NS4){
	/*Ypos=window.pageYOffset+window.innerHeight-Ybase-20;
	Xpos=window.pageXOffset+window.innerWidth-Xbase-30;	*/
	document.layers["clockMSG"+idClock].innerHTML="<center><font face=Arial size=2 color=#"+fCol+"><strong>"+descri+"</strong><br>"+idClock+"<br>"+finaltime+"</font></center>";
    for (i=0; i < dots; ++i){
      document.layers["clockDigits"+idClock+i].top=Math.round(Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180))+"px";
      document.layers["clockDigits"+idClock+i].left=Math.round(Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180))+"px";
    }
    for (i=0; i < S.length; i++){
      document.layers["clockX"+idClock+i].top=Math.round(Ypos+i*Ybase/4.1*Math.sin(sec))+"px";
      document.layers["clockX"+idClock+i].left=Math.round(Xpos+i*Xbase/4.1*Math.cos(sec))+"px";
    }
    for (i=0; i < M.length; i++){
      document.layers["clockY"+idClock+i].top=Ypos+i*Ybase/4.1*Math.sin(min)+"px";
      document.layers["clockY"+idClock+i].left=Xpos+i*Xbase/4.1*Math.cos(min)+"px";
    }
    for (i=0; i < H.length; i++){
      document.layers["clockZ"+idClock+i].top=Math.round(Ypos+i*Ybase/4.1*Math.sin(hrs))+"px";
      document.layers["clockZ"+idClock+i].left=Math.round(Xpos+i*Xbase/4.1*Math.cos(hrs))+"px";
    }
	document.layers["clockMSG"+idClock].top=Math.round(Ypos+Ybase+10)+"px";
	document.layers["clockMSG"+idClock].left=Math.round(Xpos-Xbase-6)+"px";
  }
}
//-->

