CLEANUP: cleaned up some debug message and error checking
[e-DoKo.git] / include / game.js
1 /* some code to highlight the current trick and to switch between different tricks */
2 /* which trick is currently highlighted*/
3 var current=0;
4
5 /* do the higlighting */
6 function hl(num) {
7     if(document.getElementById){
8         var i;
9         for(i=0;i<14;i++){
10             if(document.getElementById("trick"+i))
11                 document.getElementById("trick"+i).style.display = 'none';
12         }
13         document.getElementById("trick"+num).style.display = 'block';
14         current=num;
15     }
16 }
17
18 /* highlight the last trick, useful when a page is called the first time*/
19 function high_last(){
20     if(document.getElementById){
21         var i;
22         for(i=13;i>=0;i--) {
23             if(document.getElementById("trick"+i))
24                 {
25                     hl(i);
26                     current=i;
27                     break;
28                 }
29         }
30     }
31 }
32
33 /* highlight the next trick */
34 function hl_next()
35 {
36     if(document.getElementById("trick"+(current+1)))
37         hl(current+1);
38 }
39
40 /* highlight the previous trick */
41 function hl_prev()
42 {
43     if(document.getElementById("trick"+(current-1)))
44         hl(current-1);
45 }