// Source code Copyright © vanAnnies.  All Rights Reserved.
// Contact GetTheGhost.com for Licensing
function vanGhostFade(l,s,r,t) { this.layer = null; this.repeat = true; this.steps = null; this.stepndx = 0; this.text = null; this.textndx = 0; this.step = vanGhostFade.step; if(l) this.layer = document.getElementById(l); if(s) this.steps = s; if(r !== undefined) this.repeat = r; if(t) this.text = t; if(this.layer) { /* var s = this.layer.style; s.opacity = 0; s.MozOpacity = 0; s.KhtmlOpacity = 0; s.filter = "alpha(opacity=0)"; */ } } vanGhostFade.createFade = function(tm, hn, hx, sh, mn, mx) { if(tm == null) tm = 1.0; if(hn == null) hn = 0; if(hx == null) hx = 0; if(sh == null) sh = 0; if(mn == null) mn = 0; if(mx == null) mx = 1.0; mn *= 100; mx *= 100; var st = Math.round(vanGhostTimer.getStepsPerSecond() * tm); var inc = (mx-mn) / st; var steps = new Array(); steps[steps.length] = 'x'; for(i = 1; i <= st; i++) { steps[steps.length] = inc * i + mn; } var hdst = Math.round(vanGhostTimer.getStepsPerSecond() * hx); for(i = 0; i < hdst; i++) { steps[steps.length] = mx; } for(i = st-1; i >= 0; i--) { steps[steps.length] = inc * i + mn; } var hdst = Math.round(vanGhostTimer.getStepsPerSecond() * hn); for(i = 0; i < hdst; i++) { steps[steps.length] = mn; } steps = vanGhostAnim.shiftSteps(steps, sh); return steps; }; vanGhostFade.step = function() { var keepgoing = false; if(this.stepndx >= this.steps.length && (!this.text || (this.textndx >= this.text.length)) && !this.repeat) return false; else keepgoing = true; var s = this.layer.style; do { if(this.stepndx >= this.steps.length) this.stepndx = 0; var op = this.steps[this.stepndx]; if(op == 'x') { if(this.text) { if(this.textndx >= this.text.length && this.repeat) this.textndx = 0; this.layer.innerHTML = this.text[this.textndx]; this.textndx++; } } else { s.opacity = (op / 100); s.MozOpacity = (op / 100); s.KhtmlOpacity = (op / 100); s.filter = "alpha(opacity=" + op + ")"; } this.stepndx++; } while (op == 'x'); return keepgoing; }; 
