public barbuttonY
public toolbarY
public toolbarX
public toolbarheight
public toolbarwidth
public IsDrag
public IsScroll
public DispToolbarLeft
public DispToolbarTop
public toolbarIsShow
public movestepX
public movestepY
public i

sub startscroll()
	BarButton.style.overflow="hidden"
	barbuttonY=window.event.y - Cint(mid(BarButton.style.top,1,len(BarButton.style.top)-2))
	IsScroll=true
end sub

sub stopscroll()
	IsScroll=false
end sub

sub ScrollBarButton()
	dim tempY
	if IsScroll=true then
		tempY=window.event.y-barbuttonY
		if tempY<0 then tempY=0
		if tempY>472-30 then tempY=472-30
		BarButton.style.top=tempY
	end if
end sub

sub startDrag()
	toolbar.style.overflow="hidden"
	toolbarheight=Cint(mid(toolbar.style.height,1,len(toolbar.style.height)-2))
	toolbarwidth=Cint(mid(toolbar.style.width,1,len(toolbar.style.width)-2))
	toolbarY=window.event.y - Cint(mid(toolbar.style.top,1,len(toolbar.style.top)-2))
	toolbarX=window.event.x-Cint(mid(toolbar.style.left,1,len(toolbar.style.left)-2))
	IsDrag=true
end sub

sub stopDrag()
	IsDrag=false
end sub

sub ToolbarDrag()
	dim tempY
	dim tempX
	if IsDrag=true then
		tempY=window.event.y-toolbarY
		tempX=window.event.x-toolbarX
		if tempY<30 then tempY=30
		if tempY>502-toolbarheight then tempY=502-toolbarheight
		if tempX<0 then tempX=0
		if tempX>765-toolbarwidth then tempX=765-toolbarwidth
		toolbar.style.top=tempY
		toolbar.style.left=tempX		
	end if
end sub

sub movetoolbar(openorclose)
	if i<=5 then
		if openorclose="close" then
			toolbar.style.left=Cint(mid(toolbar.style.left,1,len(toolbar.style.left)-2))-movestepX
			toolbar.style.top=Cint(mid(toolbar.style.top,1,len(toolbar.style.top)-2))-movestepY
			toolbar.style.width=Cint(mid(toolbar.style.width,1,len(toolbar.style.width)-2))-28
			toolbar.style.height=Cint(mid(toolbar.style.height,1,len(toolbar.style.height)-2))-28
			setTimeout "movetoolbar 'close'",3,"vbs"
		else
			toolbar.style.left=Cint(mid(toolbar.style.left,1,len(toolbar.style.left)-2))+movestepX
			toolbar.style.top=Cint(mid(toolbar.style.top,1,len(toolbar.style.top)-2))+movestepY
			toolbar.style.width=Cint(mid(toolbar.style.width,1,len(toolbar.style.width)-2))+28
			toolbar.style.height=Cint(mid(toolbar.style.height,1,len(toolbar.style.height)-2))+28
			setTimeout "movetoolbar 'open'",3,"vbs"
		end if
		i=i+1
	else
		if openorclose="close" then
			toolbar.style.left=765
			toolbar.style.top=0
			toolbar.style.width=1
			toolbar.style.height=1
			toolbar.style.display="none"
			toolbarIsShow=false			
		else
			toolbar.style.left=DispToolbarLeft
			toolbar.style.top=DispToolbarTop
			toolbar.style.width=140
			toolbar.style.height=140
			TheDocument.style.display=""
			toolbar.style.backgroundColor=rgb(200,200,200)
			toolbarIsShow=true					
		end if
	end if	
end sub

sub closetoolbar()
	DispToolbarLeft=Cint(mid(toolbar.style.left,1,len(toolbar.style.left)-2))
	DispToolbarTop=Cint(mid(toolbar.style.top,1,len(toolbar.style.top)-2))
	movestepX=Cint((DispToolbarLeft-765)/5)
	movestepY=Cint(DispToolbarTop/5)
	toolbar.style.backgroundColor="LemonChiffon"
	TheDocument.style.display="none"
	i=1
	setTimeout "movetoolbar 'close'",2,"vbs"
end sub

sub opentoolbar()
	movestepX=Cint((DispToolbarLeft-765)/5)
	movestepY=Cint(DispToolbarTop/5)
	toolbar.style.display=""
	i=1
	setTimeout "movetoolbar 'open'",2,"vbs"
end sub

sub xtoolbar()
	if toolbarIsShow=true then
		closetoolbar
	else
		opentoolbar
	end if
end sub

sub inittoolbar()
	DispToolbarLeft=625
	DispToolbarTop=365
	'opentoolbar
end sub

