window.CoolClock=function(d,b,e,a,c){return this.init(d,b,e,a,c)};CoolClock.findAndCreateClocks=function(){for(var c=document.getElementsByTagName("canvas"),b=0;b<c.length;b++){var a=c[b].className.split(" ")[0].split(":");a[0]=="CoolClock"&&new CoolClock(c[b].id,a[2],a[1],a[3]!="noSeconds",a[4])}};CoolClock.addLoadEvent=function(a){var b=window.onload;if(typeof window.onload!="function")window.onload=a;else window.onload=function(){b();a()}};CoolClock.config={clockTracker:{},tickDelay:1e3,longTickDelay:15000,defaultRadius:85,renderRadius:100,defaultSkin:"swissRail",skins:{swissRail:{outerBorder:{lineWidth:1,radius:95,color:"black",alpha:1},smallIndicator:{lineWidth:2,startAt:89,endAt:93,color:"black",alpha:1},largeIndicator:{lineWidth:4,startAt:80,endAt:93,color:"black",alpha:1},hourHand:{lineWidth:8,startAt:-15,endAt:50,color:"black",alpha:1},minuteHand:{lineWidth:7,startAt:-15,endAt:75,color:"black",alpha:1},secondHand:{lineWidth:1,startAt:-20,endAt:85,color:"red",alpha:1},secondDecoration:{lineWidth:1,startAt:70,radius:4,fillColor:"red",color:"red",alpha:1}},chunkySwiss:{outerBorder:{lineWidth:4,radius:97,color:"black",alpha:1},smallIndicator:{lineWidth:4,startAt:89,endAt:93,color:"black",alpha:1},largeIndicator:{lineWidth:8,startAt:80,endAt:93,color:"black",alpha:1},hourHand:{lineWidth:12,startAt:-15,endAt:60,color:"black",alpha:1},minuteHand:{lineWidth:10,startAt:-15,endAt:85,color:"black",alpha:1},secondHand:{lineWidth:4,startAt:-20,endAt:85,color:"red",alpha:1},secondDecoration:{lineWidth:2,startAt:70,radius:8,fillColor:"red",color:"red",alpha:1}},chunkySwissOnBlack:{outerBorder:{lineWidth:4,radius:97,color:"white",alpha:1},smallIndicator:{lineWidth:4,startAt:89,endAt:93,color:"white",alpha:1},largeIndicator:{lineWidth:8,startAt:80,endAt:93,color:"white",alpha:1},hourHand:{lineWidth:12,startAt:-15,endAt:60,color:"white",alpha:1},minuteHand:{lineWidth:10,startAt:-15,endAt:85,color:"white",alpha:1},secondHand:{lineWidth:4,startAt:-20,endAt:85,color:"red",alpha:1},secondDecoration:{lineWidth:2,startAt:70,radius:8,fillColor:"red",color:"red",alpha:1}}}};CoolClock.prototype={init:function(b,d,e,c,a){this.canvasId=b;this.displayRadius=d||CoolClock.config.defaultRadius;this.skinId=e||CoolClock.config.defaultSkin;this.showSecondHand=typeof c=="boolean"?c:true;this.tickDelay=CoolClock.config[this.showSecondHand?"tickDelay":"longTickDelay"];this.canvas=document.getElementById(b);this.canvas.setAttribute("width",this.displayRadius*2);this.canvas.setAttribute("height",this.displayRadius*2);this.canvas.style.width=this.displayRadius*2+"px";this.canvas.style.height=this.displayRadius*2+"px";this.renderRadius=CoolClock.config.renderRadius;this.scale=this.displayRadius/this.renderRadius;this.ctx=this.canvas.getContext("2d");this.ctx.scale(this.scale,this.scale);this.gmtOffset=a!=null?parseFloat(a):a;CoolClock.config.clockTracker[b]=this;this.tick();return this},fullCircle:function(a){this.fullCircleAt(this.renderRadius,this.renderRadius,a)},fullCircleAt:function(x,y,skin){with(this.ctx){save();globalAlpha=skin.alpha;lineWidth=skin.lineWidth;!document.all&&beginPath();if(document.all)lineWidth=lineWidth*this.scale;arc(x,y,skin.radius,0,2*Math.PI,false);document.all&&arc(x,y,skin.radius,-.1,.1,false);if(skin.fillColor){fillStyle=skin.fillColor;fill()}else{strokeStyle=skin.color;stroke()}restore()}},radialLineAtAngle:function(angleFraction,skin){with(this.ctx){save();translate(this.renderRadius,this.renderRadius);rotate(Math.PI*(2*angleFraction-.5));globalAlpha=skin.alpha;strokeStyle=skin.color;lineWidth=skin.lineWidth;if(document.all)lineWidth=lineWidth*this.scale;if(skin.radius)this.fullCircleAt(skin.startAt,0,skin);else{beginPath();moveTo(skin.startAt,0);lineTo(skin.endAt,0);stroke()}restore()}},render:function(e,d,c){var a=CoolClock.config.skins[this.skinId];this.ctx.clearRect(0,0,this.renderRadius*2,this.renderRadius*2);this.fullCircle(a.outerBorder);for(var b=0;b<60;b++)this.radialLineAtAngle(b/60,a[b%5?"smallIndicator":"largeIndicator"]);this.radialLineAtAngle((e+d/60)/12,a.hourHand);this.radialLineAtAngle((d+c/60)/60,a.minuteHand);if(this.showSecondHand){this.radialLineAtAngle(c/60,a.secondHand);!document.all&&this.radialLineAtAngle(c/60,a.secondDecoration)}},nextTick:function(){setTimeout("CoolClock.config.clockTracker['"+this.canvasId+"'].tick()",this.tickDelay)},stillHere:function(){return document.getElementById(this.canvasId)!=null},refreshDisplay:function(){var a=new Date;if(this.gmtOffset!=null){var b=new Date(a.valueOf()+this.gmtOffset*1e3*60*60);this.render(b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds())}else this.render(a.getHours(),a.getMinutes(),a.getSeconds())},tick:function(){if(this.stillHere()){this.refreshDisplay();this.nextTick()}}};CoolClock.addLoadEvent(CoolClock.findAndCreateClocks)