/*
=================== 版　权　声　明 ===================
模块设计: Landers 	QQ:13582702　Email：13582702@qq.com
模块特点：可以在一同页使用多个移动块，由于使用类设计，有效地避免变量命名的冲突问题
	如果您在使用过程有什么好的意见或建议，请发Email给作者。
	本模块您可以任意复制、传播、修改，但修改后麻烦请转发一份至 13582702@qq.com，谢谢合作！
	限于作者水平，如有不足之处，还望高手指点


=================== 使　用　范　例 ===================
详见ScrollDemo.htm代码及注释说明
*/


function LoopScroll(ObjScroll,ScrollWidth,ScrollHeight,Delay,IsPause,PauseDelay){
	ObjScroll.style.width 	= ScrollWidth 
	ObjScroll.style.height	= ScrollHeight
	sContent = ObjScroll.innerHTML
	var tmpPos = sContent.indexOf(">")
	sContent = sContent.substring(tmpPos+1,sContent.length)
	var DivName			= "LandersLoopScroll"
	var DivCount		= 0
	while (document.getElementsByName(DivName+DivCount).length != 0 ){	DivCount++;}
	DivName = DivName+DivCount
	sContent  = "<div id='" + DivName + "' style='width:" + ScrollWidth + "px; overflow:hidden; height:" + ScrollHeight + "px;'><table cellpadding=0 cellspacing=0 border=0><tr><td id='"+ DivName +"1'>" + sContent + "</td><td id='" + DivName + "2'></td></tr><tr><td id='" + DivName + "3'></td><td> </td></tr></table>"
	ObjScroll.innerHTML = sContent

	var MoveDiv			= document.getElementById(DivName)
	var MoveDiv1		= document.getElementById(DivName+"1")
	var MoveDiv2		= document.getElementById(DivName+"2")
	var MoveDiv3		= document.getElementById(DivName+"3")
	MoveDiv2.innerHTML	= MoveDiv1.innerHTML
	MoveDiv3.innerHTML	= MoveDiv1.innerHTML
	
	var ScrollTimerID
	MoveDiv.onmouseover = function(){clearInterval(ScrollTimerID)}
	this.MoveLeft	= function(){ GoLeft()	 ;MoveDiv.onmouseout = function(){ GoLeft() ;}}
	this.MoveRight	= function(){ GoRight();MoveDiv.onmouseout = function(){ GoRight();}}
	this.MoveUp		= function(){ GoUp()	 ;MoveDiv.onmouseout = function(){ GoUp()	  ;}}
	this.MoveDown	= function(){ GoDown()	 ;MoveDiv.onmouseout = function(){ GoDown() ;}}
	function GoUp(){ScrollTimerID = setInterval(MoveUpAction,Delay)}
	function MoveUpAction(){
		if(MoveDiv3.offsetTop-MoveDiv.scrollTop<=0){
			MoveDiv.scrollTop-=MoveDiv1.offsetHeight;
			if(IsPause){clearInterval(ScrollTimerID);	setTimeout(GoUp,PauseDelay)}
		}else
			MoveDiv.scrollTop++;
	}
	function GoDown(){ScrollTimerID = setInterval(MoveDownAction,Delay)}
	function MoveDownAction(){
		if(MoveDiv1.offsetTop-MoveDiv.scrollTop>=0){
			MoveDiv.scrollTop+=MoveDiv3.offsetHeight;
			if(IsPause){clearInterval(ScrollTimerID);setTimeout(GoDown,PauseDelay)}
		}else
			MoveDiv.scrollTop--;
	}
	function GoLeft(){ScrollTimerID = setInterval(MoveLeftAction,Delay)}
	function MoveLeftAction(){
		if(MoveDiv2.offsetWidth-MoveDiv.scrollLeft<=0){
			MoveDiv.scrollLeft-=MoveDiv1.offsetWidth
			if(IsPause){clearInterval(ScrollTimerID);setTimeout(GoLeft,PauseDelay)}
		}else
			MoveDiv.scrollLeft++
	}
	function GoRight(){ScrollTimerID = setInterval(MoveRightAction,Delay)}
	function MoveRightAction(){
		if(MoveDiv.scrollLeft<=0){
			MoveDiv.scrollLeft+=MoveDiv2.offsetWidth
			if(IsPause){clearInterval(ScrollTimerID);setTimeout(GoRight,PauseDelay)}
		}else
			MoveDiv.scrollLeft--
	}
}


function NoHtmlTags(arrTags,str){
	var re,Ret
	Ret=str
	for (i=0;i<=arrTags.length-1;i++){
		re = new RegExp("<("+arrTags[i]+")[^>]*>.*?|","gi");
		Ret = Ret.replace(re,"");
		re = new RegExp("</"+arrTags[i]+">" ,"gi");
		Ret = Ret.replace(re,"");
	}
	return Ret
}