function scrollBarMoo(containerId,subConteinerId,wrapperId,scrollBarId,scUpId,scDownId){

			var posY = 0;
			var tarY = 0;
			var handlePosY = 0;
			var step = 50;
			var pressInterval = 100;
			var moveInterval = 50;
			var decrease = 0.2;
			var isUpBtnPress = false;
			var isDownBtnPress = false;
			var timerScrollUp = null;
			var timerScrollDown = null;
			var timerScrollMove = null;
			var container = containerId ;
			var subConteiner = subConteinerId;
			var wrapper = wrapperId;
			var isHandleDragging = false;
			var scrollBar = scrollBarId;
			var scrollUpbtn = scUpId;
			var scrollUpbtnHeight = 18;
			var scrollDownbtn = scDownId;
			var scrollDownbtnHeight = 18;
			var scrollBarTop = 198;
			var scrollBarLeft = 755;
			var scrollHandleHeight = 12;
			var scrollBarHeight = 270;
			var scrollBarBackHeight = scrollBarHeight-scrollUpbtnHeight-scrollDownbtnHeight;

			function scrollUp(){
				if(isUpBtnPress){
					tarY+=step;
					if(tarY>0) tarY = 0;
					timerScrollUp = window.setTimeout(scrollUp,pressInterval);
					if(timerScrollMove ==null){
						scrollMove();
					}
				}
			}
			
			this.scrollTop = function(){
					tarY = 0;
					timerScrollUp = window.setTimeout(scrollUp,pressInterval);
					if(timerScrollMove ==null){
						scrollMove();
					}
			}

			function scrollDown(){
				if(isDownBtnPress){
					tarY-=step;
					if(tarY<$(wrapper).getCoordinates().height-$(container).getCoordinates().height) tarY =$(wrapper).getCoordinates().height-$(container).getCoordinates().height;
					timerScrollDown = window.setTimeout(scrollDown,pressInterval);
					if(timerScrollMove ==null){
						scrollMove();
					}
				}
			}

			this.pressBtn = function(n){ //n=0:up n=1:down
				if(n==0){
					isUpBtnPress = true;
					scrollUp();
				}
				if(n==1){
					isDownBtnPress = true;
					scrollDown();
				}
			}

			this.releaseBtn = function(){
				isUpBtnPress = false;
				isDownBtnPress = false;
				clearTimeout(timerScrollUp);
				clearTimeout(timerScrollDown);
			}


			function scrollMove(){
				if($(wrapper).getCoordinates().height<$(container).getCoordinates().height){
					posY += (tarY-posY)*decrease;
					$(container).style.marginTop = posY+'px';
					if(subConteiner!=''){
						$(subConteiner).style.marginTop = posY+'px';
					}
					if(Math.abs(tarY-posY)>0.5){
						timerScrollMove = window.setTimeout(scrollMove,moveInterval);
						if(!isHandleDragging){
							handlePosY = (-1*posY/($(container).getCoordinates().height-$(wrapper).getCoordinates().height))*(scrollBarBackHeight-scrollHandleHeight);
							//$("result").innerHTML =handlePosY;
							$("scHandle").style.top = handlePosY+'px'
						}
					}else{
						posY = tarY;
						$(container).style.marginTop = posY+'px';	
						if(subConteiner!=''){			
							$(subConteiner).style.marginTop = posY+'px';
						}
						timerScrollMove = null;
					}
				}
			}


			function initSc(){
				Event.observe($("scHandle"),"mousedown",scDragStart,false);
				Event.observe($("scHandle"),"mouseup",scDragEnd,false);
				Event.observe(window.document,"mouseup",scDragEnd,false);
				Event.observe(window.document,"mousemove",dispValue,false);
				$("scBack").style.height = scrollBarBackHeight+'px';
			}
			
			function scDragStart(){
				isHandleDragging = true;
			}
			function scDragEnd(){
				isHandleDragging = false;
			}

			function dispValue(event){
				if(isHandleDragging){
						handlePosY = Event.pointerY(event)-scrollBarTop-$(scrollUpbtn)-scrollHandleHeight/2;
						if(handlePosY<0)handlePosY=0;
						if(handlePosY>scrollBarBackHeight-scrollHandleHeight)handlePosY=scrollBarBackHeight-scrollHandleHeight;
						tarY = -1*($(container).getCoordinates().height - $(wrapper).getCoordinates().height)* handlePosY/(scrollBarBackHeight-scrollHandleHeight);
						if(timerScrollMove ==null){
							scrollMove();
						}
						$("result").innerHTML = handlePosY/(scrollBarBackHeight-scrollHandleHeight);
						$("scHandle").style.top = handlePosY+'px';
				}
			}
}




