function getRefToDivNest( divID, oDoc ) {
if( !oDoc ) { oDoc = document; }
if( document.layers ) {
if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
y = getRefToDivNest(divID,oDoc.layers[x].document); }
return y; } }
if( document.getElementById ) { return document.getElementById(divID); }
if( document.all ) { return document.all[divID]; }
return document[divID];
}
function drawClock(h,m,s,f,oAmp,p,xOf,yOf,s2) {
window.clockCount = ( typeof( window.clockCount ) == 'number' ) ? window.clockCount + 1 : 0;
var oCol = [h,m,s];
for( var x = 1; x < 13; x++ ) {
if( document.layers ) {
document.write( '<layer id="c' + window.clockCount + 'num' + x + '" left="0" top="0"><font size="1" color="' + f + '">' + x + '</font></layer>' );
} else {
document.write( '<div id="c' + window.clockCount + 'num' + x + '" style="position:absolute;left:0px;top:0px;"><font size="1" color="' + f + '">' + x + '</font></div>' );
}
}
for( var y = 2; y >= 0; y-- ) { for( var x = 0; x < y + 3; x++ ) {
if( document.layers ) {
document.write( '<layer id="c' + window.clockCount + 'hand' + y + 'dot' + x + '" clip="0,0,2,2" left="0" top="0" bgcolor="' + oCol[y] + '"> </layer>' );
} else {
document.write( '<div id="c' + window.clockCount + 'hand' + y + 'dot' + x + '" style="position:absolute;left:0px;top:0px;height:2px;width:2px;background-color:' + oCol[y] + ';clip:rect(0px 2px 2px 0px)"></div>' );
}
} }
window.setInterval('aniClock(' + p + ',' + s2 + ',' + oAmp + ',' + xOf + ',' + yOf + ',' + window.clockCount + ')',100);
}
function aniClock(p,s,oAmp,xOf,yOf,c) {
if( !getRefToDivNest('c'+c+'hand2dot4') ) { return; }
var scrW = 0, scrH = 0, scrOfX = 0, scrOfY = 0;
if( typeof( window.innerWidth ) == 'number' ) { scrW = window.innerWidth; scrH = window.innerHeight; } else {
if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
scrW = document.documentElement.clientWidth; scrH = document.documentElement.clientHeight; } else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
scrW = document.body.clientWidth; scrH = document.body.clientHeight; } } }
if( typeof( window.pageYOffset ) == 'number' ) { scrOfY = pageYOffset; scrOfX = pageXOffset; } else {
if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else {
if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } }
}
var allXoffset = ( p % 2 ) ? oAmp + 10 + ( s ? scrOfX : 0 ) : ( scrW - ( oAmp + 10 ) ) + ( s ? scrOfX : 0 );
var allYoffset = ( p < 3 ) ? oAmp + 10 + ( s ? scrOfY : 0 ) : ( scrH - ( oAmp + 19 ) ) + ( s ? scrOfY : 0 );
var oPix = document.childNodes ? 'px' : 0;
for( var x = 1; x < 13; x++ ) {
var divRef = getRefToDivNest( 'c' + c + 'num' + x ); if( divRef.style ) { divRef = divRef.style; }
divRef.top = ( Math.round( -1 * oAmp * Math.cos( ( Math.PI * 2 * x ) / 12 ) ) + allYoffset + yOf - 6 ) + oPix;
divRef.left = ( Math.round( oAmp * Math.sin( ( Math.PI * 2 * x ) / 12 ) ) + allXoffset + xOf - ( ( x > 9 ) ? 4 : 1 ) ) + oPix;
}
var theTime = new Date(); theTime = [( theTime.getHours() % 12 ) / 12,theTime.getMinutes() / 60,theTime.getSeconds() / 60];
for( var y = 0; y < 3; y++ ) { for( var x = 0; x < y + 3; x++ ) {
var divRef = getRefToDivNest( 'c' + c + 'hand' + y + 'dot' + x ); if( divRef.style ) { divRef = divRef.style; }
divRef.top = ( Math.round( -1 * oAmp * ( x / 4 ) * Math.cos( Math.PI * 2 * theTime[y] ) ) + allYoffset + yOf ) + oPix;
divRef.left = ( Math.round( oAmp * ( x / 4 ) * Math.sin( Math.PI * 2 * theTime[y] ) ) + allXoffset + xOf ) + oPix;
} }
}