<html>
<head>
<title>BirdName</title>

<HTA:APPLICATION
  APPLICATIONNAME="BirdName"
  ID="BirdName"
  VERSION="1.01"
  SCROLL="auto"
  SINGLEINSTANCE="yes"/>

<style type="text/css">
.Group
{
	border: 1px solid gray;
	padding: 12px 25px 12px 25px;
}

a
{
	color: yellow;
}

body
{
	font: 12pt arial;
	color:white;
}

input.Button
{
	width: 10em;
	height: 2em;
}

table
{
	border: 0 none;
	width: 90%;
}

td.Content
{
	width: 35%;
}

td.Control
{
	width: 20%;
	text-align: right;
}

td.Spacer
{
	width: 5%;
}
</style>

</head>


<script language="VBScript">
Option Explicit

On Error Goto 0

Const ForAppending = 8
Const ForReading   = 1
Const ForWriting   = 2

Const TristateFalse      =  0
Const TristateMixed      = -2
Const TristateTrue       = -1
Const TristateUseDefault = -2

Dim arrLang( )
Dim blnUseLocalLanguageNames
Dim objCaptions, objIE, objSettings
Dim strAlternativeScientificName

Set objIE = CreateObject( "InternetExplorer.Application" )
 
' Use variables for captions, to allow easy translation
Set objCaptions = CreateObject( "Scripting.Dictionary" )
objCaptions.Add "BirdName", "Bird Name"
objCaptions.Add "Configure", "Configure"
objCaptions.Add "Download", "Download"
objCaptions.Add "Help", "Help"
objCaptions.Add "HideSettings", "Hide Settings"
objCaptions.Add "HideUpdateNotification", "Hide Notification"
objCaptions.Add "NotABird", "Not a bird"
objCaptions.Add "OrAmbiguous", "or ambiguous name"
objCaptions.Add "ScientificName", "Scientific Name"
objCaptions.Add "Search", "Search Wikipedia"
objCaptions.Add "Settings", "Settings"
objCaptions.Add "SimultaneousTranslations", "simultaneous translations"
objCaptions.Add "Translate", "Translate"
objCaptions.Add "Translation", "Translation"
objCaptions.Add "UpdateNow", "Update Now"
objCaptions.Add "UseLocalLanguageNames", "Use local language names"

' Use variables for settings, to allow easy customization
Set objSettings = CreateObject( "Scripting.Dictionary" )
objSettings.Add "AutoUpdate", 0
objSettings.Add "ConfigLanguage", ""
objSettings.Add "DefaultLanguage", "en"
objSettings.Add "LocalLanguageNames", True
objSettings.Add "NumTrans", 2
objSettings.Add "TransLang1", "nl"
objSettings.Add "TransLang2", "de"
objSettings.Add "TransLang3", "fr"
objSettings.Add "TransLang4", "it"
objSettings.Add "WindowHeight", 768
objSettings.Add "WindowWidth", 1024


' Capitalize
Function Cap( myString )
	Dim strString
	strString = Replace( myString, "  ", " " )
	strString = LCase( Trim( strString ) )
	Cap = UCase( Left( strString, 1 ) ) & Mid( strString, 2 )
End Function


Sub CheckUpdate( )
	Dim lenLatestVer, strCurrentVer, strLatestver, strQuote, wshShell

	strQuote = ""

	'On Error Resume Next
	
	' Change mouse pointer to hourglass while checking for update
	Document.Body.Style.Cursor = "wait"

	strCurrentVer = Left( BirdName.Version, 4 )
	' Read the latest version info from the web
	strLatestVer  = WGet( "http://www.robvanderwoude.com/updates/birdname.txt" )

	' Retry once, after clearing the IE cache, if the versions don't match
	If strCurrentVer <> strLatestver Then
		' Clear the IE cache
		Set wshShell = CreateObject( "WScript.Shell" )
		wshShell.Run "RUNDll32.EXE InetCpl.cpl,ClearMyTracksByProcess 8", 7, True
		Set wshShell = Nothing
		' Try again, read the latest version info from the web
		strLatestver = WGet( "http://www.robvanderwoude.com/updates/birdname.txt" )
	End If

	lenLatestVer  = Len( strLatestVer )
	If lenLatestVer = 4 Then
		If objSettings.Item( "AutoUpdate" ) = 1 Then
			Update
		Else
			If strLatestVer < strCurrentVer Then
				If Left( strLatestver, 1 ) = 0 Then strQuote = Chr(34)
				UpdateBlock.style.display    = "block"
				UpdateGroup.style.border     = "1px solid yellow"
				UpdateNotification.InnerHTML = "You seem to be using a pre-release version (" & BirdName.Version & ") of BirdName.hta. The latest " & strQuote & "stable" & strQuote & " release is " & strLatestVer & "."
			End If
			If strLatestVer > strCurrentVer Then
				UpdateBlock.style.display    = "block"
				UpdateGroup.style.border     = "1px solid red"
				UpdateNotification.InnerHTML = "You are using version " & BirdName.Version & " of BirdName.hta. The latest " & strQuote & "stable" & strQuote & " release is " & strLatestVer & "."
			End If
		End If
	End If

	' Change mouse pointer back to default
	Document.Body.Style.Cursor = "default"

	On Error Goto 0
End Sub


Sub GetLanguageList( )
	Dim i
	Dim objHTTP, objMatch, objMatches, objNewOption, objRE
	Dim strHTML, strMsg, strResp, strURL
	
	' Read and save the entire URL including HTML tags in a variable named strHTML
	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
	strURL = "http://meta.wikimedia.org/wiki/List_of_Wikipedias"
	objHTTP.Open "GET", strURL
	objHTTP.Send
	If objHTTP.Status = 200 Then
		strResp = objHTTP.GetAllResponseHeaders( )
		If InStr( strResp, ".wikimedia.org" ) Then
			strHTML = objHTTP.ResponseText
		Else
			MsgBox "Unable to contact Wikipedia for a list of available languages.", vbOKOnly, "Connection Error"
		End If
	Else
		MsgBox "Unable to contact Wikipedia for a list of available languages." & vbCrLf & vbCrLf & "Error code: " & objHTTP.Status, vbOKOnly, "Connection Error"
	End If
	Set objHTTP = Nothing
	
	' Parse the languages tables and save the results in a 2-dimensional array named arrLang;
	' arrLang(0) is the language code
	' arrLang(1) is the local language name
	' arrLang(2) is the English language name
	Set objRE = New RegExp
	objRE.Global = True
	objRE.IgnoreCase = True
	objRE.Pattern = "<tr>[ˆ<]*<td>[0-9,]+</td>[ˆ<]*<td><a [ˆ>]+>([ˆ<]+)</a></td>[ˆ<]*<td[ˆ>]*><a [ˆ>]+>([ˆ<]+)</a></td>[ˆ<]*<td><a [ˆ>]+>([ˆ<]+)</a></td>"
	Set objMatches = objRE.Execute( strHTML )
	For Each objMatch In objMatches
		If objMatch.Submatches.Count > 2 Then
			ReDim Preserve arrLang( 2, i )
			arrLang( 0, i ) = objMatch.Submatches.Item(2)
			arrLang( 1, i ) = objMatch.Submatches.Item(1)
			arrLang( 2, i ) = objMatch.Submatches.Item(0)
			i = i + 1
		End If
	Next
	Set objRE = Nothing
