var cloneCanvas = function(self) { var c = document.createElement('canvas'); c.width = self.width; c.height = self.height; var cxt = c.getContext('2d'); cxt.drawImage(self,0,0); return c; }; function blitImage(ctx, image, sx ,sy, sw, sh, dx, dy, dw, dh) { var x; var y; for (x=0;x= 6 && hours <= 7) daytime = 1; if(hours >= 8 && hours <= 9) daytime = 2; if(hours >= 10 && hours <= 17) daytime = 3; if(hours >= 18 && hours <= 19) daytime = 4; if(hours >= 20 && hours <= 21) daytime = 5; if(hours >= 22 && hours <= 23) daytime = 6; if(hours >= 0 && hours <= 3) daytime = 7; if(hours >= 4 && hours <= 5) daytime = 8; return { servertime: servertime, days: parseInt((servertime+8000) / 24000), // Assuming it is day at 8:00 hours: hours, minutes: minutes, seconds: seconds, day: daytime, }; }