

// World Clock (No DST, standard time only!)  http://www.btinternet.com/~kurt.grigg/javascript

if (document.getElementById){

fCol='#D63741'; //face/number colour.
dCol='#E6484D'; //dot colour.
hCol='#E6484D'; //hours colour.
mCol='#E6484D'; //minutes colour.
sCol='#E6484D'; //seconds colour.
cCol='#E6484D'; //date colour.


//Alter nothing below! Alignments will be lost!
y=document.body.scrollTop+window.document.body.clientHeight-250;
x=document.body.scrollLeft+window.document.body.clientWidth-240;
h=4;
m=5;
s=6;
cf=new Array();
cd=new Array();
ch=new Array();
cm=new Array();
cs=new Array();
face="3 4 5 6 7 8 9 10 11 12 1 2";
face=face.split(" ");
n=face.length;
e=360/n;
hDims=210/4;
zone=0;
isItLocal=true;
ampm="";
daysInMonth=31;
todaysDate="";
var oddMinutes;
var getOddMinutes;
var addOddMinutes;
plusMinus=false;


for (i=0; i < n; i++){
 document.write('<div id="theFace'+i+'" class="facestyle" style="color:'+fCol+'">'+face[i]+'<\/div>');
 cf[i]=document.getElementById("theFace"+i).style;
 cf[i].top=y-60+240*1.4*Math.sin(i*e*Math.PI/180)+"px";
 cf[i].left=x-20+240*1.4*Math.cos(i*e*Math.PI/180)+"px";
}

for (i=0; i < h; i++){
 document.write('<div id="H'+i+'" class="handsanddotsstyle"><img src="../bilder/punkt.gif"><\/div>');
 ch[i]=document.getElementById("H"+i).style;
}
for (i=0; i < m; i++){
 document.write('<div id="M'+i+'" class="handsanddotsstyle"><img src="../bilder/punkt.gif"><\/div>');
 cm[i]=document.getElementById("M"+i).style;
}
for (i=0; i < s; i++){
 document.write('<div id="S'+i+'" class="handsanddotsstyle"><img src="../bilder/punkt.gif"><\/div>');
 cs[i]=document.getElementById("S"+i).style;
}


function ClockAndAssign(){
y=document.body.scrollTop+window.document.body.clientHeight-250;
x=document.body.scrollLeft+window.document.body.clientWidth-240;

hourAdjust=0;
dayAdjust=0;
monthAdjust=0;
now=new Date();
ofst=now.getTimezoneOffset()/60;
secs=now.getSeconds();
sec=Math.PI*(secs-15)/30;
mins=now.getMinutes();
if (oddMinutes){
 mins=eval(mins+addOddMinutes);
}
min=Math.PI*(mins-15)/30;
if (mins<0){
 mins+=60;hourAdjust=-1;
}
if (mins>59){
 mins-=60;hourAdjust=1;
}
hr=(isItLocal)?now.getHours()+hourAdjust:(now.getHours()+parseInt(ofst))+parseInt(zone)+hourAdjust;
hrs=Math.PI*(hr-3)/6+Math.PI*parseInt(now.getMinutes())/360;
if (hr<0){
 hr+=24;
 dayAdjust=-1;
}
if (hr>23){
 hr-=24;
 dayAdjust=1;
}
day=now.getDate()+dayAdjust;
if (day<1){
 day+=daysInMonth;
 monthAdjust=-1;
}
if (day>daysInMonth){
 day-=daysInMonth;
 monthAdjust=1;
}
month=parseInt(now.getMonth()+1+monthAdjust);
if (month==2){
 daysInMonth=28;
}
year=now.getYear();
if (year<2000){
 year=year+1900;
}
leap_year=(eval(year%4)==0)?true:false;
if (leap_year&&month==2){
 daysInMonth=29;
}
if (month<1){
 month+=12;
 year--;
}
if (month>12){
 month-=12;
 year++;
}
todaysDate=day+" "+month+" "+year;


for (i=0;i<s;i++){
 cs[i].top=y+(i*hDims)*Math.sin(sec)+"px";
 cs[i].left=x+(i*hDims)*Math.cos(sec)+"px";
}
for (i=0;i<m;i++){
 cm[i].top=y+(i*hDims)*Math.sin(min)+"px";
 cm[i].left=x+(i*hDims)*Math.cos(min)+"px";
}
for (i=0;i<h;i++){
 ch[i].top=y+(i*hDims)*Math.sin(hrs)+"px";
 ch[i].left=x+(i*hDims)*Math.cos(hrs)+"px";
}
for (i=0; i < n; i++){
 cf[i]=document.getElementById("theFace"+i).style;
 cf[i].top=y-50+240*1.4*Math.sin(i*e*Math.PI/180)+"px";
 cf[i].left=x-20+240*1.4*Math.cos(i*e*Math.PI/180)+"px";
}

setTimeout('ClockAndAssign()',100);
}
window.onload=ClockAndAssign;
}