End Sub


' Read scientific name from WikiPedia page
Sub GetScientificName( )
	Dim objMatches, objOption, objRE
	Dim strBirdName, strHTML, strLangCode, strURL
	Dim strDEBUG

	ScientificName.Value = ""
	strAlternativeScientificName = ""
	strBirdName = Cap( BirdnameInput.Value )
	BirdnameInput.Value = strBirdName
	For Each objOption In SelectSourceLanguage.Options
		If objOption.Selected Then
			strLangCode = objOption.Value
		End If
	Next
	strURL = "http://" & strLangCode & ".wikipedia.org/wiki/" & Und( strBirdName )
	strHTML = WGet( strURL )
	If Left( LCase( strHTML ), 2 ) = "--" Then
		ScientificName.Value = strHTML
		Exit Sub
	End If
	Set objRE = New RegExp
	objRE.Global = True
	objRE.IgnoreCase = True
	' First, test if the URL is bird oriented
	objRE.Pattern = "Aves"
	If objRE.Test( strHTML ) Then
		' Next, find the bird name, followed by 1 or 2 scientific names in parenthesis
		objRE.Pattern = "<b>" & strBirdName & "</b> (<[bi]>)*\((<[bi]>)*([ˆ<\n\r]+)(</[bi]>)*(<sup[ˆ>]*>.*?</sup>)?([ˆ<\)]*(<[bi]>)*([ˆ<\)]+)(</[bi]>)*(<sup[ˆ>]*>.*?</sup>)?)?\)(</[bi]>)*"
		Set objMatches = objRE.Execute( strHTML )
		If objMatches.Count > 0 Then
			If objMatches.Item(0).Submatches.Count > 10 Then
				' The displayed scientific name is the first match
				ScientificName.Value = Cap( objMatches.Item(0).Submatches(2) )
				' The optional second match is kept as a "spare" in case a translation will not be found
				strAlternativeScientificName = Cap( objMatches.Item(0).Submatches(9) )
				strDEBUG = strAlternativeScientificName
			End If
		End If
	Else
		ScientificName.Value = "--" & objcaptions.Item( "NotABird" ) & " " & objcaptions.Item( "OrAmbiguous" ) & "?--"
		Button_SearchScientificName.disabled = False
		strAlternativeScientificName = ""
		strDEBUG = strAlternativeScientificName
	End If
	Set objMatches = Nothing
	Set objRE = Nothing
End Sub


