//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera. 
window.onload=function(){
	function getElement(id){
		return document.getElementById(id);
	}
	var speed=10
	var demo=getElement("demo");
	var demo2=getElement("demo2");
	var demo1=getElement("demo1");
	demo2.innerHTML=demo1.innerHTML//复制demo1中的图片到demo2中
	function Marqueeleft(){//向左滚动
		if(demo2.offsetWidth-demo.scrollLeft<=0)
			demo.scrollLeft-=demo1.offsetWidth
		else
			demo.scrollLeft++
	}
	var MyMar=setInterval(Marqueeleft,speed)//自动开始滚动
	Direction='Left';//设定初始方向为向左滚
	demo.onmouseover=function() {clearInterval(MyMar)}
	demo.onmouseout=function() {
		if(Direction=='Left'){
			MyMar=setInterval(Marqueeleft,speed)
		}else if(Direction=='Right'){
			MyMar=setInterval(Marqueeright,speed)
		}
	};
	getElement('left').onclick=function(){
		clearInterval(MyMar);
		MyMar=setInterval(Marqueeleft,speed)
		Direction='Left';
	};
	getElement('left').onmouseover=function(){
		this.style.opacity=0.3;
		this.style.filter='alpha(opacity=30)';
	}	
	getElement('left').onmouseout=function(){
		this.style.opacity=0.05;
		this.style.filter='alpha(opacity=5)';
	}
}
