Partial Class Controls_Search
	Inherits System.Web.UI.UserControl

  Public Event SearchSite()
	Public Event SearchSiteAgain()
	Public Event SearchSupport()
	Public Event SearchSupportAgain()

	Public Property Mode() As SearchMode
		Get
			If ViewState(Me.ID & "_Mode") Is Nothing Then
				Return SearchMode.Unspecified
			Else
				Return CType(ViewState(Me.ID & "_Mode"), SearchMode)
			End If
		End Get

		Set(ByVal value As SearchMode)
			ViewState(Me.ID & "_Mode") = value
		End Set
	End Property

	Public Property Criteria() As String
		Get
			Select Case Mode
				Case SearchMode.Site
					Return txtSite.Text
				Case SearchMode.SiteAgain
					Return txtSiteAgain.Text
				Case SearchMode.Support
					Return txtSupport.Text
				Case SearchMode.SupportAgain
					Return txtSupportAgain.Text
				Case Else
					Return String.Empty
			End Select
		End Get

		Set(ByVal value As String)
			Select Case Mode
				Case SearchMode.Site
					txtSite.Text = value
				Case SearchMode.SiteAgain
					txtSiteAgain.Text = value
				Case SearchMode.Support
					txtSupport.Text = value
				Case SearchMode.SupportAgain
					txtSupportAgain.Text = value
				End Select
		End Set
  End Property

  Public Property SearchString() As String
    Get
      Return hdnSearchString.Value
    End Get

    Set(ByVal value As String)
      hdnSearchString.Value = value
    End Set
  End Property

	Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
		pnlSite.Visible = False
		pnlSiteAgain.Visible = False
		pnlSupport.Visible = False
		pnlSupportAgain.Visible = False

		Select Case Mode
			Case SearchMode.Site
				pnlSite.Visible = True
			Case SearchMode.SiteAgain
				pnlSiteAgain.Visible = True
			Case SearchMode.Support
				pnlSupport.Visible = True
			Case SearchMode.SupportAgain
				pnlSupportAgain.Visible = True
		End Select
	End Sub

	Protected Sub btnSite_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSite.Click
		RaiseEvent SearchSite()
	End Sub

	Protected Sub btnSiteAgain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSiteAgain.Click
		RaiseEvent SearchSiteAgain()
	End Sub

	Protected Sub btnSupport_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSupport.Click
		RaiseEvent SearchSupport()
	End Sub

	Protected Sub btnSupportAgain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSupportAgain.Click
		RaiseEvent SearchSupportAgain()
	End Sub
End Class
