/*** 스크롤배너 객체 ***/
var scrollBanner = (function(){function _class(id)
{	
	var obj;	// 스크롤되는 객체
	var marginTop;	// area pixelTop
	var areaHeight;	// area Height
	var iciHeight;	// box Height
	var _self = this;
	var ismove = 0;

	this.init = function(){
		ismove = 1;
		obj = document.getElementById(id);
		obj.style.position = "absolute";
		marginTop = $j("#"+id).offset().top;
		areaHeight = $j("#"+id).parent().parent().height();
		iciHeight = $j("#"+id).height();
		this.move();
	}
	this.move = function(){
		if (!ismove) return;

		var posFrom, posTo, gap, timedelay;
		timedelay = 10;
		posFrom	= obj.style.pixelTop;
		var t = document.documentElement.scrollTop;
		posTo = (t<marginTop) ? 0 : t - marginTop + 10;
		if (posTo>areaHeight-iciHeight) posTo = areaHeight - iciHeight;
		if (posTo<0) posTo = 0;

		if (posFrom != posTo){
			gap = Math.ceil(Math.abs(posTo - posFrom) / 10);
			if (posTo < posFrom) gap = -gap;
			obj.style.top = obj.style.pixelTop + gap;
			timedelay = 0;
		}		
		setTimeout (_self.move, timedelay);
	}
	this.setmove = function(val){
		ismove = val;
		if (val) this.move();
		//clearTimeout (_self.move, timed);
	}
	this.init();
};
return _class;
})();
