// ÇÃ·ÎÅÍ


// ÇÃ·ÎÅÍ - ¹üÀ§Á¦ÇÑ
//ex) initMoving("idname",884,500);
function initMoving(id,xleft,ytop) {
	target = document.getElementById(id);
	if (!target) return false;
	var obj = target;
	obj.initLeft = xleft;//Àý´ëÁÂÇ¥x
	obj.initTop = ytop;//Àý´ëÁÂÇ¥y
	obj.bottomLimit = document.documentElement.scrollHeight-300;
	obj.topLimit = 300;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	obj.style.right = obj.left + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {			
			return document.documentElement.scrollTop-50;
		} else if (window.pageYOffset) {
			alert("pageYOffset")
			return window.pageYOffset;
		} else {
			return -100;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight-100;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight-130;
		} else {
			return ;
		}
	}
	obj.move = setInterval(function() {
		//alert("move")
		pos = obj.getTop() + obj.getHeight() / 2 - 15;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 40)
}
