Dim WebPageBarHeight
Dim WebPageBarVisible

Sub Window_OnInit()
	window.minWidth = 600
	window.minHeight = 0
	FindReBar.visible = false
	ElementExtractBar.visible = false
	WebPageBarHeight = 0
End Sub

Sub Window_OnNotify(code ,var)
	if(code = 70200) Then
		switch = var.GetDWord("dwExtractElementSwitch")
		
		if(CInt(switch) = 0)then
			ElementExtractBar.visible = false
		elseif(CInt(switch) = 1) then
			ElementExtractBar.visible = true
			ElementType = CInt(var.GetDWord("dwExtractElementType"))
			OnExtractElement(ElementType)
		elseif(CInt(switch) = 2) then
			if(ElementExtractBar.visible = false)then
				ElementExtractBar.visible = true
			else
				ElementExtractBar.visible = false
			end if
		end if	
		WindowLayOut()
		var.SetDWord  "dwWebPageBarVisible" , (WebPageBarVisible)
	elseif(code = 70210) then 
		switch = CInt(var.GetDWord("dwFindBarSwitch"))
		if(CInt(switch) = 1)then
			FindReBar.visible = true	
		else
			FindReBar.visible = false	
		end if
		WindowLayOut()	
		var.SetDWord  "dwWebPageBarVisible" , (WebPageBarVisible)
	elseif(code = 70211) Then
		btnFindResult.Label = var
		WindowLayOut()		
	elseif(code = 70250) then 
		WebPageBarWidth = var.GetDWord("dwWebPageBarWidth")
		FindReBar.width = WebPageBarWidth
		ElementExtractBar.width = WebPageBarWidth	
		var.SetDWord  "dwWebPageBarHeight" , (WebPageBarHeight)
		WindowLayOut()
	end if
End Sub

sub WindowLayOut()	
	Window.LockPaint()
	
	WebPageBarHeight = 0
	WebPageBarVisible = 0
	
	if(FindReBar.visible = true)then
		WebPageBarHeight = WebPageBarHeight + FindReBar.height
		FindBorderIMG.Width = 	FindReBar.width
		WebPageBarVisible = 1
	end if
	
	if(ElementExtractBar.visible = true)then
		ElementExtractBar.top = WebPageBarHeight
		ElementExtractBarIMG.width = ElementExtractBar.width 
		ElementExtractBarIMG.height = ElementExtractBar.height	
		WebPageBarHeight = WebPageBarHeight + ElementExtractBar.height	
		WebPageBarVisible = 1
	end if
	
	Window.UnLockPaint()
end sub	

sub btnFindClose_onClick()
	a = 1	
	Window.ExeCommand 44013 , a
End Sub

sub btnFindPre_onClick()
	a = 3	
	Window.ExeCommand 44013 , a
End Sub

sub btnFindNext_onClick()
	a = 4
	Window.ExeCommand 44013 , a
End Sub

sub btnFindResult_onClick()
	a = 5
	Window.ExeCommand 44013 , a
End Sub

sub btnOriginal_onClick()
	a = 0
	btnOriginal.image = "ButtonDownBK.bmp"
	btnOriginal.LabelFontWeight = 500
	btnText.image = "BarBK.bmp"
	btnText.LabelFontWeight = 400	
	btnImage.image = "BarBK.bmp"
	btnImage.LabelFontWeight = 400	
	btnMedia.image = "BarBK.bmp"
	btnMedia.LabelFontWeight = 400	
	btnFlash.image = "BarBK.bmp"	
	btnFlash.LabelFontWeight = 400	
	Window.ExeCommand 44014 , a
End Sub

sub btnText_onClick()
	a = 1
	btnOriginal.image = "BarBK.bmp"
	btnOriginal.LabelFontWeight = 400	
	btnText.image = "ButtonDownBK.bmp"
	btnText.LabelFontWeight = 500	
	btnImage.image = "BarBK.bmp"
	btnImage.LabelFontWeight = 400	
	btnMedia.image = "BarBK.bmp"
	btnMedia.LabelFontWeight = 400	
	btnFlash.image = "BarBK.bmp"	
	btnFlash.LabelFontWeight = 400	
	Window.ExeCommand 44014 , a
End Sub

