/* 
tWatch Timer v1.0 (Control Script).
(c) 2010 EMSA. All rights reserved.

Learn, inspire, but do not copy please. If you want to use something, 
ask me first. I'll help and advice. Thank you! ;)

rhiordian(at)gmail(dot)com
*/
var cas=1200;var ctime=cas;var t;var twatch;function tWatch(){var mins=Math.floor(cas/60);var secs=cas%60;if(secs<10)secs='0'+secs;if(mins<10)mins='0'+mins;if(secs==0)secs='00';if(mins==0)mins='00';var d1s=mins+'';var d2s=mins+'';var d3s=secs+'';var d4s=secs+'';d1s=d1s.substr(0,1);d2s=d2s.substr(1,1);d3s=d3s.substr(0,1);d4s=d4s.substr(1,1);if(d4s=="0")$("#rs1, #rs2, #rs3, #rs4, #rs5, #rs6, #rs7, #rs8, #rs9").fadeOut(300);$("#twd1_0, #twd1_1, #twd1_2, #twd1_3, #twd1_4, #twd1_5, #twd1_6, #twd1_7, #twd1_8, #twd1_9, #twd2_0, #twd2_1, #twd2_2, #twd2_3, #twd2_4, #twd2_5, #twd2_6, #twd2_7, #twd2_8, #twd2_9, #twd3_0, #twd3_1, #twd3_2, #twd3_3, #twd3_4, #twd3_5, #twd3_6, #twd3_7, #twd3_8, #twd3_9, #twd4_0, #twd4_1, #twd4_2, #twd4_3, #twd4_4, #twd4_5, #twd4_6, #twd4_7, #twd4_8, #twd4_9").hide();$("#twd1_"+d1s).show();$("#twd2_"+d2s).show();$("#twd3_"+d3s).show();$("#twd4_"+d4s).show();$("#rs"+d4s).fadeIn(500);var barG=document.getElementById('gBar');var barO=document.getElementById('oBar');var barR=document.getElementById('rBar');var boardG=document.getElementById('gBoard');var boardO=document.getElementById('oBoard');var boardR=document.getElementById('rBoard');var haloG=document.getElementById('gHalo');var haloO=document.getElementById('oHalo');var haloR=document.getElementById('rHalo');barG.style.width=cas/5+"px";barO.style.width=cas/5+"px";barR.style.width=cas/5+"px";if(cas>=34){haloG.style.left=cas/5-20+"px";haloO.style.left=cas/5-20+"px";haloR.style.left=cas/5-20+"px"}if(cas==ctime){$("#gBoard, #gBar, #gHalo").show();setTimeout("$('#objC_twatch').animate({top: '-5px'}, {easing: 'easeOutCirc'},200); $('#nav_timePanel, #objC_timeBoard').animate({top: '5px'}, {easing: 'easeOutCirc'},200); $('#objC_progressBar').animate({top: '15px'}, {easing: 'easeOutCirc'},200);",200);setTimeout("$('#objC_twatch').animate({top: '-110px'}, 800); playSnd('snd_clock');",400);setTimeout("$('#objC_twatch').animate({top: '-5px'},800);",4400);if(isIE()){$("#trLightO").hide();$("#trLightG").show()}else{$("#trLightO").fadeOut(500);$("#trLightG").fadeIn(500)}}if(cas==(ctime/2)+1){playSnd('snd_clock');if(isIE()){$("#gBoard, #gBar, #gHalo").hide();$("#oBoard, #oBar, #oHalo").show();$("#trLightG").hide();$("#trLightO").show()}else{$("#gBoard, #gBar, #gHalo").fadeOut(500);$("#oBoard, #oBar, #oHalo").fadeIn(500);$("#trLightG").fadeOut(500);$("#trLightO").fadeIn(500)}$("#objC_twatch").animate({top:'-110px'},800);setTimeout("$('#objC_twatch').animate({top: '-5px'},800);",4000)}if(cas==(ctime/4)+1){playSnd('snd_clock');if(isIE()){$("#oBoard, #oBar, #oHalo").hide();$("#rBoard, #rBar, #rHalo").show();$("#trLightO").hide();$("#trLightR").show()}else{$("#oBoard, #oBar, #oHalo").fadeOut(500);$("#rBoard, #rBar, #rHalo").fadeIn(500);$("#trLightO").fadeOut(500);$("#trLightR").fadeIn(500)}$("#objC_twatch").animate({top:'-110px'},800);setTimeout("$('#objC_twatch').animate({top: '-5px'},800);",4000)}if(cas==(ctime/20)+1){$("#objC_twatch").animate({top:'-110px'},800);$("#nav_timePanel").hide()}if(cas<=(ctime/20)+1)playSnd('snd_second');cas=cas-1;if(cas<0){stopSnd('snd_second');clearTimeout(twatch);document.testform.submit()}else twatch=setTimeout("tWatch()",1000)}function startTime(){var today=new Date();var h=today.getHours();var m=today.getMinutes();var s=today.getSeconds();m=checkTime(m);s=checkTime(s);document.getElementById('showTime').innerHTML=h+":"+m+":"+s;t=setTimeout('startTime()',500)}function checkTime(i){if(i<10){i="0"+i}return i}
