var Timer=null;
var ScrollFlag=false;
var X,Y;
var StartHeight=0;
function ScrollUp()
{
	if(ScrollFlag == true) return;
	Note.scrollTop-=1;
	ScrollBar.style.top=Note.scrollTop*220/(Note.scrollHeight-200);;
	window.status=StartHeight;
	Timer=setTimeout("ScrollUp()",10);
}
function ScrollDown()
{
	if(ScrollFlag == true) return;
	Note.scrollTop+=1;
	ScrollBar.style.top=Note.scrollTop*220/(Note.scrollHeight-200);;
	window.status=StartHeight;
	Timer=setTimeout("ScrollDown()",10);
}
function ScrollStop()
{
	if(ScrollFlag == true) return;
	StartHeight = Note.scrollTop*220/(Note.scrollHeight-200);
	clearTimeout(Timer);
	Timer=null;
}
function ScrollStart()
{
	if(document.elementFromPoint(window.event.clientX,window.event.clientY).id!="ScrollBar") return;
	ScrollFlag = true;
	Y=window.event.clientY;
}
function ScrollEnd()
{
	ScrollFlag = false;
	StartHeight= Note.scrollTop*220/(Note.scrollHeight-200);
}
function ScrollMove()
{
	if(ScrollFlag == true)
	{
		var Height = window.event.clientY - Y;
		if (StartHeight + Height>195) Height=195-StartHeight;
		if (StartHeight + Height<0) Height=0-StartHeight;
		ScrollBar.style.top=StartHeight + Height;
		Note.scrollTop=(StartHeight + Height)*(Note.scrollHeight-200)/220;
	}
}
document.onmousedown=ScrollStart;
document.onmouseup=ScrollEnd;
document.onmousemove=ScrollMove;
document.onselectstart=new Function("return false");
