function Marquee(container, width, height, pageDelay, direction){
	var inner1;
	var inner2;
	var timer;
	var isInit = false;
	if (typeof container == "string"){
		this.container = document.getElementById(container);
	}
	else if(typeof container == "object"){
		this.container = container;
	}
	else{
		alert("参数(container)只能是string或object");
		return;
	}
	this.amount = 1;
	this.delay = 100;
	this.width = width;
	this.height = height;
	this.mouseAction = true;
	this.pageDelay = pageDelay;
	this.direction = direction; // up , left
	this.init = function(){
		var id = this.container.id;
		if (typeof this.width != "undefined"){
			this.container.style["width"] = this.width + "px";
		}
		if (typeof this.height != "undefined"){
			this.container.style["height"] = this.height + "px";
		}
		this.container.style["overflow"] = "hidden";
		if (this.direction == "left"){
			this.container.innerHTML = '<table border="0" cellspacing="0" cellpadding="0"><tr><td id="' + id + '_inner1">' + this.container.innerHTML + '</td><td id="' + id + '_inner2"></td></tr></table>';
		}
		else{
			this.container.innerHTML = '<div id="' + id + '_inner1">' + this.container.innerHTML + '</div>' + '<div id="' + id + '_inner2"></div>';
		}
		inner1 = document.getElementById(id + "_inner1");
		inner2 = document.getElementById(id + "_inner2");
		inner2.innerHTML = inner1.innerHTML;
		if (this.mouseAction){
			var _this = this;
			this.container.onmouseover = function(){
				clearInterval(timer);
			};
			this.container.onmouseout = function(){
				_this.start();
			}; 
		}
	};
	this.start = function(){
		if (!isInit){
			this.init();
			isInit = true;
		}
		if (this.direction == "left"){
			if (inner2.offsetWidth - this.container.scrollLeft <= 0){
				this.container.scrollLeft -= inner1.offsetWidth;
			}
			else{
				this.container.scrollLeft += this.amount;
			}
		}
		else{
			if (inner2.offsetHeight - this.container.scrollTop <= 0){
				this.container.scrollTop -= inner1.offsetHeight;
			}
			else{
				this.container.scrollTop += this.amount;
			}	
		}				
		var _this = this;
		var _start = this.start;
		if (typeof this.pageDelay != "undefined"){
			if (this.direction == "left"){
				var _width;
				if (this.container.style["width"]){
					_width = parseInt(this.container.style["width"]);
				}
				else{
					if (this.container.currentStyle){
						_width = parseInt(this.container.currentStyle["width"]);
					}
					else{
						_width = parseInt(document.defaultView.getComputedStyle(this.container, null).getPropertyValue("width"));
					}					
				}
				if (this.container.scrollLeft % _width == 0){
					timer = setTimeout(function(){_start.call(_this)}, this.pageDelay);
				}
				else{
					timer = setTimeout(function(){_start.call(_this)}, this.delay);
				}
			}
			else{
				var _height;
				if (this.container.style["height"]){
					_height = parseInt(this.container.style["height"]);
				}
				else{
					if (this.container.currentStyle){
						_height = parseInt(this.container.currentStyle["height"]);
					}
					else{
						_height = parseInt(document.defaultView.getComputedStyle(this.container, null).getPropertyValue("height"));
					}
				}
				if (this.container.scrollTop % _height == 0){
					timer = setTimeout(function(){_start.call(_this)}, this.pageDelay);
				}
				else{
					timer = setTimeout(function(){_start.call(_this)}, this.delay);
				}
			}
		}
		else{
			timer = setTimeout(function(){_start.call(_this)}, this.delay);
		}
	};
}