378 timer++; |
378 timer++; |
379 } |
379 } |
380 } |
380 } |
381 } |
381 } |
382 |
382 |
|
383 var opacityDOMCache = new Object(); |
|
384 function domOpacity(obj, opacStart, opacEnd, millisec) { |
|
385 //speed for each frame |
|
386 var speed = Math.round(millisec / 100); |
|
387 var timer = 0; |
|
388 |
|
389 // unique ID for this animation |
|
390 var uniqid = Math.floor(Math.random() * 1000000); |
|
391 opacityDOMCache[uniqid] = obj; |
|
392 |
|
393 //determine the direction for the blending, if start and end are the same nothing happens |
|
394 if(opacStart > opacEnd) { |
|
395 for(i = opacStart; i >= opacEnd; i--) { |
|
396 setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
397 timer++; |
|
398 } |
|
399 } else if(opacStart < opacEnd) { |
|
400 for(i = opacStart; i <= opacEnd; i++) |
|
401 { |
|
402 setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
403 timer++; |
|
404 } |
|
405 } |
|
406 setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed)); |
|
407 } |
|
408 |
383 //change the opacity for different browsers |
409 //change the opacity for different browsers |
384 function changeOpac(opacity, id) { |
410 function changeOpac(opacity, id) { |
385 var object = document.getElementById(id).style; |
411 var object = document.getElementById(id).style; |
386 object.opacity = (opacity / 100); |
412 object.opacity = (opacity / 100); |
387 object.MozOpacity = (opacity / 100); |
413 object.MozOpacity = (opacity / 100); |