var TOOL	= function () {
	this.top_margin =10;         /// 창의 맨위와의 여백 내려올때
	this.top_margin2 = 100;      /// 창의 맨위와의 여백 올라올때 
	this.speed = 20;            /// 점차 줄어드는 속도를 위한 설정           
	this.speed2 =15;           /// setTimeout을 위한 속도 설정
	this.moving_stat = 1;      /// 메뉴의 스크롤을 로딩시 on/off설정 1=움직임 0은 멈춤 
	this.loop;
}


TOOL.prototype.check_scrollmove	= function (div) {

	var scroll_pixel,div_pixel,gtpos,gbpos,loop,moving_spd;

	var top_menu	= document.getElementById("top_menu");
	var banner_first_height	= top_menu.offsetTop;

	scroll_pixel = document.body.scrollTop;
	gtpos = document.body.scrollTop + tool.top_margin;
	gbpos = document.body.scrollTop + tool.top_margin2;
	var div_id	= document.getElementById(div);

	if(div_id.style.pixelTop < gtpos)
	{ 
		moving_spd = (gbpos - div_id.style.pixelTop)/ tool.speed;
		div_id.style.pixelTop += moving_spd;    
	}
	if(div_id.style.pixelTop > gtpos)
	{
		moving_spd = (div_id.style.pixelTop- gtpos) / tool.speed;
		div_id.style.pixelTop -= moving_spd;
	}

	div_id.style.pixelTop	= div_id.style.pixelTop;

	tool.loop = setTimeout("tool.check_scrollmove('"+div+"')",tool.speed2);
}

TOOL.prototype.moving_control	= function (div) {

	var div_id	= document.getElementById(div);

	if(!tool.moving_stat){ tool.check_scrollmove(div); tool.moving_stat = 1;}
	else{ clearTimeout(tool.loop); tool.moving_stat = 0; div_id.style.pixelTop = tool.top_margin;}
}


var tool	= new TOOL;

