<%

Dim isIE	' true if browser is IE
Dim isNetscape	' true if browser is Netscape
Dim isWindows	' true if browser is Windows
Dim browserVer	' short browser version. eg for Netscape 4.7, browserVer is 4
Dim browserVerFull	' full browser version. eg for Netscape 4.7, browserVerFull is 4.7

isIE = false
isNetscape = false
isWindows = false

Dim g_strUserAgent
g_strUserAgent = Request.ServerVariables("HTTP_USER_AGENT")

If InStr(g_strUserAgent,"MSIE") > 0 Then
	isIE = true
ElseIf InStr(g_strUserAgent,"Mozilla") > 0 and InStr(g_strUserAgent,"compatible") = 0 Then
	isNetscape = true
End If

If InStr(g_strUserAgent,"Win") > 0 Then
	isWindows = true
End If

browserVerFull = GetBrowserVerFull()
browserVer = GetMajorVersion(browserVerFull)

Function GetBrowserVerFull()

	Dim nBrowserVerStart
	Dim nBrowserVerEnd
	
	If isNetscape Then
		nBrowserVerStart = InStr(g_strUserAgent, ".")	
	Else
		nBrowserVerStart = InStr(g_strUserAgent, "(")
		If nBrowserVerStart = 0 Then
			nBrowserVerStart = InStr(g_strUserAgent, ".")
		Else
			nBrowserVerStart = InStr(nBrowserVerStart, g_strUserAgent, ".")
		End If
	End If

	If nBrowserVerStart > 1 Then
	
		nBrowserVerEnd = nBrowserVerStart + 1 
		nBrowserVerStart = nBrowserVerStart - 1	
					
		Do While isNumeric(mid(g_strUserAgent, nBrowserVerStart, 1))
			nBrowserVerStart = nBrowserVerStart - 1
			If nBrowserVerStart = 0 Then
				Exit Do
			End If
		Loop
		nBrowserVerStart = nBrowserVerStart + 1
		
		Do While isNumeric(mid(g_strUserAgent, nBrowserVerEnd, 1))

			nBrowserVerEnd = nBrowserVerEnd + 1
			If nBrowserVerEnd > len(g_strUserAgent) Then
				Exit Do
			End If
		Loop
		nBrowserVerEnd = nBrowserVerEnd - 1
		
		If nBrowserVerEnd > nBrowserVerStart Then
			GetBrowserVerFull = mid(g_strUserAgent, nBrowserVerStart, nBrowserVerEnd - nBrowserVerStart + 1)
		Else
			GetBrowserVerFull = 0
		End If
		
	Else
	
		GetBrowserVerFull = 0	
	
	End If

End Function

'	For Resolution v2.x compatibility only
Function isMSIE()
	isMSIE = isIE
End Function

'	For Resolution v2.x compatibility only
Function isMSIE3()
	isMSIE3 = isIE And browserVer < 4
End Function

'	For Resolution v2.x compatibility only
Function isWinBrowser()
	isWinBrowser = isWindows
End Function
%>
