includes/clientside/static/faders.js
changeset 53 3dea509d88ae
parent 38 ed06961e54dd
child 151 824821224153
--- a/includes/clientside/static/faders.js	Sat Jul 07 18:33:21 2007 -0400
+++ b/includes/clientside/static/faders.js	Sat Jul 07 22:54:20 2007 -0400
@@ -380,6 +380,32 @@
     }
 }
 
+var opacityDOMCache = new Object();
+function domOpacity(obj, opacStart, opacEnd, millisec) {
+    //speed for each frame
+    var speed = Math.round(millisec / 100);
+    var timer = 0;
+    
+    // unique ID for this animation
+    var uniqid = Math.floor(Math.random() * 1000000);
+    opacityDOMCache[uniqid] = obj;
+
+    //determine the direction for the blending, if start and end are the same nothing happens
+    if(opacStart > opacEnd) {
+        for(i = opacStart; i >= opacEnd; i--) {
+            setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
+            timer++;
+        }
+    } else if(opacStart < opacEnd) {
+        for(i = opacStart; i <= opacEnd; i++)
+            {
+            setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
+            timer++;
+        }
+    }
+    setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed));
+}
+
 //change the opacity for different browsers
 function changeOpac(opacity, id) {
     var object = document.getElementById(id).style;