<!--
/*MSClass (Class Of Marquee Scroll¨ª¡§¨®?2?????1??¡¥JS¡¤a¡Á¡ã¨¤¨¤) Ver 1.6*\

????¡Á¡Â¨º¡À??:2006-08-29 (Ver 0.5)
??¡¤¡é2?¨º¡À??:2006-08-31 (Ver 0.8)
???¨¹D?¨º¡À??:2007-01-31 (Ver 1.6)
???¨¹D??¦Ì?¡Â: + ?¨®¨¨?1|?¨¹ * DT?y?¡é¨ª¨º¨¦?
	1.6.070131
		+ ???1¨º¨®¡À¨º?????Y¨ª¡ê?¨°?¨¬D? (??¦Ì¨²9??2?¨ºy¨¦¨¨???a-1?¨°???¡¥¨¬??3?¦Ì??ScrollSetp¨¦¨¨???a-1)
		+ ?D??¨º?¡¤??¨¦¨°?1??¡¥ (¨¨??¨²¨¨Y??¨®¨°D?¨®¨²??¨º???¨®¨°,?¨°¡Á??¡¥¨¨???1??¡¥)
		+ ¨¬?1y3?¨º??¡¥¡ä¨ª?¨® (¡À¨¹?a¨°y?e???¨¹1??¡¥¦Ì?¨ª¡ê?1)
		+ ??¨¨??¦Ì (3y¨¨Y?¡ÂID¡À???¨ªa¡ê?????2?¨ºy?¨´?¨¦?¨´?Y?¨¦????DD????¨¦¨¨??)
		+ 2?¨ºy?¡¥¨¬??3?¦Ì (¡¤??¨°?¨¦¨®?¨®¡é??¡À¨ª¨º?top|bottom|left|right,¨º1???¨¹?¡À1??¡é¡¤?¡À?)
		* ??¡Á?1??¡¥2?¡Á?¨¨¡¤ (¡À?¡ä??¨¹D??¡Â¨°a??¦Ì??a??¡ä?Bug,?DD??¨¹?B2?¨®?2a¨º?)
	1.4.061211
		+ ¨º¨®¡À¨ºD¨¹¨ª¡ê??¡À?1??¡¥¡¤??¨° (¨º¨®¡À¨ºD¨¹¨ª¡ê????¡Á¨®¨®¨°1??¡¥)
		* ¨®¨¦¨®¨²??¦Ì¦Ì????1y?y??¦Ì?????¨¨?¦Ì????¨¨/?¨ª?¨¨2?¡Á?¨¨¡¤
		* ?¡¥¨¤¨¤?¡Â??¨¨Y?¨º¨¬a (IE?¡éFF?¡éOpera?¡éNS?¡éMYIE)
	1.2.060922
		+ ???¡§¡¤??¡ì??Da1??¡¥
		* 3¨¬D¨°¦Ì¡Â??
		* ¨¢?D???Da1??¡¥¨ª¡ê?1¦Ì?¡ä¨ª?¨®
	1.0.060901
		+ ?¨°???¡é?¨°¨®¨°1??¡¥
		+ ?a¨º?¦Ì¨¨¡äy¨º¡À??
		+ ¨¢?D?1??¡¥
		* ¦Ì¡Â??¨º¡À??¦Ì£¤??
		* 1??¡¥?¨®2?
		* ???¨²?¨¤?-?¡¤
		* ?¨®??D??¨¹
		* 3¨¬D¨°¨®??¡¥
	0.8.060829
		  ¡¤-?¨¢2??????¨°¨¦??¡é?¨°¡Á¨®1??¡¥

???Y¨º?¦Ì??¡¤:http://www.popub.net/script/MSClass.html
??????¦Ì??¡¤:http://www.popub.net/script/MSClass.js

??¨®|¨®??¦Ì?¡Â:¨°3??¡ã¨¹o?<script type="text/javascript" src="MSClass.js"></script>
	
	¡ä¡ä?¡§¨º¦Ì¨¤y:
		//2?¨ºy?¡À?¨®?3?¦Ì¡¤¡§
		new Marquee("marquee")
		new Marquee("marquee","top")
		......
		new Marquee("marquee",0,1,760,52)
		new Marquee("marquee","top",1,760,52,50,5000)
		......
		new Marquee("marquee",0,1,760,104,50,5000,3000,52)
		new Marquee("marquee",null,null,760,104,null,5000,null,-1)

		//2?¨ºy?¡¥¨¬??3?¦Ì¡¤¡§
		var marquee1 = new Marquee("marquee")	*¡ä?2?¨ºy¡À???
		marquee1.Direction = "top";	?¨°??	marquee1.Direction = 0;
		marquee1.Step = 1;
		marquee1.Width = 760;
		marquee1.Height = 52;
		marquee1.Timer = 50;
		marquee1.DelayTime = 5000;
		marquee1.WaitTime = 3000;
		marquee1.ScrollStep = 52;
		marquee1.Start();

	2?¨ºy?¦Ì?¡Â:
		ID		"marquee"	¨¨Y?¡ÂID		(¡À???)
		Direction	(0)		1??¡¥¡¤??¨°	(?¨¦??,??¨¨??a0?¨°¨¦?1??¡¥) ?¨¦¨¦¨¨??¦Ì??¦Ì¡ã¨¹¨¤¡§:0,1,2,3,"top","bottom","left","right" (0?¨°¨¦? 1?¨°?? 2?¨°¡Á¨® 3?¨°¨®¨°)
		Step		(1)		1??¡¥¦Ì?2?3¡è	(?¨¦??,??¨¨??¦Ì?a2,¨ºy?¦Ì??¡ä¨®,1??¡¥???¨¬)
		Width		(760)		¨¨Y?¡Â?¨¦¨º¨®?¨ª?¨¨	(?¨¦??,??¨¨??¦Ì?a¨¨Y?¡Â3?¨º?¨¦¨¨??¦Ì??¨ª?¨¨)
		Height		(52)		¨¨Y?¡Â?¨¦¨º¨®???¨¨	(?¨¦??,??¨¨??¦Ì?a¨¨Y?¡Â3?¨º?¨¦¨¨??¦Ì????¨¨)
		Timer		(50)		?¡§¨º¡À?¡Â		(?¨¦??,??¨¨??¦Ì?a30,¨ºy?¦Ì??D?,1??¡¥¦Ì??¨´?¨¨???¨¬,1000=1??,?¡§¨°¨¦2?D?¨®¨²20)
		DelayTime	(5000)		??Da¨ª¡ê?¨´?¨®3¨´¨º¡À??(?¨¦??,??¨¨??a02?¨ª¡ê?¨´,1000=1??)
		WaitTime	(3000)		?a¨º?¨º¡À¦Ì?¦Ì¨¨¡äy¨º¡À??(?¨¦??,??¨¨??¨°0?a2?¦Ì¨¨¡äy,1000=1??)
		ScrollStep	(52)		??Da1??¡¥???¨¤	(?¨¦??,??¨¨??a¡¤-?¨¢?¨ª/???¨¨,??¨ºy?¦Ì¨®??¨®3¨´?¨´?a0?¨°?a¨º¨®¡À¨ºD¨¹¨ª¡ê????,-1???1¨º¨®¡À¨º????)
??¨º1¨®??¡§¨°¨¦:
		1?¡é?¡§¨°¨¦?¡À?¨®?3¨®¨¨¨¨Y?¡Â¦Ì???¨º???¨®¨°¦Ì??¨ª?¨¨o¨ª???¨¨¡ê?¨¨?(<div id="marquee" style="width:760px;height:52px;">......</div>)
		2?¡é?¡§¨°¨¦?a¨¨Y?¡Â¨¬¨ª?¨®?¨´¨º?overflow = auto¡ê?¨¨?(<div id="marquee" style="width:760px;height:52px;overflow:auto;">......</div>)
		3?¡é?a¨¢??¨¹¡Á?¨¨¡¤¦Ì???¨¨?1??¡¥??¨®¨°¦Ì??¨ª?¨¨o¨ª???¨¨¡ê??????¨¦?¨¹???¡Â1??¡¥¦Ì£¤???¡À?¨®?3¨®¨¨?y¨¨¡¤?¨ª???¨¨
		4?¡é??¨®¨²TABLE¡À¨º??¦Ì?o¨¢?¨°1??¡¥¡ê?D¨¨¨°a??TABLE¨¬¨ª?¨®?¨´¨º?display = inline¡ê?¨¨?(<div id="marquee" style="width:760px;height:52px;overflow:auto;"><table style="display:inline">......</table></div>)
		5?¡é??¨®¨²¡¤-?¨¢1??¡¥?¨°??Da1??¡¥¡ê?¨°a¡Á¡é¨°a?¡Â1??¡¥¦Ì£¤????¦Ì????¨¤¡ê?¨ª?¨º¡ÀD¨¨¨°a??¨¨Y?¡Â¦Ì??¨¦¨º¨®???¨¨o¨ª?¨¦¨º¨®?¨ª?¨¨¡Á?o?¡Á?¨¨¡¤¦Ì?¨¦¨¨??¡ê???¨®¨²?¡Â1??¡¥¦Ì£¤????¦Ì????¨¤?¨¦¨°?¨ª¡§1y¨¦¨¨??DD???¨¤?¨°??¦Ì£¤?a??¦Ì????¨ª?¨¨¨¤¡ä??DD¦Ì¡Â??
		6?¡é??¨®¨²LI¡Á??¡¥??DD¦Ì??¨º¨¬a?Y¨º¡À??¨®D?¨¹o?¦Ì??a??¡ã¨¬¡¤¡§¡ê??¡§¨°¨¦????¡Áa??3¨¦¡À¨ª??(TABLE)¦Ì?D?¨º?¨¤¡ä¡ä?¦Ì?¨ª?¦Ì¨¨¦Ì?D¡ì1?
		7?¡é????o¨¢?¨°1??¡¥¦Ì???¡Á?????¡ê?¨¨?1?¡Á?????¨º?¨°?????" "?¨¢¨º?¦Ì?¡ê?????????" "¡Áa??3¨¦"&nbsp;"
		8?¡é¨º¨®¡À¨ºD¨¹¨ª¡ê1??¡¥?????¡ä¡Á?Flash¡ê??¨´¨°?¨®D¨°??¡§¦Ì????TD?¡ê¡§¨¨Y?¡Â?¨²???¨ºD¨ª¨®?¨ª???<img>?¨°??¡ä?¨¢¡ä?¨®¦Ì?¨ª???<a><img></a>¦Ì?D?¨º?¡ê?2¡éD¨¨¨°a???1??¡Á??¡¥??DD¡ê?

???D????D?:
	?¨¹?B zhoujun#yuchengtech.com (??¡Á?1??¡¥¨¬?DD¦Ì?bug) 2007/01/31
	¡Á?¡À?3¨¬D¨°¡¤¡é2?¨°?¨¤¡ä¡ê?¨º?¦Ì?2?¨¦¨´?¨®¨®?¦Ì?¨®¨º?t¡ê?¨¬¨¢3?¨¢?o¨¹?¨¤¨°a??o¨ª?¡§¨°¨¦¡ê??DD?¡ä¨®?¨°¦Ì??¡ì3?¡ê?

\***3¨¬D¨°??¡Á¡Â/¡ã?¨¨¡§?¨´¨®D:¡äT¨®¨¤?¨¦(333) E-Mail:zhadan007@21cn.com ¨ª??¡¤:http://www.popub.net***/


function Marquee()
{
	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		alert("?¨²¨°a¨¦¨¨??¦Ì?\"" + arguments[0] + "\"3?¨º??¡¥¡ä¨ª?¨®\r\n???¨¬2¨¦¡À¨º??ID¨¦¨¨??¨º?¡¤??y¨¨¡¤!");
		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" || 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 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 <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step))return;
			msobj.ID.innerHTML += msobj.ID.innerHTML;
			msobj.TimerID = setInterval(msobj.StartID,timer);
			if(msobj.ScrollStep < 0)return;
			msobj.ID.onmousemove = function(event)
						{
							if(msobj.ScrollStep == 0 && msobj.Direction > 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);
}

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;
	}
}
//-->