summaryrefslogtreecommitdiffstats
path: root/include/game.js
blob: 862d8b60ba74f4558112b127892111e8d657fa67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* some code to highlight the current trick and to switch between different tricks */
/* which trick is currently highlighted*/
var current=0;

/* do the higlighting */
function hl(num) {
    if(document.getElementById){
	var i;
	for(i=0;i<14;i++){
	    if(document.getElementById("trick"+i))
		document.getElementById("trick"+i).style.display = 'none';
	}
	document.getElementById("trick"+num).style.display = 'block';
	current=num;
    }
}

/* highlight the last trick, useful when a page is called the first time*/
function high_last(){
    if(document.getElementById){
	var i;
	for(i=13;i>=0;i--) {
	    if(document.getElementById("trick"+i))
		{
		    hl(i);
		    current=i;
		    break;
		}
	}
    }
}

/* highlight the next trick */
function hl_next()
{
    if(document.getElementById("trick"+(current+1)))
	hl(current+1);
}

/* highlight the previous trick */
function hl_prev()
{
    if(document.getElementById("trick"+(current-1)))
	hl(current-1);
}