aggiunta classe hover per le immagini
[brisk.git] / web / commons.js
index 80da0bb..88b97e7 100644 (file)
@@ -60,6 +60,39 @@ function $(id) { return document.getElementById(id); }
            throw Error('setInterval Error\nInvalid function type');
        };
     };
+
+    /*Copy the default setTimeout behavior*/
+    var nativeSetTimeout = window.setTimeout;
+    window.setTimeout = function(fn,ms) {              
+       var param = [];
+       if(arguments.length <= 2)       {
+           return nativeSetTimeout(fn,ms);
+       }
+       else {
+           for(var i=2;i<arguments.length;i+=1) {
+               param[i-2] =  arguments[i];
+           }   
+       }
+       
+       if(typeof(fn)=='function') {
+           
+           return (function (fn,ms,param) {
+               var fo = function () {                                                          
+                   fn.apply(window,param);
+               };                      
+               return nativeSetTimeout(fo,ms); 
+           })(fn,ms,param);
+       }
+       else if(typeof(fn)=='string')
+       {
+           return  nativeSetTimeout(fn,ms);
+       }
+       else
+       {
+           throw Error('setTimeout Error\nInvalid function type');
+       };
+    };
+
 })()
 
     // var card_pos = RANGE 0 <= x < cards_ea_n
@@ -90,7 +123,7 @@ function reset_images()
 
 function update_images()
 {
-    // $("imgct").innerHTML = "Immagini caricate "+g_preload_imgsz_arr[g_imgct]+"%.";
+    $("imgct").innerHTML = "Immagini caricate "+g_preload_imgsz_arr[g_imgct]+"%.";
     if (g_imgct < g_preload_img_arr.length)
        setTimeout(preload_images, 100, g_preload_img_arr, g_imgct);
     g_imgct++;
@@ -666,13 +699,15 @@ function table_init() {
 var chatt_lines = new Array();
 var chatt_lines_n = 0;
 
+var CHATT_MAXLINES = 40;
+
 /* PRO CHATT */
 function chatt_sub(name,str)
 {
   // alert("ARRIVA NAME: "+ name + "  STR:"+str);
-  if (chatt_lines_n == 20) {
+  if (chatt_lines_n == CHATT_MAXLINES) {
     $("txt").innerHTML = "";
-    for (i = 0 ; i < 19 ; i++) {
+    for (i = 0 ; i < (CHATT_MAXLINES - 1) ; i++) {
       chatt_lines[i] = chatt_lines[i+1];
       $("txt").innerHTML += chatt_lines[i];
     }
@@ -771,3 +806,16 @@ function room_checkspace(emme,tables,inpe)
 
     $("esco").innerHTML = "<input name=\"logout\" type=\"button\" value=\"Esco.\" onclick=\"window.onunload = null; act_logout();\" type=\"button\">";
 }
+
+function playsound(tag, sound) {
+   // g_withflash is a global var
+   if (g_withflash) {
+      alert("PLAYSOUND "+sound);
+      $(tag).innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
+'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" id="mysound" WIDTH=1 HEIGHT=1>' +
+'<PARAM NAME="movie" VALUE="playsound.swf"><PARAM NAME="PLAY" VALUE="true"><PARAM NAME="LOOP" VALUE="false">' +
+'<PARAM NAME=FlashVars VALUE="streamUrl='+sound+'">' +
+'<EMBED swliveconnect="true" name="mysound" src="playsound.swf" FlashVars="streamUrl='+sound+'" PLAY="true" LOOP="false" '+
+' WIDTH=1 HEIGHT=1 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT>';
+   }
+}