/* [destoon b2b system] copyright (c) 2008-2013 destoon.com this is not a freeware, use is subject to license.txt */ function dmarquee(lineheight, speed, delay, id) { this.t; this.p = false; this.o = dd(id); this.h = this.o.innerhtml; if(this.h.length < 10) return; this.o.innerhtml = '
'+this.h+'
'; var h1 = number(dd(id).style.height.replace('px', '')); var h2 = dd(id+'_tmp').scrollheight; if(lineheight == -1) return; if(h2*2 <= h1) { this.o.innerhtml = this.h; return; } else if(h2 >= h1) { this.o.innerhtml = this.h + this.h; } else { this.o.innerhtml = this.h + this.h + this.h; } this.o.scrolltop = 0; var _this = this; this.o.onmouseover = function() {_this.p = true;} this.o.onmouseout = function() {_this.p = false;} this.start = function() { this.t = setinterval(function() {_this.scrolling();}, speed); if(!this.p) {this.o.scrolltop += 1;} } this.scrolling = function() { if(this.o.scrolltop%lineheight !=0) { this.o.scrolltop += 1; if(this.o.scrolltop == h2) this.o.scrolltop = 0; } else { clearinterval(this.t); settimeout(function() {_this.start();}, delay); } } settimeout(function() {_this.start();}, delay); } //e.g. new dmarquee(20, 20, 1000, 'id');