4 * Copyright (C) 2006-2008 Matteo Nastasi
5 * mailto: nastasi@alternativeoutput.it
6 * matteo.nastasi@milug.org
7 * web: http://www.alternativeoutput.it
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.
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.
27 var EXIT_BAN_TIME = 900;
28 var cookiepath = "/brisk/";
30 function $(id) { return document.getElementById(id); }
32 function getStyle(x,IEstyleProp, MozStyleProp)
35 var y = x.currentStyle[IEstyleProp];
36 } else if (window.getComputedStyle) {
37 var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(MozStyleProp);
42 /* replacement of setInterval on IE */
44 /*if not IE, do nothing*/
45 if(!document.uniqueID){return;};
47 /*Copy the default setInterval behavior*/
48 var nativeSetInterval = window.setInterval;
49 window.setInterval = function(fn,ms) {
51 if(arguments.length <= 2) {
52 return nativeSetInterval(fn,ms);
55 for(var i=2;i<arguments.length;i+=1) {
56 param[i-2] = arguments[i];
60 if(typeof(fn)=='function') {
62 return (function (fn,ms,param) {
63 var fo = function () {
64 fn.apply(window,param);
66 return nativeSetInterval(fo,ms);
69 else if(typeof(fn)=='string')
71 return nativeSetInterval(fn,ms);
75 throw Error('setInterval Error\nInvalid function type');
79 /*Copy the default setTimeout behavior*/
80 var nativeSetTimeout = window.setTimeout;
81 window.setTimeout = function(fn,ms) {
83 if(arguments.length <= 2) {
84 return nativeSetTimeout(fn,ms);
87 for(var i=2;i<arguments.length;i+=1) {
88 param[i-2] = arguments[i];
92 if(typeof(fn)=='function') {
94 return (function (fn,ms,param) {
95 var fo = function () {
96 fn.apply(window,param);
98 return nativeSetTimeout(fo,ms);
101 else if(typeof(fn)=='string')
103 return nativeSetTimeout(fn,ms);
107 throw Error('setTimeout Error\nInvalid function type');
113 function addEvent(obj,type,fn)
115 if (obj.addEventListener) {
116 obj.addEventListener( type, fn, false);
118 else if (obj.attachEvent) {
119 obj["e"+type+fn] = fn;
120 obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
121 obj.attachEvent( "on"+type, obj[type+fn] );
124 throw new Error("Event registration not supported");
127 function removeEvent(obj,type,fn)
129 if (obj.removeEventListener) {
130 obj.removeEventListener( type, fn, false );
132 else if (obj.detachEvent) {
133 obj.detachEvent( "on"+type, obj[type+fn] );
135 obj["e"+type+fn] = null;
139 // var card_pos = RANGE 0 <= x < cards_ea_n
141 function show_bigpict(obj, act, x, y)
145 if (arguments.length > 4)
150 big = $(obj.id+"_big"+sfx);
152 big.style.left = obj.offsetLeft + x+"px";
153 big.style.top = obj.offsetTop + y+"px";
154 big.style.visibility = "visible";
157 big.style.visibility = "hidden";
161 function rnd_int(min, max) {
162 return Math.floor(Math.random() * (max - min + 1) + min);
165 function error_images()
170 function abort_images()
172 alert("ABORTAIMAGES");
175 function unload_images()
177 alert("ABORTAIMAGES");
180 function reset_images()
182 alert("ABORTAIMAGES");
185 function update_images()
187 // if (g_imgct % 10 == 0) alert("g_imgct: "+g_imgct+" xx "+g_preload_img_arr[g_imgct]);
188 $("imgct").innerHTML = "Immagini caricate "+g_preload_imgsz_arr[g_imgct]+"%.";
189 if (g_imgct+1 < g_preload_img_arr.length) {
191 setTimeout(preload_images, 100, g_preload_img_arr, g_imgct-1);
193 // $("imgct").innerHTML += "U";
196 function preload_images(arr,idx)
200 // $("imgct").innerHTML = "Stiamo caricando "+arr[idx]+"%.<br>";
201 im.onload = update_images;
202 im.onerror = error_images;
203 im.onabort = abort_images;
204 im.onunload = unload_images;
205 im.onreset = reset_images;
207 // $("imgct").innerHTML += "P";
210 function safestatus(a)
218 function createXMLHttpRequest() {
219 try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}
220 try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
221 try { return new XMLHttpRequest(); } catch(e) {}
222 alert("XMLHttpRequest not supported");
226 function send_mesg(mesg)
228 var xhr_wr = createXMLHttpRequest();
229 var is_conn = (sess == "not_connected" ? false : true);
231 // alert("xhr_wr: "+xhr_wr+" is_conn: "+is_conn);
232 xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+'mesg='+mesg, (is_conn ? true : false));
233 xhr_wr.onreadystatechange = function() { return; };
237 if (xhr_wr.responseText != null) {
238 eval(xhr_wr.responseText);
243 function server_request()
245 var xhr_wr = createXMLHttpRequest();
248 if (arguments.length > 0) {
249 for (i = 0 ; i < arguments.length ; i+= 2) {
250 collect += (i == 0 ? "" : "&") + arguments[i] + "=" + encodeURIComponent(arguments[i+1]);
253 // alert("Args: "+arguments.length);
255 var is_conn = (sess == "not_connected" ? false : true);
257 // console.log("server_request:preresp: "+xhr_wr.responseText);
259 xhr_wr.open('GET', 'index_wr.php?'+(is_conn ? 'sess='+sess+'&' : '')+collect, false);
260 xhr_wr.onreadystatechange = function() { return; };
263 if (xhr_wr.responseText != null) {
264 // console.log("server_request:resp: "+xhr_wr.responseText);
265 return (xhr_wr.responseText);
271 /* Stat: CHAT and TABLE */
273 function chatt_checksend(obj,e)
279 if(window.event) { // IE
282 else if(e.which) { // Netscape/Firefox/Opera
285 // alert("OBJ: "+obj);
286 if (keynum == 13 && obj.value != "") { // Enter
287 act_chatt(obj.value);
291 function act_chatt(value)
293 send_mesg("chatt|"+encodeURIComponent(value));
297 obj.disabled = false;
304 function act_sitdown(table)
306 send_mesg("sitdown|"+table);
309 function act_wakeup()
314 /* Stat: TABLE Subst: ASTA */
315 function act_asta(card,pnt)
317 send_mesg("asta|"+card+"|"+pnt);
320 function act_choose(card)
323 send_mesg("choose|"+card);
326 /* Stat: TABLE Subst: GAME */
327 function act_play(card,x,y)
330 send_mesg("play|"+card+"|"+x+"|"+y);
333 function act_tableinfo()
335 send_mesg("tableinfo");
345 act_chatt('/tav '+$('txt_in').value);
346 $('txt_in').value = '';
354 function act_roadmap()
356 send_mesg("roadmap");
359 function act_whysupport()
361 send_mesg("whysupport");
364 function act_exitlock()
366 send_mesg("exitlock");
369 function safelogout()
374 res = window.confirm("Sei sicuro di volere abbandonare la partita?\nATTENZIONE: se esci adesso senza il consenso degli altri giocatori non potrai sederti ai tavoli per "+(Math.floor(EXIT_BAN_TIME/60))+" minuti.");
376 res = window.confirm("Sei sicuro di volere abbandonare la partita?");
378 act_logout(g_exitlock);
381 function act_lascio()
386 function safelascio()
390 res = window.confirm("Sei sicuro di volere lasciare questa mano?");
395 function act_logout(exitlock)
397 send_mesg("logout|"+exitlock);
401 function act_reload()
403 window.onunload = null;
404 window.onbeforeunload = null;
405 document.location.reload();
408 function act_shutdown()
412 send_mesg("shutdown");
413 // while (xhr_wr.readyState != 4)
417 function postact_logout()
419 // alert("postact_logout");
424 // eraseCookie("sess");
425 document.location.assign("index.php");
429 function slowimg(img,x1,y1,deltat,free,action,srcend)
431 x1,y1 - destination coords
432 deltat - time for each frame (in msec)
433 free - when the release the local block for other operations (range: 0 - 1)
434 action - function to run when the image is moved
435 srcend - image to switch when the image is moved
438 function sleep(st, delay)
440 // alert("LOC_NEW PRE: "+st.st_loc_new);
444 setTimeout(function(obj){ if (obj.st_loc_new > obj.st_loc) { obj.st_loc++; }},
448 function slowimg(img,x1,y1,deltat,free,action,srcend) {
451 // this.x0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("left"));
452 this.x0 = parseInt(getStyle(this.img,"left", "left"));
453 // alert("img.x0 = "+this.x0);
454 // this.y0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("top"));
455 this.y0 = parseInt(getStyle(this.img,"top", "top"));
458 this.deltat = deltat;
460 this.action = action;
461 this.srcend = srcend;
464 slowimg.prototype = {
483 setstart: function(x0,y0)
489 setaction: function(act)
495 settime: function(time)
497 this.time = (time < this.deltat ? this.deltat : time);
498 this.step_n = parseInt(this.time / this.deltat);
499 this.dx = (this.x1 - this.x0) / this.step_n;
500 this.dy = (this.y1 - this.y0) / this.step_n;
501 if (this.step_n * this.deltat == this.time) {
505 this.step_free = parseInt(this.step_n * this.free);
511 // $("logz").innerHTML += " xxxxxxxxxxxxxxxxxxxxxSTART<br>";
513 this.st.st_loc_new++;
515 this.img.style.visibility = "visible";
516 setTimeout(function(obj){ obj.animate(); }, this.deltat, this);
521 // $("log").innerHTML = "Val " + this.step_cur + " N: " + this.step_n + "<br>";
522 if (this.step_cur == 0) {
523 var date = new Date();
524 // $("logz").innerHTML = "Timestart: " + date + "<br>";
526 if (this.step_cur <= this.step_n) {
527 this.img.style.left = this.x0 + this.dx * this.step_cur;
528 this.img.style.top = this.y0 + this.dy * this.step_cur;
530 setTimeout(function(obj){ obj.animate(); }, this.deltat, this);
531 if (this.step_cur == this.step_free && this.st != null) {
532 if (this.st.st_loc < this.st.st_loc_new) {
533 // alert("QUI1 " + this.step_cur + " ZZ "+ this.step_free);
540 this.img.style.left = this.x1;
541 this.img.style.top = this.y1;
542 // $("logz").innerHTML += "xxxxxxxxxxxxxxxCLEAR<br>";
543 var date = new Date();
544 // $("logz").innerHTML += "Timestop: " + date + "<br>";
546 if (this.action != null) {
550 if (this.st != null && this.st.st_loc < this.st.st_loc_new) {
555 if (this.srcend != null) {
556 this.img.src = this.srcend;
562 var asta_xarr = new Array(0,66,132);
564 /* TODO: impostare gli onclick */
565 function dispose_asta(idx, pnt, nopoint)
570 for (i = 0 ; i < 10 ; i++) {
573 btn.src = "img/astapasso"+(pnt >= 0 ? "" : "_ro")+".png";
574 btn.style.cursor = (pnt >= 0 ? "pointer" : "default");
578 btn.src = "img/asta"+i+(pnt >= 0 ? "" : "_ro")+".png";
579 btn.style.cursor = (pnt >= 0 ? "pointer" : "default");
583 btn.style.left = asta_xarr[i % 3];
585 btn.style.left = asta_xarr[(i+1) % 3];
587 btn.style.top = parseInt(i / 3) * 50 + (i == 9 ? 0 : 1);
590 eval("btn.onclick = function () { act_asta("+pass+",61); }");
591 btn.style.cursor = "pointer";
595 btn.style.cursor = "default";
600 btn = $("astaptdiv");
601 btn.style.left = asta_xarr[i % 3];
602 btn.style.top = parseInt(i / 3) * 50 - 2;
603 // btn.style.visibility = "visible";
606 var rpnt = (pnt < 0 ? -pnt : pnt);
607 btn.value = (rpnt < 61 ? 61 : (rpnt > 120 ? 120 : rpnt));
609 btn = $("astaptsub");
610 btn.style.left = asta_xarr[i % 3];
611 btn.style.top = 25 + parseInt(i / 3) * 50 - 1;
612 btn.src = "img/astaptsub"+(pnt >= 0 ? "" : "_ro")+".png";
613 btn.style.cursor = (pnt >= 0 ? "pointer" : "default");
615 btn.onclick = function () { act_asta(9,$("astapt").value); };
616 btn.style.cursor = "pointer";
620 btn.style.cursor = "default";
625 btn = $("astapasso");
626 btn.style.left = asta_xarr[i % 3];
627 btn.style.top = parseInt(i / 3) * 50;
628 btn.src = "img/astapashalf"+(pnt >= 0 ? "" : "_ro")+".png";
629 btn.style.cursor = (pnt >= 0 ? "pointer" : "default");
631 btn.onclick = function () { act_asta(-1,0); };
637 btn = $("astalascio");
638 btn.style.left = asta_xarr[i % 3];
639 btn.style.top = parseInt(i / 3) * 50 + 24;
640 btn.src = "img/astalascio.png";
641 btn.style.visibility = "visible";
642 btn.onclick = function () { safelascio(); };
645 btn = $("astapasso");
646 btn.style.left = asta_xarr[i % 3];
647 btn.style.top = parseInt(i / 3) * 50;;
648 btn.src = "img/astapasso"+(pnt >= 0 ? "" : "_ro")+".png";
649 btn.style.cursor = (pnt >= 0 ? "pointer" : "default");
651 btn.onclick = function () { act_asta(-1,0); };
657 btn = $("astalascio");
658 btn.style.visibility = "hidden";
661 // btn.style.visibility = "visible";
662 $("asta").style.visibility = "visible";
665 function asta_pnt_set(pnt)
668 var rpnt = (pnt < 0 ? -pnt : pnt);
669 btn.value = (rpnt < 61 ? 61 : (rpnt > 120 ? 120 : rpnt));
674 $("asta").style.visibility = "hidden";
678 function notify(st, text, tout, butt, w, h)
685 this.ancestor = document.body;
687 this.st.st_loc_new++;
689 clo = document.createElement("input");
691 clo.className = "button";
692 clo.style.bottom = "4px";
695 clo.onclick = this.input_hide;
697 clodiv = document.createElement("div");
698 clodiv.className = "notify_clo";
699 clodiv.appendChild(clo);
701 cont = document.createElement("div");
703 cont.style.borderBottomStyle = "solid";
704 cont.style.borderBottomWidth = "1px";
705 cont.style.borderBottomColor = "gray";
706 cont.style.height = (h - 30)+"px";
707 cont.style.overflow = "auto";
708 cont.innerHTML = text;
710 box = document.createElement("div");
711 box.className = "notify";
712 box.style.zIndex = 200;
713 box.style.width = w+"px";
714 box.style.marginLeft = -parseInt(w/2)+"px";
715 box.style.height = h+"px";
716 box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
717 box.appendChild(cont);
718 box.appendChild(clodiv);
719 box.style.visibility = "visible";
723 this.ancestor.appendChild(box);
725 this.toutid = setTimeout(function(obj){ obj.unblock(); }, tout, this);
736 if (this.st.st_loc < this.st.st_loc_new) {
743 clearTimeout(this.toutid);
744 this.ancestor.removeChild(this.notitag);
748 input_hide: function()
750 clearTimeout(this.obj.toutid);
751 this.obj.ancestor.removeChild(this.obj.notitag);
758 return document.getElementById(id);
764 this.st_loc_new = -1;
765 this.comms = new Array;
770 function remark_step()
772 var ct = $("remark").l_remct;
778 $("remark").className = "remark"+ct;
779 $("remark").l_remct = ct;
780 setTimeout(remark_step,500);
783 $("remark").className = "remark0";
790 if ($("remark").l_remct == 0) {
791 $("remark").l_remct = 1;
792 setTimeout(remark_step,500);
796 function remark_off()
798 $("remark").l_remct = 0;
799 $("remark").className = "remark0";
803 function choose_seed(card)
807 $("asta").style.visibility = "hidden";
808 $("astalascio").style.visibility = "hidden";
809 $("chooseed").style.visibility = "visible";
810 for (i = 0 ; i < 4 ; i++) {
811 $("seed"+i).src = "img/"+i+""+card+".png";
813 eval("seed.onclick = function () { act_choose("+i+""+card+"); };");
817 function italizer(ga)
821 return "<i>"+ga[1]+"</i>";
826 function set_names(so,ea,ne,nw,we)
829 $("name").innerHTML = italizer(so);
830 $("name").title = unescapeHTML(so[1]);
831 $("name_ea").innerHTML = italizer(ea);
832 $("name_ea").title = unescapeHTML(ea[1]);
833 $("name_ne").innerHTML = italizer(ne);
834 $("name_ne").title = unescapeHTML(ne[1]);
835 $("name_nw").innerHTML = italizer(nw);
836 $("name_nw").title = unescapeHTML(nw[1]);
837 $("name_we").innerHTML = italizer(we);
838 $("name_we").title = unescapeHTML(we[1]);
843 var astat_suffix = new Array("","_ea","_ne","_nw","_we");
845 function show_astat(zer,uno,due,tre,qua)
847 var astat = new Array(zer,uno,due,tre,qua);
849 for (i = 0 ; i < PLAYERS_N ; i++) {
850 idx = (PLAYERS_N + i - table_pos) % PLAYERS_N;
852 if (astat[i] == -2) {
853 $("public"+astat_suffix[idx]).style.visibility = "hidden";
855 else if (astat[i] == -1) {
856 $("public"+astat_suffix[idx]).style.visibility = "visible";
857 $("pubacard"+astat_suffix[idx]).src = "img/astapasso.png";
858 $("pubapnt"+astat_suffix[idx]).innerHTML = "";
859 $("pubapnt"+astat_suffix[idx]).style.visibility = "hidden";
861 else if (astat[i] <= 10) {
862 $("public"+astat_suffix[idx]).style.visibility = "visible";
863 $("pubacard"+astat_suffix[idx]).src = "img/asta"+astat[i]+".png";
864 $("pubapnt"+astat_suffix[idx]).style.visibility = "hidden";
866 else if (astat[i] <= 120) {
867 $("public"+astat_suffix[idx]).style.visibility = "visible";
868 $("pubacard"+astat_suffix[idx]).src = "img/asta9.png";
869 $("pubapnt"+astat_suffix[idx]).style.visibility = "inherit"; // XXX VISIBLE
870 $("pubapnt"+astat_suffix[idx]).innerHTML = astat[i];
875 function exitlock_show(num, islock)
879 num = (num < 3 ? num : 3);
880 $("exitlock").src = "img/exitlock"+num+(islock ? "n" : "y")+".png";
881 // alert("EXITLOCK: "+$("exitlock").src);
882 $("exitlock").style.visibility = "visible";
887 // exitlock_show(0, true);
889 function table_init() {
890 var sux = new Array("", "_ea", "_ne", "_nw", "_we");
892 // console.log("table_init");
895 $("asta").style.visibility = "hidden";
896 $("caller").style.visibility = "hidden";
897 show_astat(-2,-2,-2,-2,-2);
898 for (i=0 ; i < 8 ; i++) {
899 Drag.init($("card" + i), card_mouseup_cb);
900 for (e = 0 ; e < PLAYERS_N ; e++)
901 $("card"+sux[e]+i).style.visibility = "hidden";
903 for (i=0 ; i < PLAYERS_N ; i++) {
904 // console.log("shut: "+"takes"+sux[i]);
905 $("takes"+sux[i]).style.visibility = "hidden";
908 for (i = 0 ; i < 8 ; i++) {
920 var chatt_lines = new Array();
921 var chatt_lines_n = 0;
923 var CHATT_MAXLINES = 40;
926 function chatt_sub(dt,data,str)
928 var must_scroll = false;
935 name = "<i>"+data[1]+"</i>";
938 // alert ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight);
940 if ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight >= 0)
943 // alert("ARRIVA NAME: "+ name + " STR:"+str);
944 if (chatt_lines_n == CHATT_MAXLINES) {
945 $("txt").innerHTML = "";
946 for (i = 0 ; i < (CHATT_MAXLINES - 1) ; i++) {
947 chatt_lines[i] = chatt_lines[i+1];
948 $("txt").innerHTML += chatt_lines[i];
950 chatt_lines[i] = dt+"<b>"+name+"</b> "+str+ "<br>";
951 $("txt").innerHTML += chatt_lines[i];
954 chatt_lines[chatt_lines_n] = dt+"<b>"+name+"</b> "+str+ "<br>";
955 $("txt").innerHTML += chatt_lines[chatt_lines_n];
958 // $("txt").innerHTML;
962 $("txt").scrollTop = 10000000;
964 // alert("scTOP "+$("txt").scrollTop+" scHEIGHT: "+$("txt").scrollHeight+" HEIGHT: "+getStyle($("txt"),"height", "height") );
968 * GESTIONE DEI COOKIES
970 function createCookie(name,value,hours,path) {
972 var date = new Date();
973 date.setTime(date.getTime()+(hours*60*60*1000));
974 var expires = "; expires="+date.toGMTString();
976 else var expires = "";
977 document.cookie = name+"="+value+expires+"; path="+path;
980 function readCookie(name) {
981 var nameEQ = name + "=";
982 var ca = document.cookie.split(';');
983 for(var i=0;i < ca.length;i++) {
985 while (c.charAt(0)==' ') c = c.substring(1,c.length);
986 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
991 function eraseCookie(name) {
992 createCookie(name,"",-1);
995 var onunload_times = 0;
998 function onbeforeunload_cb () {
1002 function onunload_cb_old () {
1005 // if (nonunload == true)
1008 if (onunload_times == 0) {
1009 var res = window.confirm(" Vuoi veramente abbandonare la briscola ?\n(clicca annulla o cancel se vuoi ricaricare la briscola)");
1018 document.location.href = self.location; // = self.location;
1019 // alert ("passiamo di qui"+self.location);
1022 alert("Ripristino della briscola fallito, per non perdere la sessione ricaricare la pagina manualmente.");
1031 function onunload_cb () {
1041 function room_checkspace(emme,tables,inpe)
1044 for (i = 0 ; i < emme ; i++)
1049 for (i = 0 ; i < 5 ; i++)
1050 alta += nome+"<br>";
1052 for (i = 0 ; i < tables ; i++) {
1053 $("table"+i).innerHTML = alta;
1054 $("table_act"+i).innerHTML = "<input type=\"button\" class=\"button\" name=\"xhenter"+i+"\" value=\"Mi siedo.\" onclick=\"act_sitdown(1);\">";
1057 stand = "<table class=\"table_standup\"><tbody><tr>";
1058 for (i = 0 ; i < inpe ; i++) {
1059 stand += "<td>"+nome+"</td>";
1060 if ((i+1) % 4 == 0) {
1061 stand += "</tr><tr>";
1065 $("standup").innerHTML = stand;
1067 // VERIFY: what is this button ?
1068 $("esco").innerHTML = "<input class=\"button\" name=\"logout\" type=\"button\" value=\"Esco.\" onclick=\"act_logout();\" type=\"button\">";
1071 function unescapeHTML(cont) {
1072 var div = document.createElement('div');
1076 div.innerHTML = cont;
1077 if (div.childNodes[0]) {
1078 if (div.childNodes.length > 1) {
1079 if (div.childNodes.toArray)
1082 var length = div.childNodes.length, results = new Array(length);
1084 results[length] = div.childNodes[length];
1086 for (i=0 ; i<results.length ; i++)
1087 memo = memo + results[i].nodeValue;
1093 return (div.childNodes[0].nodeValue);
1101 function playsound(tag, sound) {
1102 // g_withflash is a global var
1104 $(tag).innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
1105 'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" id="mysound" WIDTH=1 HEIGHT=1>' +
1106 '<PARAM NAME="movie" VALUE="../playsound.swf"><PARAM NAME="PLAY" VALUE="true"><PARAM NAME="LOOP" VALUE="false">' +
1107 '<PARAM NAME=FlashVars VALUE="streamUrl='+sound+'">' +
1108 '<EMBED swliveconnect="true" name="mysound" src="../playsound.swf" FlashVars="streamUrl='+sound+'" PLAY="true" LOOP="false" '+
1109 ' WIDTH=1 HEIGHT=1 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT>';
1113 function topbanner_init()
1115 setInterval(topbanner_cb, 666);
1119 function topbanner_cb()
1123 a = $('topbanner').style.backgroundColor;
1124 b = $('topbanner').style.borderLeftColor;
1126 $('topbanner').style.backgroundColor = b;
1127 $('topbanner').style.borderColor = a+" "+a+" "+a+" "+a;
1129 // console.log("A: "+a+" B: "+b);