function M(a){return Math.floor(a)}function B(b,c,e){var f=d/2-d/10;a.ba(),a.arc(b,c,f,0,Math.PI*2,!1),a.ca(),a.s(),a.fillStyle=e,e!=""&&a.f()}function D(a,b,c,e){for(i=0;i<9;i++)B(b+(i%3+1)*d,c+(M(i/3)+1)*d,q[a].indexOf(i)!=-1?"#eee":"")}function R(b,c,d,e,f){a.ba(),a.m(b+f,c),a.l(b+d-f,c),a.qt(b+d,c,b+d,c+f),a.l(b+d,c+e-f),a.qt(b+d,c+e,b+d-f,c+e),a.l(b+f,c+e),a.qt(b,c+e,b,c+e-f),a.l(b,c+f),a.qt(b,c,b+f,c),a.ca(),a.f(),a.m(b,c+e/2),a.l(b+d,c+e/2),a.s()}function C(){a.ce(0,0,cw,ch);var b=new Date,c=b.getHours();c>12&&(c-=12);var e=b.getMinutes(),f=b.getSeconds(),g=[c,M(e/10),e%10,s1=M(f/10),f%10];for(j=0;j<5;j++){var h=M(g[j]/2),i=g[j]-h,k=j%5,l=k*4*d+Math.ceil(j/2)*d;j%2==1&&(B(l-d/2,3*d,"#DB2C18"),B(l-d/2,4.5*d,"#DB2C18")),a.strokeStyle="#777",a.fillStyle="#666",R(l+d/4,d/4,3.5*d,7*d,20),D(i,l,0),D(h,l,3.5*d)}}for(prop in a)a[prop[0]+(prop[6]||"")]=a[prop];var cw=b.offsetWidth;c.width=cw;var d=cw/22,ch=d*8;c.height=ch;var q=[[],[4],[0,8],[0,4,8],[0,2,6,8],[0,2,4,6,8],[0,2,3,5,6,8]];setInterval(C,1e3)
/* used the abbreviation loop of marijn.havebeke,
see http://marijn.haverbeke.nl/js1k.html for more context
initializing the variabled needed by the key-handlers on the side.
*/
for(prop in a)a[prop[0]+(prop[6]||'')]=a[prop];
var cw=b.offsetWidth;
c.width=cw;
var d=cw/22;
var ch=d*8;
c.height=ch;
//array containing dots to be filled for each value from 0-6
var q=[[],[4],[0,8],[0,4,8],[0,2,6,8],[0,2,4,6,8],[0,2,3,5,6,8]];
setInterval(C,1000);
//Function drawing the clock time
function C(){
a.ce(0,0,cw,ch);
var t=new Date();
var h=t.getHours();
if(h>12)h-=12;
var m=t.getMinutes();
var s=t.getSeconds();
var p=[h,M(m/10),m%10,s1=M(s/10),s%10];
for(j=0;j<5;j++){
var q=M(p[j]/2);
var r=p[j]-q;
var l = j%5;
var o = l*4*d + (Math.ceil(j/2)*d);
if((j%2==1)){
B(o-d/2, 3*d,"#DB2C18");
B(o-d/2, 4.5*d,"#DB2C18");
}
a.strokeStyle = "#777";
a.fillStyle = "#666";
R(o + d/4, d/4, 3.5*d, 7*d, 20);
D(r, o, 0);
D(q, o, 3.5*d);
}
}
//Draws the rounded corner domino rectangle
function R(x,y,w,h,r){
a.ba();
a.m(x+r,y);
a.l(x+w-r,y);
a.qt(x+w,y,x+w,y+r);
a.l(x+w,y+h-r);
a.qt(x+w,y+h,x+w-r,y+h);
a.l(x+r,y+h);
a.qt(x,y+h,x,y+h-r);
a.l(x,y+r);
a.qt(x,y,x+r,y);
a.ca();
a.f();
a.m(x,y+h/2);
a.l(x+w,y+h/2);
a.s();
}
//Draws the dots in the a domino part
function D(v,sv,sh,ed){
for(i=0;i<9;i++){
B((sv + (((i%3)+1)*d)),(sh + (((M(i/3))+1)*d)),(q[v].indexOf(i)!=-1)?"#eee":"");
}
}
//Draws a dot
function B(x,y,fs){
var r=(d/2)-(d/10);
a.ba();
a.arc(x, y, r, 0, Math.PI*2, false);
a.ca();
a.s();
a.fillStyle = fs;
if(fs!="")a.f();
}
//Put Math.floor in seperate function because used a lot
function M(v){return Math.floor(v)}