﻿// JScript 文件

		function Marquee(){this.ID=document.getElementById(arguments[0]);if(!this.ID){alert("\""+arguments[0]+"\" doesn't exist!");this.ID=-1;return;}this.Direction=this.Width=this.Height=this.DelayTime=this.WaitTime=this.CTL=this.StartID=this.Stop=this.MouseOver=0;this.Step=1;this.Timer=30;this.DirectionArray={"top":0,"up":0,"bottom":1,"down":1,"left":2,"right":3};if(typeof arguments[1]=="number"||typeof arguments[1]=="string"){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();}}Marquee.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.HalfHeight=Math.round(this.Height/2);this.BakStep=this.Step;this.ID.style.width=this.Width+"px";this.ID.style.height=this.Height+"px";if(typeof this.ScrollStep!="number"){this.ScrollStep=this.Direction>1?this.Width:this.Height;}var _1="<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;display:inline;'><tr><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td></tr></table>";var _2="<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;'><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>";var _3=this;_3.tempHTML=_3.ID.innerHTML;if(_3.Direction<=1){_3.ID.innerHTML=_2.replace(/MSCLASS_TEMP_HTML/g,_3.ID.innerHTML);}else{if(_3.ScrollStep==0&&_3.DelayTime==0){_3.ID.innerHTML+=_3.ID.innerHTML;}else{_3.ID.innerHTML=_1.replace(/MSCLASS_TEMP_HTML/g,_3.ID.innerHTML);}}var _4=this.Timer;var _5=this.DelayTime;var _6=this.WaitTime;_3.StartID=function(){_3.Scroll();};_3.Continue=function(){if(_3.MouseOver==1){setTimeout(_3.Continue,_5);}else{clearInterval(_3.TimerID);_3.CTL=_3.Stop=0;_3.TimerID=setInterval(_3.StartID,_4);}};_3.Pause=function(){_3.Stop=1;clearInterval(_3.TimerID);setTimeout(_3.Continue,_5);};_3.Begin=function(){_3.ClientScroll=_3.Direction>1?_3.ID.scrollWidth/2:_3.ID.scrollHeight/2;if((_3.Direction<=1&&_3.ClientScroll<=_3.Height+_3.Step)||(_3.Direction>1&&_3.ClientScroll<=_3.Width+_3.Step)){_3.ID.innerHTML=_3.tempHTML;delete(_3.tempHTML);return;}delete(_3.tempHTML);_3.TimerID=setInterval(_3.StartID,_4);if(_3.ScrollStep<0){return;}_3.ID.onmousemove=function(_7){if(_3.ScrollStep==0&&_3.Direction>1){var _7=_7||window.event;if(window.event){if(_3.IsNotOpera){_3.EventLeft=_7.srcElement.id==_3.ID.id?_7.offsetX-_3.ID.scrollLeft:_7.srcElement.offsetLeft-_3.ID.scrollLeft+_7.offsetX;}else{_3.ScrollStep=null;return;}}else{_3.EventLeft=_7.layerX-_3.ID.scrollLeft;}_3.Direction=_3.EventLeft>_3.HalfWidth?3:2;_3.AbsCenter=Math.abs(_3.HalfWidth-_3.EventLeft);_3.Step=Math.round(_3.AbsCenter*(_3.BakStep*2)/_3.HalfWidth);}};_3.ID.onmouseover=function(){if(_3.ScrollStep==0){return;}_3.MouseOver=1;clearInterval(_3.TimerID);};_3.ID.onmouseout=function(){if(_3.ScrollStep==0){if(_3.Step==0){_3.Step=1;}return;}_3.MouseOver=0;if(_3.Stop==0){clearInterval(_3.TimerID);_3.TimerID=setInterval(_3.StartID,_4);}};};setTimeout(_3.Begin,_6);};Marquee.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;}}