// clock mode script

var iD = 0;

function updateClock() {
   if(iD) {
      clearTimeout(iD);
      iD  = 0;
   }

   var theDate = new Date();

   var hrs = theDate.getUTCHours().toString();
   var mins = theDate.getUTCMinutes().toString();
   var secs = theDate.getUTCSeconds()
   
   // detect secs
   var secs1 = secs.toString();
   secs1 = secs1.substring(0,1);
   var secs2;
   if(secs >= 10){
	   	secs2 = secs;
	   	secs2 = secs-(secs1*10);
   } else {
	   	secs1 = 0;
		secs2 = secs;
   }
   
   if(secs < 10){
   		document.getElementById('digit_5').src = "../images/timer_small_0.gif";
   		document.getElementById('digit_6').src = "../images/timer_small_"+secs2+".gif";
   } else {
   		document.getElementById('digit_5').src = "../images/timer_small_"+secs1+".gif";
   		document.getElementById('digit_6').src = "../images/timer_small_"+secs2+".gif";
   }
   
   
   // detect mins
   var mins1 = mins.toString();
   mins1 = mins1.substring(0,1);
   var mins2;
   if(mins >= 10){
	   	mins2 = mins;
	   	mins2 = mins-(mins1*10);
   } else {
	   	mins1 = 0;
		mins2 = mins;
   }
   
   if(mins < 10){
   		document.getElementById('digit_3').src = "../images/timer_0.gif";
   		document.getElementById('digit_4').src = "../images/timer_"+mins2+".gif";
   } else {
   		document.getElementById('digit_3').src = "../images/timer_"+mins1+".gif";
   		document.getElementById('digit_4').src = "../images/timer_"+mins2+".gif";
   }
   
   
   // detect hrs
   var hrs1 = hrs.toString();
   hrs1 = hrs1.substring(0,1);
   var hrs2;
   if(hrs >= 10){
	   	hrs2 = hrs;
	   	hrs2 = hrs-(hrs1*10);
   } else {
	   	hrs1 = 0;
		hrs2 = hrs;
   }
   
   if(hrs < 10){
   		document.getElementById('digit_1').src = "../images/timer_trans.gif";
   		document.getElementById('digit_2').src = "../images/timer_"+hrs2+".gif";
   } else {
   		document.getElementById('digit_1').src = "../images/timer_"+hrs1+".gif";
   		document.getElementById('digit_2').src = "../images/timer_"+hrs2+".gif";
   }
   
   // detect dots
   if(document.getElementById('dotState').value == 0){
   document.getElementById('dotState').value = 1;
   document.getElementById('digit_dots').src = "../images/timer_dots_trans.gif";
   } else {
   document.getElementById('dotState').value = 0;
   document.getElementById('digit_dots').src = "../images/timer_dots.gif";
   }
   
   iD = setTimeout("updateClock()", 500);
}
function startClock() {
   iD = setTimeout("updateClock()", 500);
}

function killClock() {
   if(iD) {
      clearTimeout(iD);
      iD  = 0;
   }
}

function selectButton(rand){
	window.location = "shooting_watch.php?mode=3&skin="+rand;
}

function startButton(rand){
	window.location = "shooting_watch.php?mode=3&skin="+rand;
}

function aButton(rand){
	window.location = "shooting_watch.php?mode=3&skin="+rand;
}

function bButton(rand){
	window.location = "shooting_watch.php?mode=1&skin="+rand;
}

function nullBtn() {
	alert("This button is not used in this mode");
}
//-->