function srcmarquee(){ this.id = document.getelementbyid(arguments[0]); if(!this.id){this.id = -1;return;} this.direction = this.width = this.height = this.delaytime = this.waittime = this.correct = this.ctl = this.startid = this.stop = this.mouseover = 0; this.step = 1; this.timer = 30; this.directionarray = {"top":0 , "bottom":1 , "left":2 , "right":3}; if(typeof arguments[1] == "number")this.direction = arguments[1]; if(typeof arguments[2] == "number")this.step = arguments[2]; if(typeof arguments[3] == "number")this.width = arguments[3]; if(typeof arguments[4] == "number")this.height = arguments[4]; if(typeof arguments[5] == "number")this.timer = arguments[5]; if(typeof arguments[6] == "number")this.delaytime = arguments[6]; if(typeof arguments[7] == "number")this.waittime = arguments[7]; if(typeof arguments[8] == "number")this.scrollstep = arguments[8] this.id.style.overflow = this.id.style.overflowx = this.id.style.overflowy = "hidden"; this.id.nowrap = true; this.isnotopera = (navigator.useragent.tolowercase().indexof("opera") == -1); if(arguments.length >= 7)this.start(); } srcmarquee.prototype.start = function(){ if(this.id == -1)return; if(this.waittime < 800)this.waittime = 800; if(this.timer < 20)this.timer = 20; if(this.width == 0)this.width = parseint(this.id.style.width); if(this.height == 0)this.height = parseint(this.id.style.height); if(typeof this.direction == "string")this.direction = this.directionarray[this.direction.tostring().tolowercase()]; this.halfwidth = math.round(this.width / 2); this.bakstep = this.step; this.id.style.width = this.width; this.id.style.height = this.height; if(typeof this.scrollstep != "number")this.scrollstep = this.direction > 1 ? this.width : this.height; var msobj = this; var timer = this.timer; var delaytime = this.delaytime; var waittime = this.waittime; msobj.startid = function(){msobj.scroll()} msobj.continue = function(){ if(msobj.mouseover == 1){ settimeout(msobj.continue,delaytime); } else{ clearinterval(msobj.timerid); msobj.ctl = msobj.stop = 0; msobj.timerid = setinterval(msobj.startid,timer); } } msobj.pause = function(){ msobj.stop = 1; clearinterval(msobj.timerid); settimeout(msobj.continue,delaytime); } msobj.begin = function(){ msobj.clientscroll = msobj.direction > 1 ? msobj.id.scrollwidth : msobj.id.scrollheight; if((msobj.direction <= 1 && msobj.clientscroll 1 && msobj.clientscroll 1){ var event = event || window.event; if(window.event){ if(msobj.isnotopera){msobj.eventleft = event.srcelement.id == msobj.id.id ? event.offsetx - msobj.id.scrollleft : event.srcelement.offsetleft - msobj.id.scrollleft + event.offsetx;} else{msobj.scrollstep = null;return;} } else{msobj.eventleft = event.layerx - msobj.id.scrollleft;} msobj.direction = msobj.eventleft > msobj.halfwidth ? 3 : 2; msobj.abscenter = math.abs(msobj.halfwidth - msobj.eventleft); msobj.step = math.round(msobj.abscenter * (msobj.bakstep*2) / msobj.halfwidth); } } msobj.id.onmouseover = function(){ if(msobj.scrollstep == 0)return; msobj.mouseover = 1; clearinterval(msobj.timerid); } msobj.id.onmouseout = function(){ if(msobj.scrollstep == 0){ if(msobj.step == 0)msobj.step = 1; return; } msobj.mouseover = 0; if(msobj.stop == 0){ clearinterval(msobj.timerid); msobj.timerid = setinterval(msobj.startid,timer); }}} settimeout(msobj.begin,waittime); } srcmarquee.prototype.scroll = function(){ switch(this.direction){ case 0: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0){ this.id.scrolltop += this.scrollstep + this.step - this.ctl; this.pause(); return; } else{ if(this.id.scrolltop >= this.clientscroll){this.id.scrolltop -= this.clientscroll;} this.id.scrolltop += this.step; } break; case 1: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0){ this.id.scrolltop -= this.scrollstep + this.step - this.ctl; this.pause(); return; } else{ if(this.id.scrolltop <= 0){this.id.scrolltop += this.clientscroll;} this.id.scrolltop -= this.step; } break; case 2: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0){ this.id.scrollleft += this.scrollstep + this.step - this.ctl; this.pause(); return; } else{ if(this.id.scrollleft >= this.clientscroll){this.id.scrollleft -= this.clientscroll;} this.id.scrollleft += this.step; } break; case 3: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0){ this.id.scrollleft -= this.scrollstep + this.step - this.ctl; this.pause(); return; } else{ if(this.id.scrollleft <= 0){this.id.scrollleft += this.clientscroll;} this.id.scrollleft -= this.step; } break; } }