Sub HelpMsg( )
	Dim strHTML
	strHTML = "<p><strong>BirdName,  Version " & BirdName.Version & "</strong>\n" _
	        & "Use <a href=""http://www.wikipedia.org/"">Wikipedia</a> to translate bird names from and to (m)any language(s).\n\n" _
	        & "You can use this program to translate a bird name from one of the supported ""local"" languages to any of the other supported languages.\n" _
	        & "The program will first search the scientific name on Wikipedia and then translate that scientific name to the language of choice.\n" _
	        & "Alternatively, you can enter the scientific name yourself, and the program will translate it to the language(s) of choice.\n" _
	        & "With the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> buttons you can search Wikipedia interactively for the requested translations.\n\n" _
	        & "<strong>Settings</strong>\n\n" _
	        & "If <input type=""checkbox""> <code>" & objCaptions.Item( "UseLocalLanguageNames" ) & "</code> is checked, the list of available languages shows the local language names (e.g. ""Fran&ccedil;ais"", ""Cymrµg""), if not checked the English language names are listed instead (e.g. ""French"", ""Welsh"").\n\n" _
	        & "<select size=""1"" style=""width: 3em;""><option>1</option><option selected>2</option><option>3</option><option>4</option></select> <code>" & objCaptions.Item( "SimultaneousTranslations" ) & "</code> controls the number of translations shown; it ranges from 1 to 4.\n\n" _
	        & "To change settings permanently, click the <input type=""button"" class=""Button"" value=""" & objCaptions.Item( "Configure" ) & """ style=""width: 10em; height: 2em; vertical-align: middle""> button, next to the """ & objCaptions.Item( "Settings" ) & """ header, to open the configuration files in Notepad (see the chapter ""Customization"" for more details).\n\n" _
	        & "Click <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "HideSettings" ) & """> to move the Settings block out of sight (it will reappear next time the program is started).\n\n" _
	        & "<strong>Program Updates</strong>\n\n" _
	        & "This program automatically checks for updates.\n" _
	        & "If an update is available, a notification area will pop up at the top of the window, with the new version and a link to the update page.\n" _
	        & "If AutoUpdate is enabled, the program is updated ""on-the-fly"" without notification (see the chapter ""Customization"" for more details).\n\n" _
	        & "Click <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "HideUpdateNotification" )& """> to move the notification out of sight.\n" _
	        & "Unless you update the program, the notification will reappear next time the program is started.\n\n" _
	        & "<strong>Restrictions</strong>\n\n" _
	        & "This program uses Wikipedia to find the requested translations.\n" _
	        & "Thus it depends on:</p>" & vbcrlf _
	        & "<ol><li>the full name being entered, exactly as used on Wikipedia (e.g. ""Great Bittern"" instead of ""Bittern"")</li><li>a page dedicated to the bird of choice in each language of choice</li><li>redirection of the scientific name to the local name</li><li>Wikipedia's page layout remaining more or less unchanged</li></ol>" & vbCrLf _
	        & "It may be clear that these conditions may not always be met.\n" _
	        & "If no translation was found because there is no dedicated page, use the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> button next to the """ & objCaptions.Item( "Translation" ) & """ field to search for the name yourself.\n\n" _
	        & "Ambiguity, multiple ""local"" names, or the use of an incomplete name or group name instead of the species' full name, may prevent the program to find the scientific name.\n" _
	        & "That is where the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> button next to the """ & objCaptions.Item( "ScientificName" ) & """ field comes to the rescue.\n" _
	        & "Click it to find the scientific name yourself, or look it up in a printed bird guide.\n" _
	        & "Once found, clear the """ & objCaptions.Item( "BirdName" ) & """ field and use the """ & objCaptions.Item( "ScientificName" ) & """ field to find the requested translations.\n" _
	        & "If you still can't find the translation that way, this program cannot assist you any further.\n\n" _
	        & "<strong id=""Customization"">Customization</strong>\n\n" _
	        & "You may use a configuration file named BirdName.cfg, to customize the window size, default input and output languages and number of simultaneous translations.\n" _
	        & "BirdName.cfg is an ANSI encoded (or ""ASCII"") plain text file, located in BirdName.hta's parent folder.\n" _
	        & "Examine the default settings shown below to find out what you can customize and how:</p>"
	strHTML = Replace( strHTML, "\n\n", "</p>" & vbCrLf & vbCrLf & "<p>" )
	strHTML = Replace( strHTML, "\n", "<br>" & vbCrLf ) _
	        & "<pre>AutoUpdate=0\n" _
	        & "ConfigLanguage=en\n" _
	        & "DefaultLanguage=en\n" _
	        & "LocalLanguageNames=1\n" _
	        & "NumTrans=4\n" _
	        & "TransLang1=nl\n" _
	        & "TransLang2=de\n" _
	        & "TransLang3=es\n" _
	        & "TransLang4=da\n" _
	        & "WindowHeight=768\n" _
	        & "WindowWidth=1024</pre>\n"
	strHTML = Replace( strHTML, "\n", vbCrLf ) _
	        & "<strong>Note:</strong> <code>AutoUpdate=1</code> will update the HTA to the latest version without any user interaction.\n\n" _
	        & "Besides the program settings, you can also customize (translate) the captions and button labels.\n" _
	        & "This requires an ANSI encoded (or ""ASCII"") plain text file named BirdName.<em>lang</em>, located in BirdName.hta's parent folder, where <em>lang</em> is the language code specified by <code>ConfigLanguage</code> in BirdName.cfg (e.g. <code>en</code>).\n" _
	        & "Unicode or extended ASCII characters in all text except button labels must be escaped (e.g. <code>&amp;Uuml;</code> for <code>&Uuml;</code>).\n" _
	        & "You may have to experiment with code page settings when using extended ASCII characters in translated <em>button</em> labels.\n" _
	        & "Examine BirdName.en, shown below, to figure out what you can customize and how:</p>"
	strHTML = Replace( strHTML, "\n\n", "</p>" & vbCrLf & vbCrLf & "<p>" )
	strHTML = Replace( strHTML, "\n", "<br>" & vbCrLf ) _
	        & "<pre>BirdName=Bird Name\n" _
	        & "Configure=Configure\n" _
	        & "Download=Download\n" _
	        & "Help=Help\n" _
	        & "HideSettings=Hide Settings\n" _
	        & "HideUpdateNotification=Hide Notification\n" _
	        & "NotABird=Not a bird\n" _
	        & "OrAmbiguous=or ambiguous name\n" _
	        & "ScientificName=Scientific Name\n" _
	        & "Search=Search Wikipedia\n" _
	        & "Settings=Settings\n" _
	        & "SimultaneousTranslations=simultaneous translations\n" _
	        & "Translate=Translate\n" _
	        & "Translation=Translation\n" _
	        & "UpdateNow=Update Now\n" _
	        & "UseLocalLanguageNames=Use local language names</pre>\n"
	strHTML = Replace( strHTML, "\n", vbCrLf ) _
	        & "<p>Open the configuration files by clicking the <input type=""button"" class=""Button"" value=""" & objCaptions.Item( "Configure" ) & """ style=""width: 10em; height: 2em; vertical-align: middle""> button, next to the """ & objCaptions.Item( "Settings" ) & """ header.\n\n" _
	        & "Change one setting at a time and examine the effect.\n" _
	        & "If the result is a complete mess, just delete BirdName.cfg (and optionally BirdName.<em>lang</em>) to restore the default settings.\n\n" _
	        & "&copy; 2012 Rob van der Woude\n" _
	        & "<a href=""http://www.robvanderwoude.com/birdname.php"">http://www.robvanderwoude.com/birdname.php</a></p>"
	strHTML = Replace( strHTML, "\n\n", "</p>" & vbCrLf & vbCrLf & "<p>" )
	strHTML = Replace( strHTML, "\n", "<br>" & vbCrLf )

	On Error Resume Next
	objIE.Navigate "about:blank"
	If Err Then
		Set objIE = CreateObject( "InternetExplorer.Application" )
		objIE.Navigate "about:blank"
	End If
	On Error Goto 0
	objIE.Width  = objSettings.Item( "WindowWidth" )
	objIE.Height = objSettings.Item( "WindowHeight" )
	objIE.Left   = Int( ( window.screen.width  - objIE.Width  ) / 2 ) + 30
	objIE.Top    = Int( ( window.screen.height - objIE.Height ) / 2 ) + 30
	objIE.StatusBar  = False
	objIE.AddressBar = False
	objIE.MenuBar    = False
	objIE.ToolBar    = False
	objIE.Document.Title = "Help for BirdName " & BirdName.Version & ", © Rob van der Woude 2012"
	objIE.Document.Body.style.fontFamily = "arial,sans-serif"
	objIE.Document.Body.InnerHTML = strHTML
	objIE.Visible = 1
End Sub


Sub LoadConfig( )
	Dim blnError
	Dim i
	Dim objCaptionsFile, objFSO, objNewOption, objSettingsFile
	Dim strBaseName, strCaptionsFile, strKey, strLine, strSettingsFile, strValue

	blnError = False

	' Find the full path of this HTA
	strBaseName = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 )

	' Check if it is accompanied by a config file
	strSettingsFile = strBaseName & ".cfg"
	Set objFSO = CreateObject( "Scripting.FileSystemObject" )
	With objFSO
		If .FileExists( strSettingsFile ) Then
			Set objSettingsFile = .OpenTextFile( strSettingsFile, ForReading, TristateFalse )
			While Not objSettingsFile.AtEndOfStream
				strLine = objSettingsFile.ReadLine( )
				strKey   = Trim( Left( strLine, InStr( strLine, "=" ) - 1 ) )
				strValue = Trim( Mid( strLine, InStr( strLine, "=" ) + 1 ) )
				Select Case strKey
					Case "AutoUpdate", "LocalLanguageNames"
						objSettings.Item( strKey ) = CBool( strValue )
					Case "ConfigLanguage", "DefaultLanguage", "TransLang1", "TransLang2", "TransLang3", "TransLang4"
						objSettings.Item( strKey ) = CStr( strValue )
					Case "NumTrans", "WindowHeight", "WindowWidth"
						objSettings.Item( strKey ) = CInt( strValue )
					Case Else
						If Left( strKey, 1 ) <> ";" Then blnError = True
				End Select
			Wend
			objSettingsFile.Close
			Set objSettingsFile = Nothing

			If Not blnError Then
				If objSettings.Item( "ConfigLanguage" ) <> "" Then
					strCaptionsFile = strBaseName & "." & objSettings.Item( "ConfigLanguage" )
					If .FileExists( strCaptionsFile ) Then
						Set objCaptionsFile = .OpenTextFile( strCaptionsFile, ForReading, TristateFalse )
						While Not objCaptionsFile.AtEndOfStream
							strLine = objCaptionsFile.ReadLine( )
							strKey = Trim( Left( strLine, InStr( strLine, "=" ) - 1 ) )
							strValue = Trim( Mid( strLine, InStr( strLine, "=" ) + 1 ) )
							Select Case strKey
								Case "BirdName", "Configure", "Download", "Help", "HideSettings", "HideUpdateNotification", "NotABird", "OrAmbiguous", "ScientificName", "Search", "Settings", "SimultaneousTranslations", "Translate", "Translation", "UpdateNow", "UseLocalLanguageNames"
									objCaptions.Item( strKey ) = strValue
								Case Else
									If Left( strKey, 1 ) <> ";" Then blnError = True
							End Select
						Wend
						objCaptionsFile.Close
						Set objCaptionsFile = Nothing
					End If
				End If
			End If

			SelectNumTrans.innerHTML  = ""
			For i = 1 To 4
				Set objNewOption  = document.createElement( "OPTION" )
				objNewOption.Text = i
				objNewOption.Value = i
				If Int( objSettings.Item( "NumTrans" ) ) = i Then
					objNewOption.Selected = True
				End If
				SelectNumTrans.options.Add( objNewOption )
			Next

			If Not blnError Then
				Label_BirdName.innerHTML                 = objCaptions.Item( "BirdName" )
				Button_Configure.Value                   = objCaptions.Item( "Configure" )
				Button_Download.Value                    = objCaptions.Item( "Download" )
				Button_Help.Value                        = objCaptions.Item( "Help" )
				Button_HideSettings.Value                = objCaptions.Item( "HideSettings" )
				Button_HideUpdateNotification.Value      = objCaptions.Item( "HideUpdateNotification" )
				Label_ScientificName.innerHTML           = objCaptions.Item( "ScientificName" )
				Button_SearchScientificName.Value        = objCaptions.Item( "Search" )
				Button_SearchTranslation1.Value          = objCaptions.Item( "Search" )
				Button_SearchTranslation2.Value          = objCaptions.Item( "Search" )
				Button_SearchTranslation3.Value          = objCaptions.Item( "Search" )
				Button_SearchTranslation4.Value          = objCaptions.Item( "Search" )
				Label_Settings.innerHTML                 = objCaptions.Item( "Settings" )
				Label_SimultaneousTranslations.innerHTML = objCaptions.Item( "SimultaneousTranslations" )
				Button_Translate.Value                   = objCaptions.Item( "Translate" )
				Label_Translation1.innerHTML             = objCaptions.Item( "Translation" )
				Label_Translation2.innerHTML             = objCaptions.Item( "Translation" )
				Label_Translation3.innerHTML             = objCaptions.Item( "Translation" )
				Label_Translation4.innerHTML             = objCaptions.Item( "Translation" )
				Button_Update.Value                      = objCaptions.Item( "UpdateNow" )
				Label_UseLocalLanguageNames.innerHTML    = objCaptions.Item( "UseLocalLanguageNames" )
				UseLocalLanguageNames.Checked            = objSettings.Item( "LocalLanguageNames" )
			End If
		End If
	End With
	Set objFSO = Nothing

	' Resize and position window
	objSettings.Item( "WindowWidth" )  = Min( objSettings.Item( "WindowWidth" ), window.screen.width )
	objSettings.Item( "WindowHeight" ) = Min( objSettings.Item( "WindowHeight" ), window.screen.height )
	Self.resizeTo objSettings.Item( "WindowWidth" ), objSettings.Item( "WindowHeight" )
	Self.moveTo Int( ( window.screen.width  - objSettings.Item( "WindowWidth" ) ) / 2 ), Int( ( window.screen.height - objSettings.Item( "WindowHeight" ) ) / 2 )
End Sub


Function Max( num1, num2 )
	If CDbl( num1 ) > CDbl( num2 ) Then
		Max = CDbl( num1 )
	Else
		Max = CDbl( num2 )
	End If
End Function


Function Min( num1, num2 )
	If CDbl( num1 ) < CDbl( num2 ) Then
		Min = CDbl( num1 )
	Else
		Min = CDbl( num2 )
	End If
End Function


Function OSVersion( )
	Dim arrOSVer
	OSVersion = 0
	On Error Resume Next
	Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
	Set colInstances  = objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem" )
	For Each objInstance In colInstances
		arrOSVer = Split( objInstance.Version, "." )
		If UBound( arrOSVer ) > 0 Then OSVersion = 100 * arrOSVer(0) + arrOSVer(1)
	Next
	Set colInstances  = Nothing
	Set objWMIService = Nothing
	On Error Goto 0
End Function


Sub Sleep( seconds )
	Dim wshShell, strCmd
	On Error Resume Next
	Set wshShell = CreateObject( "Wscript.Shell" )
	strCmd = "%COMSPEC% /C (PING -n " & seconds & " 127.0.0.1 >NUL 2>&1 || PING -n " & seconds & " ::1 >NUL 2>&1)"
	wshShell.Run strCmd, 0, 1
	Set wshShell = Nothing
	On Error Goto 0
End Sub


Sub Sort2Dim1( ByRef myArray, myIndex )
' Sort a 2-dimensional array by its specified index in the 1st dimension
    Dim i, j, arrHolder( 2 )
    For i = ( UBound( myArray, 2 ) - 1 ) to 0 Step -1
        For j= 0 to i
            If UCase( myArray( myIndex, j ) ) > UCase( myArray( myIndex, j + 1 ) ) Then
                arrHolder( 0 )      = myArray( 0, j + 1 )
                arrHolder( 1 )      = myArray( 1, j + 1 )
                arrHolder( 2 )      = myArray( 2, j + 1 )
                myArray( 0, j + 1 ) = myArray( 0, j )
                myArray( 1, j + 1 ) = myArray( 1, j )
                myArray( 2, j + 1 ) = myArray( 2, j )
                myArray( 0, j )     = arrHolder( 0 )
                myArray( 1, j )     = arrHolder( 1 )
                myArray( 2, j )     = arrHolder( 2 )
            End If
        Next
    Next 
End Sub


' Translate scientific name to specified language using WikiPedia
Function Translate( myCode )
	Dim objMatches, objRE
	Dim strHTML, strName, strURL
	
	If Trim( ScientificName.Value ) = "" Then
		Translate = ""
		Exit Function
	End If

	' First, try the URL generated with the first scientific name
	strURL = "http://" & myCode & ".wikipedia.org/wiki/" & Und( ScientificName.Value )
	strHTML = WGet( strURL )
	' If the page or translation wasn't found, try the second scientific name, if available
	If Left( LCase( strHTML ), 2 ) = "--" Then
		If strAlternativeScientificName = "" Then
			Translate = strHTML
			Exit Function
		Else
			strURL = "http://" & myCode & ".wikipedia.org/wiki/" & Und( strAlternativeScientificName )
			strHTML = WGet( strURL )
			If Left( LCase( strHTML ), 2 ) = "--" Then
				Translate = strHTML
				Exit Function
			End If
		End If
	End If
	Set objRE = New RegExp
	objRE.Global = False
	objRE.IgnoreCase = True
	' First, let's assume the page title is the translated name
	objRE.Pattern = "<h1 (?:id|class)=""firstHeading"" (?:class|id)=""firstHeading"">(?:[\n\r\s]*<span[ˆ>]*>)?(.+?)(?:</span>[\n\r\s]*)?</h1>"
	Set objMatches = objRE.Execute( strHTML )
	If objMatches.Count > 0 Then
		If objMatches.Item(0).Submatches.Count > 0 Then
			strName = objMatches.Item(0).Submatches(0)
		End If
	End If
	' In case the page title is the scientific name, try an alternative search pattern
	If LCase( ScientificName.Value ) = LCase( strName ) Then
		objre.Pattern = "<b>([ˆ<]+)</b> \(<i>(<b>)?" & ScientificName.Value & "(</b>)?</i>(,|\)) [ˆ\n\r]{20,}[\n\r]"
		Set objMatches = objRE.Execute( strHTML )
		If objMatches.Count > 0 Then
			If objMatches.Item(0).Submatches.Count > 0 Then
				strName = objMatches.Item(0).Submatches(0)
			End If
		End If
	End If

	Set objMatches = Nothing
	Set objRE = Nothing
	Translate = strName
End Function


' Replace spaces by underscores to create URL
Function Und( myString )
	Und = Replace( myString, " ", "_" )
End Function


Sub Update( )
	Dim blnAccess, blnCreate, blnOverwrite
	Dim objFSO, objHTAFile, objShell
	Dim strHTAFile

	blnCreate = True
	blnOverwrite = True
	strHTAFile = Self.location.pathname
	Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
	'On Error Resume Next
	With objFSO
		Set objHTAFile = .GetFile( strHTAFile )
		objHTAFile.Copy Left( strHTAFile, Len( strHTAFile ) - 4 ) & ".bak." & CStr( 10000 * Hour( Now ) + 100 * Minute( Now ) + Second( Now ) ), blnOverwrite
		If Err Then
			blnAccess = False
		Else
			blnAccess = True
		End If
		Set objHTAFile = Nothing
		WGetSource
		Self.location.reload( True )
	End With
	On Error Goto 0
	Set objFSO   = Nothing
	' If we could not access the HTA to update it, we will retry with elevated privileges
	If Not blnAccess Then
		If InStr( BirdName.CommandLine, " /Update" ) Then
			MsgBox "Update failed, no access."
		Else
			If OSVersion > 599 Then
				Set objShell = CreateObject( "Shell.Application" )
				objShell.ShellExecute BirdName.CommandLine & " /Update", "", "runas", 1
				Set objShell = Nothing
			Else
				MsgBox "Update failed, no access."
			End If
		End If
	End If
End Sub


' Read the entire web page
Function WGet( myURL )
	Dim objHTTP
	WGet = "--Not Found: " & myURL & "--"
	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
	objHTTP.Open "GET", myURL
	objHTTP.Send
	If objHTTP.Status = 200 Then
		WGet = objHTTP.ResponseText
	Else
		WGet = "--Not found (" & objHTTP.Status & ") " & myURL & "--"
	End If
	Set objHTTP = Nothing
End Function


' Read the HTA source code from the web page and overwrite this HTA itself
Sub WGetSource(  )
	Dim objADODB, objFSO, objIE, objRE, objSelf
	Dim strHTA, strText, strURL

	Const adTypeBinary          = 1
	Const adTypeText            = 2
	Const adSaveCreateNotExist  = 1
	Const adSaveCreateOverWrite = 2
	
	strURL = "http://www.robvanderwoude.com/birdname_hta_src.php"
	strHTA = Self.location.pathname

	Set objADODB = CreateObject( "ADODB.Stream" )
	Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
	Set objIE    = CreateObject( "InternetExplorer.Application" )
	Set objRE    = New RegExp

	With objIE
		.Navigate strURL
		.Visible = False
		Do While .Busy
			Sleep 1
		Loop
		strText = .Document.Body.InnerText
		Do While .Busy
			Sleep 1
		Loop
		.Quit
	End With

	' Trim only HTA source code from the web page
	objRE.Global = True
	objRE.IgnoreCase = False
	' The HTML begin and end tags in the regex pattern must be "masked" to prevent them being interpreted as the HTA's begin and end tags
	objRE.Pattern = "ˆ.*<ht" & "ml>"
	strText = objRE.Replace( strText, "<ht" & "ml>" )
	objRE.Pattern = "</ht" & "ml>(.|[\n\r.])*"
	strText = objRE.Replace( strText, "</ht" & "ml>" )

	' Use ADODB stream to convert to and save as ASCII
	With objADODB
		.Open
		.Type = adTypeText
		.CharSet = "us-ascii"
		.WriteText strText
		.SaveToFile strHTA, adSaveCreateOverWrite
		.Close
	End With

	With objFSO
		' Reread the saved ASCII file
		Set objSelf = .OpenTextFile( strHTA, ForReading, False, TristateFalse )
		strText = objSelf.ReadAll
		objSelf.Close
		Set objSelf = Nothing

		' Correct copyright symbols
		objRE.Global = True
		objRE.IgnoreCase = False
		objRE.Pattern = "BirdName "" & BirdName.Version & "", C Rob van der Woude"
		strText = objRE.Replace( strText, "BirdName "" & BirdName.Version & "", © Rob van der Woude" )

		' Save the corrected ASCII file
		Set objSelf = .OpenTextFile( strHTA, ForWriting, False, TristateFalse )
		objSelf.Write strText
		objSelf.Close
		Set objSelf = Nothing
	End With

	Set objADODB = Nothing
	Set objFSO   = Nothing
	Set objIE    = Nothing
	Set objRE    = Nothing
End Sub


' Event triggered subroutines


Sub Window_OnLoad( )
	window.document.title = "BirdName " & BirdName.Version & ", © Rob van der Woude 2012"
	LoadConfig
	GetLanguageList
	OnClick_UseLocalLanguageNames
	OnChange_SelectNumTrans
	setTimeout "CheckUpdate", 2000, "VBScript"
	If InStr( BirdName.CommandLine, "/?" ) Then HelpMsg
End Sub


Sub Window_OnUnload( )
	On Error Resume Next
	objIE.Quit
	On Error Goto 0
	Set objIE = Nothing
End Sub


Sub OnChange_BirdnameInput( )
	If Trim( BirdnameInput.Value & ScientificName.Value ) = "" Then
		Translation1.Value = ""
		Translation2.Value = ""
		Translation3.Value = ""
		Translation4.Value = ""
		Button_Clear.disabled                = True
		Button_Translate.disabled            = True
		Button_SearchScientificName.disabled = True
		Button_SearchTranslation1.disabled   = True
		Button_SearchTranslation2.disabled   = True
		Button_SearchTranslation3.disabled   = True
		Button_SearchTranslation4.disabled   = True
	Else
		Button_Clear.disabled     = False
		Button_Translate.disabled = False
		' Start translating when Enter key is pressed
		If window.event.Keycode = 13 Then OnClick_ButtonTranslate
	End If
End Sub


Sub OnChange_ScientificName( )
	If Not Button_SearchScientificName.disabled Then
		If Trim( ScientificName.Value ) <> "" And Left( LCase( Trim( ScientificName.Value ) ), 11 ) <> "--not found" Then
			BirdnameInput.Value = ""
		End If
	End If
	If Trim( BirdnameInput.Value & ScientificName.Value ) = "" Then
		Translation1.Value = ""
		Translation2.Value = ""
		Translation3.Value = ""
		Translation4.Value = ""
		Button_Clear.disabled                = True
		Button_Translate.disabled            = True
		Button_SearchScientificName.disabled = True
		Button_SearchTranslation1.disabled   = True
		Button_SearchTranslation2.disabled   = True
		Button_SearchTranslation3.disabled   = True
		Button_SearchTranslation4.disabled   = True
	Else
		Button_Clear.disabled     = False
		Button_Translate.disabled = False
		' Start translating when Enter key is pressed
		If window.event.Keycode = 13 Then OnClick_ButtonTranslate
	End If
End Sub


Sub OnChange_SelectSourceLanguage( )
	objSettings.Item( "DefaultLanguage" ) = SelectSourceLanguage.Value
End Sub


Sub OnChange_SelectTargetLanguage1( )
	Translation1.Value = ""
	objSettings.Item( "TransLang1" ) = SelectTargetLanguage1.Value
End Sub


Sub OnChange_SelectTargetLanguage2( )
	Translation2.Value = ""
	objSettings.Item( "TransLang2" ) = SelectTargetLanguage2.Value
End Sub


Sub OnChange_SelectTargetLanguage3( )
	Translation3.Value = ""
	objSettings.Item( "TransLang3" ) = SelectTargetLanguage3.Value
End Sub


Sub OnChange_SelectTargetLanguage4( )
	Translation4.Value = ""
	objSettings.Item( "TransLang4" ) = SelectTargetLanguage4.Value
End Sub


Sub OnChange_SelectNumTrans( )
	Dim i, intNumTrans, objNewOption
	If SelectNumTrans.Value = "" Then
		SelectNumTrans.innerHTML  = ""
		For i = 1 To 4
			Set objNewOption  = document.createElement( "OPTION" )
			objNewOption.Text = i
			objNewOption.Value = i
			If Int( objSettings.Item( "NumTrans" ) ) = i Then
				objNewOption.Selected = True
			End If
			SelectNumTrans.options.Add( objNewOption )
		Next
	End If
	intNumTrans = SelectNumTrans.Value
	TranslationBlock2.style.display = "none"
	TranslationBlock3.style.display = "none"
	TranslationBlock4.style.display = "none"
	If intNumTrans = 1 Then
		Label_Trans1.style.display = "none"
	Else
		Label_Trans1.style.display = "inline"
	End If
	If intNumTrans > 1 Then TranslationBlock2.style.display = "block"
	If intNumTrans > 2 Then TranslationBlock3.style.display = "block"
	If intNumTrans > 3 Then TranslationBlock4.style.display = "block"
End Sub


Sub OnClick_ButtonClear( )
	ScientificName.Value = ""
	BirdNameInput.Value  = ""
	OnChange_BirdnameInput
End Sub


Sub OnClick_ButtonConfigure( )
	Dim wshShell, strBaseName
	Set wshShell = CreateObject( "WScript.Shell" )
	strBaseName = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 )
	wshShell.Run "notepad.exe " & strBaseName & ".cfg", 5, True
	LoadConfig
	wshShell.Run "notepad.exe " & strBaseName & "." & objSettings.Item( "ConfigLanguage" ), 5, True
	Self.location.reload True
End Sub


Sub OnClick_ButtonDownload( )
	window.open "http://www.robvanderwoude.com/birdname.php"
End Sub


Sub OnClick_ButtonHideSettings( )
	SettingsBlock.style.display = "none"
End Sub


Sub OnClick_ButtonHideUpdateNotification( )
	UpdateBlock.style.display = "none"
End Sub


Sub OnClick_ButtonSearchScientificName( )
	window.open "http://" & SelectSourceLanguage.Value & ".wikipedia.org/wiki/" & Cap( Und( BirdnameInput.Value ) )
End Sub


Sub OnClick_ButtonSearchTranslation1( )
	If Translation1.Value = "" Or Left( LCase( Trim( Translation1.Value ) ), 2 ) = "--" Then
		window.open "http://" & SelectTargetLanguage1.Value & ".wikipedia.org/wiki/" & Und( ScientificName.Value )
	Else
		window.open "http://" & SelectTargetLanguage1.Value & ".wikipedia.org/wiki/" & Und( Translation1.Value )
	End If
End Sub


Sub OnClick_ButtonSearchTranslation2( )
	If Translation2.Value = "" Or Left( LCase( Trim( Translation2.Value ) ), 2 ) = "--" Then
		window.open "http://" & SelectTargetLanguage2.Value & ".wikipedia.org/wiki/" & Und( ScientificName.Value )
	Else
		window.open "http://" & SelectTargetLanguage2.Value & ".wikipedia.org/wiki/" & Und( Translation2.Value )
	End If
End Sub


Sub OnClick_ButtonSearchTranslation3( )
	If Translation3.Value = "" Or Left( LCase( Trim( Translation3.Value ) ), 2 ) = "--" Then
		window.open "http://" & SelectTargetLanguage3.Value & ".wikipedia.org/wiki/" & Und( ScientificName.Value )
	Else
		window.open "http://" & SelectTargetLanguage3.Value & ".wikipedia.org/wiki/" & Und( Translation3.Value )
	End If
End Sub


Sub OnClick_ButtonSearchTranslation4( )
	If Translation4.Value = "" Or Left( LCase( Trim( Translation4.Value ) ), 2 ) = "--" Then
		window.open "http://" & SelectTargetLanguage4.Value & ".wikipedia.org/wiki/" & Und( ScientificName.Value )
	Else
		window.open "http://" & SelectTargetLanguage4.Value & ".wikipedia.org/wiki/" & Und( Translation4.Value )
	End If
End Sub


Sub OnClick_ButtonTranslate( )
	Translation1.Value = ""
	Translation2.Value = ""
	Translation3.Value = ""
	Translation4.Value = ""
	Button_SearchScientificName.disabled = True
	Button_SearchTranslation1.disabled   = True
	Button_SearchTranslation2.disabled   = True
	Button_SearchTranslation3.disabled   = True
	Button_SearchTranslation4.disabled   = True
	If Trim( BirdnameInput.Value ) = "" Then
		ScientificName.Value = Cap( ScientificName.Value )
		BirdnameInput.Value = Translate( objSettings.Item( "DefaultLanguage" ) )
	Else
		ScientificName.Value = ""
		GetScientificName
	End If
	Button_SearchScientificName.disabled = False
	If ScientificName.Value <> "" And Left( LCase( Trim( ScientificName.Value ) ), 2 ) <> "--" Then
		Translation1.Value = Translate( objSettings.Item( "TransLang1" ) )
		Button_SearchTranslation1.disabled = False
		If SelectNumTrans.value > 1 Then
			Translation2.Value = Translate( objSettings.Item( "TransLang2" ) )
			Button_SearchTranslation2.disabled = False
		End If
		If SelectNumTrans.value > 2 Then
			Translation3.Value = Translate( objSettings.Item( "TransLang3" ) )
			Button_SearchTranslation3.disabled = False
		End If
		If SelectNumTrans.value > 3 Then
			Translation4.Value = Translate( objSettings.Item( "TransLang4" ) )
			Button_SearchTranslation4.disabled = False
		End If
	End If
End Sub


Sub OnClick_ButtonUpdate( )
	Dim strMsg, strQuote, strTitle

	Const vbCancel = 2
	Const vbYes    = 6
	Const vbNo     = 7

	If Left( BirdName.Version, 1 ) = "0" Then strQuote = Chr(34)
	strMsg   = "You are about to update the running BirdName program to its latest " & strQuote & "stable" & strQuote & " release." & vbCrLf _
	         & "A copy of the program will be saved, allowing a roll-back if necessary." & vbCrLf & vbCrLf
	If Left( BirdName.Version, 4 ) < "0.30" Then
		strMsg = strMsg & "The update to version " & BirdName.Version & " will render previous configuration files useless." & vbCrLf & vbCrLf
	End If
	strMsg   = strMsg & "Do you want to update now?"
	strTitle = "Confirm Update"
	If MsgBox( strMsg, vbYesNoCancel, strTitle ) = vbYes Then Update
End Sub


Sub OnClick_UseLocalLanguageNames( )
	Dim i, intIndex, objNewOption
	blnUseLocalLanguageNames = UseLocalLanguageNames.Checked
	If blnUseLocalLanguageNames Then
		intIndex = 1
	Else
		intIndex = 2
	End If
	Sort2Dim1 arrLang, intIndex

	SelectSourceLanguage.innerHTML  = ""
	For i = 0 To UBound( arrLang, 2 )
		Set objNewOption  = document.createElement( "OPTION" )
		objNewOption.Text = arrLang( intIndex, i )
		objNewOption.Value = arrLang( 0, i )
		objNewOption.title = arrLang( 3 - intIndex, i )
		If UCase( objSettings.Item( "DefaultLanguage" ) ) = UCase( arrLang( 0, i ) ) Then
			objNewOption.Selected = True
		End If
		SelectSourceLanguage.options.Add( objNewOption )
	Next

	SelectTargetLanguage1.innerHTML = ""
	For i = 0 To UBound( arrLang, 2 )
		Set objNewOption  = document.createElement( "OPTION" )
		objNewOption.Text = arrLang( intIndex, i )
		objNewOption.Value = arrLang( 0, i )
		objNewOption.title = arrLang( 3 - intIndex, i )
		If UCase( objSettings.Item( "TransLang1" ) ) = UCase( arrLang( 0, i ) ) Then
			objNewOption.Selected = True
		End If
		SelectTargetLanguage1.options.Add( objNewOption )
	Next

	SelectTargetLanguage2.innerHTML = ""
	For i = 0 To UBound( arrLang, 2 )
		Set objNewOption  = document.createElement( "OPTION" )
		objNewOption.Text = arrLang( intIndex, i )
		objNewOption.Value = arrLang( 0, i )
		objNewOption.title = arrLang( 3 - intIndex, i )
		If UCase( objSettings.Item( "TransLang2" ) ) = UCase( arrLang( 0, i ) ) Then
			objNewOption.Selected = True
		End If
		SelectTargetLanguage2.options.Add( objNewOption )
	Next

	SelectTargetLanguage3.innerHTML = ""
	For i = 0 To UBound( arrLang, 2 )
		Set objNewOption  = document.createElement( "OPTION" )
		objNewOption.Text = arrLang( intIndex, i )
		objNewOption.Value = arrLang( 0, i )
		objNewOption.title = arrLang( 3 - intIndex, i )
		If UCase( objSettings.Item( "TransLang3" ) ) = UCase( arrLang( 0, i ) ) Then
			objNewOption.Selected = True
		End If
		SelectTargetLanguage3.options.Add( objNewOption )
	Next

	SelectTargetLanguage4.innerHTML = ""
	For i = 0 To UBound( arrLang, 2 )
		Set objNewOption  = document.createElement( "OPTION" )
		objNewOption.Text = arrLang( intIndex, i )
		objNewOption.Value = arrLang( 0, i )
		objNewOption.title = arrLang( 3 - intIndex, i )
		If UCase( objSettings.Item( "TransLang4" ) ) = UCase( arrLang( 0, i ) ) Then
			objNewOption.Selected = True
		End If
		SelectTargetLanguage4.options.Add( objNewOption )
	Next
End Sub


</script>

<body style="filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#000000', EndColorStr='#606060')" onhelp="HelpMsg()">

<!--Add your controls here-->


<div id="UpdateBlock" style="display: none;">

<h3 id="Label_Update">Update</h3>

<div id="UpdateGroup" class="Group">

<table>
<tr>
	<td id="UpdateNotification" colspan="5">&nbsp;</td>
</tr>
<tr>
	<td colspan="5">&nbsp;</td>
</tr>
<tr>
	<td class="Content"><input type="button" class="Button" name="Button_Update" id="Button_Update" value="Update Now" onclick="OnClick_ButtonUpdate"></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="button" class="Button" name="Button_Download" id="Button_Download" value="Download" onclick="OnClick_ButtonDownload"></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_HideUpdateNotification" id="Button_HideUpdateNotification" value="Hide Notification" onclick="OnClick_ButtonHideUpdateNotification"></td>
</tr>
</table>



</div>

</div>



<div id="SettingsBlock">

<h3><span name="Label_Settings" id="Label_Settings" onclick="OnClick_ButtonConfigure">Settings</span><span style="width: 5em;">&nbsp;</span><input name="Button_Configure" id="Button_Configure" type="button" class="Button" value="Configure" onclick="OnClick_ButtonConfigure" style="vertical-align: middle;"></h3>

<div class="Group">

<table>
<tr>
	<td class="Content">
		<input type="checkbox" name="UseLocalLanguageNames" id="UseLocalLanguageNames" onclick="OnClick_UseLocalLanguageNames"><label for="UseLocalLanguageNames" id="Label_UseLocalLanguageNames" title="Deselect to use English language names">Use local language names</label></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content">
		<select name="SelectNumTrans" id="SelectNumTrans" size="1" onchange="OnChange_SelectNumTrans" style="width: 3em;"></select> <span id="Label_SimultaneousTranslations">simultaneous translations</span></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_HideSettings" id="Button_HideSettings" value="Hide Settings" onclick="OnClick_ButtonHideSettings"></td>
</tr>
</table>

</div>

</div>



<h3 id="Label_BirdName">Bird Name</h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="SelectSourceLanguage" id="SelectSourceLanguage" size="1" onchange="OnChange_SelectSourceLanguage" style="width: 20em;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="BirdnameInput" id="BirdnameInput" style="width: 25em;" onchange="OnChange_BirdnameInput" onclick="OnChange_BirdnameInput" onkeyup="OnChange_BirdnameInput"></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_Translate" id="Button_Translate" value="Translate" onclick="OnClick_ButtonTranslate" disabled></td>
</tr>
</table>

</div>



<h3 id="Label_ScientificName">Scientific Name</h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="Spacer" id="Spacer" style="width: 20em; visibility: hidden;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="ScientificName" id="ScientificName" onchange="OnChange_ScientificName" onclick="OnChange_ScientificName" onkeyup="OnChange_ScientificName" style="width: 25em;"></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_SearchScientificName" id="Button_SearchScientificName" value="Search Wikipedia" onclick="OnClick_ButtonSearchScientificName" disabled></td>
</tr>
</table>

</div>



<h3><span id="Label_Translation1">Translation</span><span id="Label_Trans1"> 1</span></h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="SelectTargetLanguage1" id="SelectTargetLanguage1" size="1" onchange="OnChange_SelectTargetLanguage1" style="width: 20em;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="Translation1" id="Translation1" style="width: 25em;" readonly></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation1" id="Button_SearchTranslation1" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation1" disabled></td>
</tr>
</table>

</div>



<div id="TranslationBlock2" style="display: block;">

<h3><span id="Label_Translation2">Translation</span> 2</h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="SelectTargetLanguage2" id="SelectTargetLanguage2" size="1" onchange="OnChange_SelectTargetLanguage2" style="width: 20em;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="Translation2" id="Translation2" style="width: 25em;" readonly></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation2" id="Button_SearchTranslation2" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation2" disabled></td>
</tr>
</table>

</div>

</div>



<div id="TranslationBlock3" style="display: none;">

<h3><span id="Label_Translation3">Translation</span> 3</h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="SelectTargetLanguage3" id="SelectTargetLanguage3" size="1" onchange="OnChange_SelectTargetLanguage3" style="width: 20em;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="Translation3" id="Translation3" style="width: 25em;" readonly></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation3" id="Button_SearchTranslation3" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation3" disabled></td>
</tr>
</table>

</div>

</div>



<div id="TranslationBlock4" style="display: none;">

<h3><span id="Label_Translation4">Translation</span> 4</h3>

<div class="Group">

<table>
<tr>
	<td class="Content"><select name="SelectTargetLanguage4" id="SelectTargetLanguage4" size="1" onchange="OnChange_SelectTargetLanguage4" style="width: 20em;"></select></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Content"><input type="text" name="Translation4" id="Translation4" style="width: 25em;" readonly></td>
	<td class="Spacer">&nbsp;</td>
	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation4" id="Button_SearchTranslation4" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation4" disabled></td>
</tr>
</table>

</div>

</div>

<p>&nbsp;</p>

<p style="margin: 0 auto 0 auto; text-align: center;"><input type="button" class="Button" name="Button_Clear" id="Button_Clear" value="Clear" onclick="OnClick_ButtonClear" disabled><span style="width: 10em;"></span><input type="button" class="Button" name="Button_Help" id="Button_Help" value="Help" onclick="HelpMsg"></p>



<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>

page last uploaded: 12 March 2012, 10:07