Function TestW3DButton(Bn)
	HD=PeekInt(W3DButton_Bank,(BN-1)*4)
	If HD=0 Then Return 0
	lx=PeekInt(HD,0)
	rx=PeekInt(hd,4)
	oy=PeekInt(hd,8)
	uy=PeekInt(hd,12)
	Buttonred=ColorRed()
	Buttongreen=ColorGreen()
	Buttonblue=ColorBlue()
	If MouseX()>lx And MouseX()<rx And MouseY()>oy And MouseY()<uy Then
		x=PeekInt(hd,16)
		y=PeekInt(hd,20)
		Button_Width=rx-lx
		Button_Height=uy-oy
		If Button_Width<=240 Then
			DrawImageRect W3DButton,lx,oy,240,0,Button_Width-2,23
			DrawImageRect W3DButton,lx+Button_Width-2,oy,478,0,2,23
		Else
			If Button_Width<=476 Then
				Rest=Button_Width-238
				DrawImageRect W3DButton,lx,oy,240,0,238,23
				DrawImageRect W3DButton,lx+238,oy,480-Rest,0,Rest,23
			Else
				Rest=Button_Width-238
				DrawImageRect W3DButton,lx,oy,240,0,238,23
				sPos=2
				While Rest=>236
					Rest=Rest-236
					sPos=sPos+236
					DrawImageRect W3DButton,lx+sPos,oy,242,0,236,23
				Wend
				DrawImageRect W3DButton,lx+sPos+236,oy,480-Rest,0,Rest,23
			EndIf
		EndIf
		Color 0,0,0
		Text x,y,PeekShortString(hd,24),True,True
		W3DButtonFlag=Bn
		If MouseDown(1) Then
			While MouseDown(1) Wend
			Delay 50
			Color Buttonred,Buttongreen,Buttonblue
			Return bn
		EndIf
	EndIf
	Color Buttonred,Buttongreen,Buttonblue
	Return 0
End Function
;+ PeekShortString