Mark the starting player until the game actually starts ;)
[e-DoKo.git] / js / 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     var i;
8     for(i=0;i<14;i++){  $("#trick"+i).hide(); }
9     $("#trick"+num).css('display', 'block');
10     current=num;
11 }
12
13 /* highlight the last trick, useful when a page is called the first time*/
14 function high_last(){
15     if(document.getElementById){
16         var i;
17         for(i=13;i>=0;i--) {
18             if(document.getElementById("trick"+i))
19                 {
20                     hl(i);
21                     current=i;
22                     break;
23                 }
24         }
25     }
26 }
27
28 /* highlight the next trick */
29 function hl_next()
30 {
31     if(document.getElementById("trick"+(current+1)))
32         hl(current+1);
33 }
34
35 /* highlight the previous trick */
36 function hl_prev()
37 {
38     if(document.getElementById("trick"+(current-1)))
39         hl(current-1);
40 }
41
42 $(document).ready(
43     function()
44     {
45         $("#ScoreTable").tablesorter({ widgets: ['zebra']});
46
47         $(".gameshidesession").click( function () {
48             $(this).parent().children(".gamessession").hide(300);
49             $(this).parent().children(".gamesshowsession").show();
50             $(this).hide();
51         });
52
53         $(".gamesshowsession").click( function () {
54             $(this).parent().children(".gamessession").show(300);
55             $(this).parent().children(".gameshidesession").show();
56             $(this).hide();
57         });
58
59         $(".gameshowall").click( function () {
60             $(".gamessession").show(300);
61             $(".gamesshowsession").hide();
62             $(".gameshidesession").show();
63         });
64         $(".gamehideall").click( function () {
65             $(".gamessession").hide(300);
66             $(".gamesshowsession").show();
67             $(".gameshidesession").hide();
68         });
69
70         $("ul.loginregister").click(function () {
71             $(".dologin").slideToggle();
72             $(".doregister").slideToggle();
73         });
74
75         $(".message div div").parent().click ( function() { $(this).hide(); });
76
77     });