first step of the preferences management
[brisk.git] / web / room.js
1 /*
2  *  brisk - room.js
3  *
4  *  Copyright (C) 2006-2012 Matteo Nastasi
5  *                          mailto: nastasi@alternativeoutput.it 
6  *                                  matteo.nastasi@milug.org
7  *                          web: http://www.alternativeoutput.it
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details. You should have received a
18  * copy of the GNU General Public License along with this program; if
19  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
20  * Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23
24
25 /* 
26    data = [ [ flags, name ],  ... ]
27    
28 */
29
30 var l_list_all = 0x00;
31 var l_list_auth = 0x01;
32 var l_list_isol = 0x02;
33
34 function state_add(flags)
35 {
36     var content = "", supercont = "";
37     var st, superst, name = "", supername = "", supersfx = "";
38     var tit = "", supertit = "";
39
40
41     if ((flags & 0xf00) != 0) {
42         st = flags & 0xf00;
43         // MLANG 4,12,16,20,24,28
44         switch (st) {
45         case 0x100:
46             name = "st_pau.png";
47             tit = (g_lang == 'en' ? "I'm doing a break" : "sono in pausa");
48             break;
49         case 0x200:
50             name = "st_out.png";
51             tit = (g_lang == 'en' ? "I'm away" : "sono fuori");
52             break;
53         case 0x300:
54             name = "st_dog.png";
55             tit = (g_lang == 'en' ? "Dog time" : "sono a spasso col cane");
56             break;
57         case 0x400:
58             name = "st_eat.png";
59             tit = (g_lang == 'en' ? "I'm eating" : "sto mangiando");
60             break;
61         case 0x500:
62             name = "st_wrk.png";
63             tit = (g_lang == 'en' ? "I'm working" : "sono a lavoro");
64             break;
65         case 0x600:
66             name = "st_smk.png";
67             tit = (g_lang == 'en' ? "I'm smoking a sigarett (and keeping a cancer)" : "sto fumando una sigaretta (e facendomi venire il cancro)");
68             break;
69         case 0x700:
70             name = "st_eye.png";
71             tit = (g_lang == 'en' ? "I'm here!" : "sono presente!");
72             break;
73         case 0x800:
74             name = "st_rabbit.png";
75             tit = (g_lang == 'en' ? "Rabbit time" : "sono a spasso col coniglio");
76             break;
77         case 0x900:
78             name = "st_soccer.png";
79             tit = (g_lang == 'en' ? "Soccer time" : "c'è la partita!!");
80             break;
81         case 0xa00:
82             name = "st_baby.png";
83             tit = (g_lang == 'en' ? "Children time" : "ho il pupo da accudire");
84             break;
85         case 0xb00:
86             name = "st_mop.png";
87             tit = (g_lang == 'en' ? "Mop time" : "sto rassettando");
88             break;
89         case 0xc00:
90             name = "st_babbo.png";
91             tit = (g_lang == 'en' ? "Sto dando i regali" : "sto dando i regali");
92             break;
93         case 0xd00:
94             name = "st_renna.png";
95             tit = (g_lang == 'en' ? "in giro per regali" : "in giro per regali");
96             break;
97         case 0xe00:
98             name = "st_pupaz.png";
99             tit = (g_lang == 'en' ? "Neve a gogò" : "neve a gogò");
100             break;
101         case 0xf00:
102             name = "st_visch.png";
103             tit = (g_lang == 'en' ? "aspettando sotto al vischio" : "aspettando sotto al vischio");
104             break;
105         default:
106             break;
107         }
108     }
109
110     if ((flags & 0xf0000) != 0) {
111         superst = flags & 0xf0000;
112         if (name != "") {
113             supersfx = "_side";                
114         }
115
116         switch (superst) {
117         case 0x20000:
118             supername = "superuser"+supersfx+".png";
119             supertit = (g_lang == 'en' ? "Brisk Supporter" : "Brisk Supporter");
120             break;
121         }
122     }
123
124     if (supername != "") {
125         content += '&nbsp;<img title="'+supertit+'" class="inline" src="img/'+supername+'">';
126     }
127     
128     if (name != "") {
129         content += '&nbsp;<img title="'+tit+'" class="inline" src="img/'+name+'">';
130     }
131
132     return content;
133 }
134
135 var standup_data_old = null;
136
137 // TODO !!
138 // appendChild , removeChild
139
140 function table_add(curtag, td)
141 {
142     var tbody  = null, tr, ct;
143
144     do {
145         // console.log("wt: "+curtag.tagName);
146
147         if (curtag.tagName.toLowerCase() == "div" || 
148             curtag.tagName.toLowerCase() == "table") {
149             curtag = curtag.firstChild;
150         }
151         else if (curtag.tagName.toLowerCase() == "tbody") {
152             tbody = curtag;
153             break;
154         }
155         else
156             curtag = null;
157     } while (curtag != null);
158     
159     curtag = tbody.firstChild;
160     ct = 0;
161     do {
162         if (curtag.tagName.toLowerCase() == "tr") {
163             if (curtag.firstChild != null) {
164                 curtag = curtag.firstChild;
165                 ct++;
166             }
167             else {
168                 curtag.appendChild(td);
169                 return(true);
170             }
171         }
172         else if (curtag.tagName.toLowerCase() == "td") {
173             if (curtag.nextSibling != null) {
174                 curtag = curtag.nextSibling;
175                 ct++;
176             }
177             else {
178                 if (ct < 4) {
179                     curtag.parentNode.appendChild(td);
180                     return (true);
181                 }
182                 else {
183                     ct = 0;
184                     curtag = curtag.parentNode.nextSibling;
185                 }
186             }
187         }
188         else {
189             curtag = curtag.parentNode;
190         }
191
192     } while (curtag != null);
193
194     tr = document.createElement("tr");
195     tr.appendChild(td);
196     tbody.appendChild(tr);
197
198     return (true);
199 }
200
201 function spcs(c1, c2, n)
202 {
203     var ret = "";
204     var i;
205
206     for (i = 0 ; i < n ; i++) {
207         if ((i % 2) == 0)
208             ret += c1;
209         else
210             ret += c2;
211     }
212
213     return (ret);
214 }
215
216
217 function table_walk(curtag)
218 {
219     do {
220         // console.log("wt: "+curtag.tagName);
221         if (curtag.tagName.toLowerCase() == "div" || 
222             curtag.tagName.toLowerCase() == "table" ||
223             curtag.tagName.toLowerCase() == "tbody") {
224             curtag = curtag.firstChild;
225         }
226         else if (curtag.tagName.toLowerCase() == "tr") {
227             if (curtag.firstChild != null)
228                 curtag = curtag.firstChild;
229             else if (curtag.tagName != '')
230                 curtag = curtag.nextSibling;
231             else
232                 curtag = null;
233         }
234         else if (curtag.tagName.toLowerCase() == "td") {
235             if (curtag.nextSibling != null)
236                 curtag = curtag.nextSibling;
237             else {
238                 if (curtag.parentNode.nextSibling != null && curtag.parentNode.nextSibling.tagName != '')
239                     curtag = curtag.parentNode.nextSibling;
240                 else
241                     curtag = null;
242             }
243         }
244         else
245             curtag = null;
246
247     } while (curtag != null && curtag.tagName.toLowerCase() != "td");
248
249     if (1 == 0) {
250         if (curtag == null)
251             alert("outtag == null"); 
252         else
253             alert("outtag: "+curtag.tagName);
254     }
255     return (curtag);
256 }
257
258 function j_stand_tdcont(el)
259 {
260     return (user_dec_and_state(el));
261 }
262
263 function j_stand_cont(ddata)
264 {
265     var i, ii;
266     var content;
267     var st = 0, name = "";
268     var curtag, nextag;
269
270     var data;
271
272     if (g_listen & l_list_isol) {
273         data = new Array();
274
275         for (i = 0, ii = 0 ; ii < ddata.length ; ii++) {
276             if ((ddata[ii][0] & 0x02) == 0) {
277                 continue;
278             }
279             data[i++] = ddata[ii];
280         }
281     }
282     else
283         data = ddata;
284
285     if (standup_data_old == null || data.length < 4) {
286     // if (standup_data_old == null) {
287         
288         content = '<table cols="'+(data.length < 4 ? data.length : 4)+'" class="table_standup">';
289         for (i = 0 ; i < data.length ; i++) {
290             if ((i % 4) == 0)
291                 content += '<tr>';
292             content += '<td id="'+i+'" class="room_standup">';
293             content += j_stand_tdcont(data[i]);
294             content += '</td>';
295             
296             if ((i % 4) == 3)
297                 content += '</tr>';
298         }
299         if ((i % 4) < 3)
300             content += '</tr>';
301         content += '</table>';
302         
303         $("standup").innerHTML = content;
304
305         // console.log("inizio");
306         // for (i = 0 , curtag = table_walk($("standup")) ; curtag != null ;  curtag = table_walk(curtag), i++ ) {
307         //     console.log("inloop["+i+"]: "+curtag.tagName+"  ID: "+curtag.id);
308         // }
309         // console.log("fine "+i);
310
311         // walktable($("standup"), nextag);
312         // console.log($("standup").firstChild);
313         // console.log($("standup").firstChild.firstChild.firstChild.firstChild);
314
315         // log_walk($("standup"));
316
317         standup_data_old = data;
318     }
319     else {
320         var idx_del, arr_add, idx_mod, arr_mod;
321         var idx_del_n = 0, idx_add_n = 0, idx_mod_n = 0;
322         var i, e;
323         var i_del, i_mod, i_add;
324         var td;
325
326         idx_del = new Array();
327         arr_add = new Array();
328         map_add = new Array();
329         idx_mod = new Array();
330         arr_mod = new Array();
331         map_cur = new Array();
332         
333         // find removed entries
334         for (i = 0 ; i < standup_data_old.length ; i++) {
335             for (e = 0 ; e < data.length ; e++) {
336                 if (standup_data_old[i][1] == data[e][1]) {
337                     break;
338                 }
339             }
340             if (e == data.length) {
341                 idx_del[idx_del_n++] = i;
342                 map_cur[i] = -1;
343             }
344             else {
345                 /* modified entries */
346                 if (standup_data_old[i][0] != data[e][0]) {
347                     arr_mod[idx_mod_n] = data[e];
348                     idx_mod[idx_mod_n++] = i;
349                 }
350                 map_cur[i] = e;
351             }
352         }
353
354         // find new entries
355         for (e = 0 ; e < data.length ; e++) {
356             for (i = 0 ; i < standup_data_old.length ; i++) {
357                 if (data[e][1] == standup_data_old[i][1] ) {
358                     break;
359                 }
360             }
361             if (i == standup_data_old.length) {
362                 // console.log("ADD: "+data[e][1]);
363                 arr_add[idx_add_n]   = data[e];
364                 map_add[idx_add_n++] = e;
365             }
366         }
367         
368         // TODO: qui travaso add in del
369
370         i_del = 0;
371         // alert("del: ["+j_stand_tdcont(standup_data_old[idx_del[i_del]])+"]");
372         for (i = 0 , i_del = 0, i_mod = 0, i_add = 0, curtag = table_walk($("standup")) ; curtag != null ;  curtag = table_walk(curtag), i++ ) {
373             // console.log("cur.id: "+curtag.id);
374
375             // alert("i: "+i+"  tagname: "+curtag.tagName+"  innerHTML: ["+curtag.innerHTML+"]");
376             // console.log("inloop["+i+"]: "+curtag.tagName+"  ID: "+curtag.id);
377             if (curtag.innerHTML == "") {
378                 // console.log("innerHTML == none");
379                 if (i_add < idx_add_n) {
380                     // console.log("  to be new");
381                     // console.log("  add:   CONT:"+j_stand_tdcont(arr_add[i_add]));
382                     curtag.innerHTML = j_stand_tdcont(arr_add[i_add]);
383                     curtag.id = map_add[i_add];
384                     i_add++
385                 }
386             }
387
388             // else if (i_del < idx_del_n && curtag.innerHTML == j_stand_tdcont(standup_data_old[idx_del[i_del]])) {
389             else if (i_del < idx_del_n && curtag.id == idx_del[i_del]) {
390                 // console.log("to be cancel["+i+"]:  ID: "+curtag.id);
391                 if (i_add < idx_add_n) {
392                     // console.log("  to be new");
393                     // console.log("  add:   CONT:"+j_stand_tdcont(arr_add[i_add]));
394                     curtag.innerHTML = j_stand_tdcont(arr_add[i_add]);
395                     curtag.id = map_add[i_add];
396                     i_add++
397                 }
398                 else {
399                     // console.log("  to be del");
400                     curtag.innerHTML = "";
401                     curtag.id = -1;
402                 }
403                 i_del++;
404             }
405             // else if (i_mod < idx_mod_n && curtag.innerHTML == j_stand_tdcont(standup_data_old[idx_mod[i_mod]])) {
406             else if (i_mod < idx_mod_n && curtag.id == idx_mod[i_mod]) {
407                 // console.log("  to be mod");
408                 // console.log("mod: "+idx_mod[i_mod]+ "  CONT:"+j_stand_tdcont(arr_mod[i_mod]));
409                 curtag.innerHTML = j_stand_tdcont(arr_mod[i_mod]);
410                 curtag.id = map_cur[curtag.id];
411                 i_mod++;
412             }
413             else
414                 curtag.id = map_cur[curtag.id];
415         }
416         // console.log("fineloop");
417
418         for (i ; i_add < idx_add_n ; i_add++, i++) {
419             // console.log("ADD: "+i+" arr_add: "+ arr_add[i_add][1]);
420             td = document.createElement("td");
421             td.className = "room_standup";
422             td.id = map_add[i_add];
423             td.innerHTML = j_stand_tdcont(arr_add[i_add]);
424
425             table_add($("standup"), td);
426         }
427
428         standup_data_old = data;
429         return;
430     }
431     // $("esco").innerHTML =  '<input class="button" name="logout" value="Esco." onclick="esco_cb();" type="button">';
432 }
433
434 function esco_cb() {
435     window.onbeforeunload = null; 
436     window.onunload = null; 
437     // nonunload = true; 
438     act_logout(0);
439  };
440
441
442
443 function j_tab_cont(table_idx, data)
444 {
445     var i;
446     var content = '';
447
448     for (i = 0 ; i < data.length ; i++) {
449         // content += user_decorator(data[i]);
450         // content += state_add(data[i][0]);
451         content += j_stand_tdcont(data[i]);
452
453         content += '<br>';
454     }
455     $("table"+table_idx).innerHTML = content;
456 }
457
458 function j_tab_act_cont(idx, act)
459 {
460     if (act == 'sit') {
461         // MLANG 1
462         $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xhenter'+idx+'"  value="'+(g_lang == 'en' ? "Sit down." : "Mi siedo.")+'" onclick="act_sitdown('+idx+');">';
463     }
464     else if (act == 'sitreser') {
465         // <img class="nobo" title="tavolo riservato agli utenti registrati" style="display: inline; margin-right: 80px;" src="img/okauth.png">
466         // MLANG 1
467         $("table_act"+idx).innerHTML = '<input type="button" style="background-repeat: no-repeat; background-position: center; background-image: url(\'img/okauth.png\');" class="button" name="xhenter'+idx+'"  value="'+(g_lang == 'en' ? "Sit down." : "Mi siedo.")+'" onclick="act_sitdown('+idx+');">';
468     }
469     else if (act == 'wake') {
470         // MLANG 1
471         $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xwakeup"  value="'+(g_lang == 'en' ? "Wake up." : "Mi alzo.")+'" onclick="act_wakeup();">';
472     }
473     else if (act == 'reserved') {
474         // MLANG 1
475         $("table_act"+idx).innerHTML = '<img class="nobo" title="'+(g_lang == 'en' ? "reserved table for authenticated users only" : "tavolo riservato agli utenti registrati")+'" style="margin-right: 20px;" src="img/onlyauth.png">';
476     }
477     else {
478         $("table_act"+idx).innerHTML = '';
479     }
480 }
481
482 function j_login_manager(form)
483 {
484     var token;
485
486     if (form.elements['passid'].value == '')
487         return (true);
488
489     else {
490         // console.log("richiesta token");
491         /* richiede token */
492         token = server_request('mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value));
493         tokens = token.split('|');
494         
495         // console.log('XX token: '+token);
496         // console.log(tokens);
497         if (token == null)
498             return (false);
499
500         token = calcMD5(tokens[1]+calcMD5(form.elements['passid'].value));
501         
502         form.elements['passid_private'].value = token;
503         form.elements['passid'].value = ""; // FIXME da sost con la stessa len di A
504
505         return (true);
506     }
507     
508     return (false);
509 }
510
511 function login_formtext_hilite()
512 {
513     formtext_hilite($("nameid"));
514     formtext_hilite($("passid"));
515     formsub_hilite($("sub"));
516 }
517
518 function login_init()
519 {
520     menu_init();
521     login_formtext_hilite();
522 }
523
524 function warrant_formtext_hilite(form)
525 {
526     /*
527     formtext_hilite($("nameid"));
528     formtext_hilite($("emailid"));
529     formsub_hilite($("subid"));
530     formsub_hilite($("cloid"));
531     */
532     formtext_hilite(form.elements['name']);
533     formtext_hilite(form.elements['email']);
534     formsub_hilite(form.elements['sub']);
535     formsub_hilite(form.elements['clo']);
536 }
537
538 function mesgtoadm_formtext_hilite(form)
539 {
540     /*
541     formtext_hilite($("subjid"));
542     formtext_hilite($("mesgid"));
543     formsub_hilite($("subid"));
544     formsub_hilite($("cloid"));
545     */
546     formtext_hilite(form.elements['subj']);
547     formtext_hilite(form.elements['mesg']);
548     formsub_hilite(form.elements['sub']);
549     formsub_hilite(form.elements['clo']);
550 }
551
552
553 function j_check_email(email)
554 {
555     if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
556         return (true);
557     return (false);
558 }
559
560 function j_authbox(form)
561 {
562     var no; 
563
564     do {
565         if (form.elements['realsub'].value == "chiudi") {
566             $('authbox').style.visibility = "hidden";
567             break;
568         }
569
570         if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) {
571             // MLANG 2-4
572             no = new notify(gst, 
573                             (g_lang == 'en' ? "<br><b>nickname</b> and/or <b>e-mail</b> fields are invalid;<br>please, fix them." :
574                              "<br>I campi <b>nickname</b> e/o <b>e-mail</b> non sono validi;<br> correggeteli per favore."),
575                             1, (g_lang == 'en' ? "close" : "chiudi"), 280, 100); 
576             break;
577         }
578
579         // submit the request
580         token = server_request('mesg', 'warranty', 
581                                'cli_name', encodeURIComponent(form.elements['name'].value),
582                                'cli_email', encodeURIComponent(form.elements['email'].value) );
583         if (token == "1") {
584             $('authbox').style.visibility = "hidden";
585             form.elements['name'].value = "";
586             form.elements['email'].value = "";
587             break;
588         }
589     } while (0);
590
591     return (false);
592 }
593
594 function authbox(w, h)
595 {
596     var box;
597
598     box = $('authbox');
599
600     box.style.zIndex = 200;
601     box.style.width  = w+"px";
602     box.style.marginLeft  = -parseInt(w/2)+"px";
603     box.style.height = h+"px";
604     box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
605
606     warrant_formtext_hilite($('auth_form'));
607
608     box.style.visibility = "visible";
609     $("nameid").focus();
610 }
611
612 function j_mesgtoadmbox(form)
613 {
614     var no; 
615
616     do {
617         if (form.elements['realsub'].value == "chiudi") {
618             $('mesgtoadmbox').style.visibility = "hidden";
619             break;
620         }
621
622         if (form.elements['mesg'].value == '' || form.elements['subj'].value == '') {
623             // MLANG 1-3
624             no = new notify(gst, (g_lang == 'en' ? "<br><b>subject</b> and the <b>message</b> cannot be void;<br>please, fix them." :
625                                   "<br>Il <b>soggetto</b> e il <b>messaggo</b> non possono essere vuoti;<br>correggeteli per favore."), 1, 
626                                   (g_lang == 'en' ? "close" : "chiudi"), 280, 100); 
627             break;
628         }
629                 
630         // submit the request
631         token = server_request('mesg', 'mesgtoadm', 
632                                'cli_subj', encodeURIComponent(form.elements['subj'].value),
633                                'cli_mesg', encodeURIComponent(form.elements['mesg'].value) );
634         if (token == "1") {
635             $('mesgtoadmbox').style.visibility = "hidden";
636             form.elements['subj'].value = "";
637             form.elements['mesg'].value = "";
638             break;
639         }
640     } while (0);
641
642     return (false);
643 }
644
645 function mesgtoadmbox(w, h)
646 {
647     var box;
648
649     box = $('mesgtoadmbox');
650
651     box.style.zIndex = 200;
652     box.style.width  = w+"px";
653     box.style.marginLeft  = -parseInt(w/2)+"px";
654     box.style.height = h+"px";
655     box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
656
657     mesgtoadm_formtext_hilite($('mesgtoadm_form'));
658
659     box.style.visibility = "visible";
660     $('mesgtoadm_form').elements['subj'].focus();
661 }
662
663 function j_pollbox(form)
664 {
665     var no, i, choose; 
666
667     do {
668         // submit the request
669         
670         for (i = 0 ; i < form.elements.length ; i++) {
671             if (form.elements[i].checked == true)
672                 break;
673         }
674         if (i == form.elements.length) {
675             // MLANG 1-3
676             no = new notify(gst, (g_lang == 'en' ? "<br>You must choose ah item;<br> please, fix it." :
677                                   "<br>Non hai espresso nessuna preferenza;<br> correggi per favore."), 1, 
678                             (g_lang == 'en' ? "close" : "chiudi"), 280, 100); 
679             return false;
680         }
681         else
682             choose = form.elements[i].value;
683
684         token = server_request('mesg', 'poll', 
685                                'cli_choose', encodeURIComponent(choose) );
686
687         if (token == "1") {
688             // TODO: mesg to user
689             // $('mesgtoadmbox').style.visibility = "hidden";
690             break;
691         }
692     } while (0);
693
694     return (false);
695 }
696
697 function prefs_load(content)
698 {
699     var prefs_new;
700     var s;
701
702     s = "prefs_new = " + content;
703     eval(s);
704
705     return (prefs_new);
706 }
707
708
709 function list_set(what, is_update, info)
710 {
711     // console.log(what);
712     var i;
713     var relo = false;
714     var old_st = readCookie("CO_list");
715     
716     if (what == 'auth') {
717         $('list_auth').style.color = 'red';
718         $('list_isol').style.color = 'black';
719         $('list_all').style.color = 'black';
720         if (old_st == 'isolation')
721             relo = true;
722         g_listen = l_list_auth;
723     }
724     else if (what == 'isolation') {
725         $('list_auth').style.color = 'black';
726         $('list_isol').style.color = 'red';
727         $('list_all').style.color = 'black';
728         if (old_st != 'isolation')
729             relo = true;
730         g_listen = l_list_isol;
731     }
732     else {
733         $('list_auth').style.color = 'black';
734         $('list_isol').style.color = 'black';
735         $('list_all').style.color = 'red';
736         if (old_st == 'isolation')
737             relo = true;
738         g_listen = l_list_all;
739     }
740
741     set_checked_value($('ra_listen_auth'), what);
742     set_checked_value($('ra_listen_isol'), what);
743     set_checked_value($('ra_listen_all'),  what);
744
745     $('list_info').innerHTML = info;
746     if (is_update) {
747         createCookie("CO_list", what, 24*365, cookiepath);
748     }
749
750
751     if (relo || !is_update) {
752         for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
753             
754             if (i % 4 == 0) {
755                 $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
756             }
757             
758             $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
759         }
760         if (what == 'isolation') {
761             tra.hide_noauth();
762         }
763         else {
764             tra.show_noauth();
765         }
766             
767         if (false) {
768             // ricalculation of standup area
769             if (standup_data_old != null) {
770                 standup_data = standup_data_old;
771                 standup_data_old = null;
772                 j_stand_cont(standup_data);
773             }
774         }
775     }
776 }
777
778 function sideslide(domobj, height, step)
779 {
780     this.st = 'wait';
781     this.twait = 5000;
782
783     this.domobj = domobj;
784     this.height = height;
785     this.step = step;
786
787     this.start();
788 }
789
790 sideslide.prototype = {
791     id: null,
792     st: 'wait',
793     twait: 0,
794     scroll: 0,
795     countdown: 0,
796
797     domobj: null,
798     height: 0,
799     step: 0,
800
801     start: function() {
802         var instant = this;
803         
804         this.st = 'wait';
805         this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait);
806     },
807
808     sideslide_cb: function() {
809         var instant = this;
810
811         if (this.st == 'wait') {
812             this.st = 'scroll';
813             this.countdown = 10;
814             this.id = setInterval(function () { instant.sideslide_cb(); }, 100);
815         }
816         else if (this.st == 'scroll') {
817             this.scroll += (this.step / 10);
818             if (this.scroll >= this.height - this.step) {
819                 this.scroll = 0;
820             }
821             this.domobj.scrollTop = this.scroll;
822             this.countdown--;
823             if (this.countdown == 0) {
824                 this.stop();
825                 this.st = 'wait';
826                 this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait);
827             }
828         }
829     },
830
831
832     stop: function() {
833         if (this.id != null) {
834             clearInterval(this.id);
835             this.id = null;
836         }
837     }
838
839 }