function myMinsNum(x){ var mins=parseInt(document.forms["startup"].mins.value) if (x == 2){document.forms["startup"].mins.value = mins + 1} else{ if (x == 1){ if (mins == 1){document.forms["startup"].mins.value = 1} else{ if (mins < 6){document.forms["startup"].mins.value = mins -1} else {document.forms["startup"].mins.value = mins - 5} } } else{ if (mins == 1){document.forms["startup"].mins.value = 10} else{mins = mins + 10; document.forms["startup"].mins.value = mins} } } } function stopClock(){ if(document.forms["startup"].pause.value == "go") {document.forms["startup"].pause.value = "" window.clearTimeout(runme);} else {document.forms["startup"].pause.value = "go" myClock();} } function millis(ms){ secs = Math.floor(ms /1000) mins = Math.floor(secs / 60) secs = secs - (mins * 60) var hrs = 0 while (mins - 59 > 0){ hrs = hrs + 1; mins = mins - 60;} if (secs < 10){secs = "0" + secs} if (mins < 10){mins = "0" + mins} if (hrs < 10){hrs = "0" + hrs} return hrs + ":" + mins + ":" + secs; } function aMove(){ //handle start and end of game and restart after pause if(document.forms["startup"].pause.value == "x") {location='chm.htm'} if(document.forms["startup"].pause.value == "") {document.forms["startup"].pause.value = "go" myClock(); } else{ if (document.forms["startup"].move.value == 'White') {document.forms["startup"].move.value = 'Black';} else {document.forms["startup"].move.value = 'White';} } } function myClock(){ //don't need this - just for fun var Jetzt = new Date(); var Hrs = Jetzt.getHours(); var Mns = Jetzt.getMinutes(); var myTime = ((Mns < 10) ? ":0" : ":"); var Scs = Jetzt.getSeconds(); var mySecs = ((Scs < 10) ? ":0" : ":"); document.forms["startup"].myClockInp.value = Hrs + myTime + Mns + mySecs + Scs; //need this bit... - nothing to do with real time - it just counts the seconds. runme = window.setTimeout("myClock()", 500); if (document.forms["startup"].move.value == 'White') { document.forms["startup"].WStore.value = document.forms["startup"].WStore.value - 500 document.forms["startup"].Bmins.value = "" + millis(document.forms["startup"].BStore.value); document.forms["startup"].Wmins.value = "White: " + millis(document.forms["startup"].WStore.value); if (document.forms["startup"].WStore.value == 0) { document.forms["startup"].Wmins.value = "Time out. Black wins."; document.forms["startup"].pause.value = "x" window.clearTimeout(runme);} } else { document.forms["startup"].BStore.value = document.forms["startup"].BStore.value - 500 document.forms["startup"].Wmins.value = "" + millis(document.forms["startup"].WStore.value); document.forms["startup"].Bmins.value = "Black: " + millis(document.forms["startup"].BStore.value); if (document.forms["startup"].BStore.value == 0) { document.forms["startup"].Bmins.value = "Time out. White wins."; document.forms["startup"].pause.value = "x" window.clearTimeout(runme);} } } // * * * * * Cookies * * * * * function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString()); } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1 ; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)); } } return "" }