<!--


function AutoRolling(canvas,width,height,direction,pixelgap,timegap,idlegap) {
	this.canvas = canvas;
	if(!this.canvas) return;
	this.box = document.getElementById(this.canvas +"_list");
	if(!this.box) return;
	if(!this.box.hasChildNodes()) return;
	if(!this.box.childNodes.length) return;
	this.width = width; //Äµ¹ö½º ³Êºñ
	this.height = height; //Äµ¹ö½º ³ôÀÌ
	this.direction = direction;	//½ºÅ©·Ñ ¹æÇâ ÁÂÃø(0), ¿ìÃø(1), À§·Î(2), ¾Æ·¡(3)
	this.pixelgap = pixelgap; //ÇÈ¼¿ ÀÌµ¿¼Óµµ 
	this.timegap = timegap; //ÀÌµ¿±×·ì ½ºÅ©·Ñ ¼Óµµ
	this.idlegap = idlegap; //´ÙÀ½ ÀÌµ¿±×·ì°úÀÇ Áö¿¬½Ã°£
	this.box.style.width = this.width + "px";
	this.box.style.height = this.height + "px";
	this.box.style.overflow = "hidden";
	this.setTimeOut = null;
	this.current = null;
	this.next = null;
	this.status = "play"; //µ¿ÀÛ»óÅÂ: Àç»ý(play), Á¤Áö(pause)
	this.Init();
	this.Run();
}

AutoRolling.prototype = {
	Init: function() {
		var obj = this;
		var btn_play = document.getElementById("btn_"+ this.canvas +"_play");
		var btn_prev = document.getElementById("btn_"+ this.canvas +"_prev");
		var btn_next = document.getElementById("btn_"+ this.canvas +"_next");
		if(btn_play) btn_play.onmousedown = btn_play.onkeypress = function() { if(obj.status == "pause") { obj.Play(); } else { obj.Pause(); } }
		if(btn_prev) btn_prev.onmousedown = btn_prev.onkeypress = function() { obj.Prev(); }
		if(btn_next) btn_next.onmousedown = btn_next.onkeypress = function() { obj.Next(); }
		this.box.onmouseover = this.box.onfocus = function() { obj.Pause(); }
		this.box.onmouseout = this.box.onblur = function() { obj.Play(); }
		this.box.style.position = "absolute";
		for(var i = 0; i < this.box.childNodes.length; i++) {
			this.box.childNodes[i].style.position = "absolute";
			if(i > 0) {
				this.box.childNodes[i].style.top = (this.box.childNodes[i-1].offsetTop + this.box.childNodes[i-1].offsetHeight) + "px";
//			} else {
//				this.box.childNodes[i].style.top = "0px";
			}
			if(i == (this.box.childNodes.length - 1)) this.box.childNodes[i].style.top = -this.box.childNodes[i].offsetHeight + "px";
		}
	},
	Pause: function() {
		var obj = this;
		window.clearTimeout(this.setTimeOut);
		var img_play = document.getElementById("img_"+ this.canvas +"_play");
		if(img_play) {
			img_play.src = img_play.src.replace("_stop","_play");
			img_play.alt = "Àç»ýÇÏ±â";
		}
		this.status = "pause";
	},
	Play: function() {
		var obj = this;
		this.setTimeOut = window.setTimeout(function() { obj.Run(); },this.timegap);
		var img_play = document.getElementById("img_"+ this.canvas +"_play");
		if(img_play) {
			img_play.src = img_play.src.replace("_play","_stop");
			img_play.alt = "ÀÏ½ÃÁ¤ÁöÇÏ±â";
		}
		this.status = "play";
	},
	Prev: function() {
		var obj = this;
		if(this.current == null) { this.current = this.box.childNodes.length - 1; }
		window.clearTimeout(this.setTimeOut);
		var child_height = this.box.childNodes[0].offsetHeight;
		var child_top = parseInt(this.box.childNodes[0].offsetTop / child_height);
		if(parseInt(this.box.childNodes[0].offsetTop % child_height) == 0) {
			child_top++;
		} else {
			if(this.box.childNodes[0].offsetTop > 0) child_top++;
		}
		child_top = child_height * child_top;
		for(var i = 0; i < this.box.childNodes.length; i++) {
			if(i > 0) child_top += child_height;
			if(child_top >= (child_height * (this.box.childNodes.length - 1))) {
				child_top = -child_height;
			} else if(child_top < -child_height) {
				child_top = child_height * (this.box.childNodes.length - 2);
			}
			this.box.childNodes[i].style.top = child_top;
		}
		if(this.box.childNodes[this.current].offsetTop >= 0) {
			this.current = (this.current - 1 < 0) ? this.box.childNodes.length - 1 : this.current - 1;
		}
		this.Pause();
	},
	Next: function() {
		var obj = this;
		var child_height = this.box.childNodes[0].offsetHeight;
		var child_top = parseInt(this.box.childNodes[0].offsetTop / child_height);
		if(parseInt(this.box.childNodes[0].offsetTop % child_height) == 0) {
			child_top--;
		} else {
			if(this.box.childNodes[0].offsetTop < 0) child_top--;
		}
		child_top = child_height * child_top;
		for(var i = 0; i < this.box.childNodes.length; i++) {
			if(i > 0) child_top += child_height;
			if(child_top >= (child_height * (this.box.childNodes.length - 1))) {
				child_top = -child_height;
			} else if(child_top < -child_height) {
				child_top = child_height * (this.box.childNodes.length - 2);
			}
			this.box.childNodes[i].style.top = child_top;
		}
		this.next = (this.current + 1 >= this.box.childNodes.length) ? 0 : this.current + 1;
		if(this.box.childNodes[this.next].offsetTop <= 0) {
			this.current = (this.current + 1 >= this.box.childNodes.length) ? 0 : this.current + 1;
		}
		this.Pause();
	},
	Run: function() {
		var obj = this;
		if(this.current == null) { this.current = this.box.childNodes.length - 1; }
		window.clearTimeout(this.setTimeOut);
		for(var i = 0; i < this.box.childNodes.length; i++) {
			this.box.childNodes[i].style.top = (this.box.childNodes[i].offsetTop - this.pixelgap) + "px";
		}
		this.next = (this.current + 1 >= this.box.childNodes.length) ? 0 : this.current + 1;
		if(this.box.childNodes[this.next].offsetTop <= 0) {
			var nextPosition = 0;
			for(var i = 1; i < this.box.childNodes.length; i++) {
				nextPosition += this.box.childNodes[i].offsetHeight;
			}
			this.box.childNodes[this.current].style.top = nextPosition + "px";
			this.current = (this.current + 1 >= this.box.childNodes.length) ? 0 : this.current + 1;
			this.setTimeOut = window.setTimeout(function () { obj.Run(); },this.idlegap);
		} else {
			this.setTimeOut = window.setTimeout(function () { obj.Run(); },this.timegap);
		}
		this.status = "play";
	}
}

//-->