sub btnImage_onClick()
	a = 2
	btnOriginal.image = "BarBK.bmp"
	btnOriginal.LabelFontWeight = 400	
	btnText.image = "BarBK.bmp"
	btnText.LabelFontWeight = 400	
	btnImage.image = "ButtonDownBK.bmp"
	btnImage.LabelFontWeight = 500		
	btnMedia.image = "BarBK.bmp"
	btnMedia.LabelFontWeight = 400		
	btnFlash.image = "BarBK.bmp"		
	btnFlash.LabelFontWeight = 400		
	Window.ExeCommand 44014 , a
End Sub

sub btnFlash_onClick()
	a = 3
	btnOriginal.image = "BarBK.bmp"
	btnOriginal.LabelFontWeight = 400	
	btnText.image = "BarBK.bmp"
	btnText.LabelFontWeight = 400	
	btnImage.image = "BarBK.bmp"
	btnImage.LabelFontWeight = 400	
	btnFlash.image = "BarBK.bmp"	
	btnFlash.LabelFontWeight = 500	
	btnMedia.image = "ButtonDownBK.bmp"
	btnMedia.LabelFontWeight = 400	
	Window.ExeCommand 44014 , a
End Sub

sub btnMedia_onClick()
	a = 4
	btnOriginal.image = "BarBK.bmp"
	btnOriginal.LabelFontWeight = 400	
	btnText.image = "BarBK.bmp"
	btnText.LabelFontWeight = 400		
	btnImage.image = "BarBK.bmp"
	btnImage.LabelFontWeight = 400	
	btnFlash.image = "ButtonDownBK.bmp"		
	btnFlash.LabelFontWeight = 400		
	btnMedia.image = "BarBK.bmp"
	btnMedia.LabelFontWeight = 500		
	Window.ExeCommand 44014 , a
End Sub

sub btnExtractClose_onClick()
	a = 7
	Window.ExeCommand 44014 , a	
	ElementExtractBar.visible = false
End Sub

sub OnExtractElement(var)
	If(var = 0)then
		btnOriginal.image = "ButtonDownBK.bmp"
		btnOriginal.LabelFontWeight = 500
		btnText.image = "BarBK.bmp"
		btnText.LabelFontWeight = 400	
		btnImage.image = "BarBK.bmp"
		btnImage.LabelFontWeight = 400	
		btnMedia.image = "BarBK.bmp"
		btnMedia.LabelFontWeight = 400	
		btnFlash.image = "BarBK.bmp"	
		btnFlash.LabelFontWeight = 400		
	elseif(var = 1)then
		btnOriginal.image = "BarBK.bmp"
		btnOriginal.LabelFontWeight = 400	
		btnText.image = "ButtonDownBK.bmp"
		btnText.LabelFontWeight = 500	
		btnImage.image = "BarBK.bmp"
		btnImage.LabelFontWeight = 400	
		btnMedia.image = "BarBK.bmp"
		btnMedia.LabelFontWeight = 400	
		btnFlash.image = "BarBK.bmp"	
		btnFlash.LabelFontWeight = 400			
	elseif(var = 2)then	
		btnOriginal.image = "BarBK.bmp"
		btnOriginal.LabelFontWeight = 400	
		btnText.image = "BarBK.bmp"
		btnText.LabelFontWeight = 400	
		btnImage.image = "ButtonDownBK.bmp"
		btnImage.LabelFontWeight = 500		
		btnMedia.image = "BarBK.bmp"
		btnMedia.LabelFontWeight = 400		
		btnFlash.image = "BarBK.bmp"		
		btnFlash.LabelFontWeight = 400			
	elseif(var = 3)then
		btnOriginal.image = "BarBK.bmp"
		btnOriginal.LabelFontWeight = 400	
		btnText.image = "BarBK.bmp"
		btnText.LabelFontWeight = 400		
		btnImage.image = "BarBK.bmp"
		btnImage.LabelFontWeight = 400	
		btnFlash.image = "ButtonDownBK.bmp"		
		btnFlash.LabelFontWeight = 500		
		btnMedia.image = "BarBK.bmp"
		btnMedia.LabelFontWeight = 400		
	elseif(var = 4)then
		btnOriginal.image = "BarBK.bmp"
		btnOriginal.LabelFontWeight = 400	
		btnText.image = "BarBK.bmp"
		btnText.LabelFontWeight = 400	
		btnImage.image = "BarBK.bmp"
		btnImage.LabelFontWeight = 400	
		btnFlash.image = "BarBK.bmp"	
		btnFlash.LabelFontWeight = 400
		btnMedia.image = "ButtonDownBK.bmp"
		btnMedia.LabelFontWeight = 500	
	end if
end sub
