on run
	substitute("Yeah?")
end run
on substitute(severalBrowsersPrompt)
	set candidates to {}
	set labelledcandidates to {}
	set candidateURLs to {}
	tell application "System Events"
		if ((application processes whose (name is equal to "Opera")) count) is greater than 0 then
			tell application "Opera"
				if (number of documents) is greater than 0 then
					set iWindowInfo to GetWindowInfo (the first item of items in (ListWindows))
					set the end of labelledcandidates to "Opera: " & (name of front document)
					set the end of candidates to (name of front document)
					set the end of candidateURLs to (URL of front document)
				end if
			end tell
		end if
		if ((application processes whose (name is equal to "Safari")) count) is greater than 0 then
			tell application "Safari"
				if (count of documents) is greater than 0 then
					set the end of labelledcandidates to "Safari: " & (name of front document)
					set the end of candidates to (name of front document)
					set the end of candidateURLs to URL of front document
				end if
			end tell
		end if
		if ((application processes whose (name is equal to "OmniWeb")) count) is greater than 0 then
			tell application "OmniWeb.app"
				if (count of every «class Owbc») is greater than 0 then
					set the end of labelledcandidates to "OmniWeb: " & (name of front «class Owbc»)
					set the end of candidates to (name of front «class Owbc»)
					set the end of candidateURLs to «class curl» of front «class Owbc»
				end if
			end tell
		end if
		if ((application processes whose (name is equal to "Camino")) count) is greater than 0 then
			using terms from application "Camino.app"
				tell application "Camino.app"
					if version1.6 then
						if (count of every window) is greater than 0 then
							set the end of labelledcandidates to "Camino: " & (name of front window)
							set the end of candidateURLs to the URL of the «class pCTb» of front «class BWin»
							set the end of candidates to name of front window
						end if
					end if
					if version1.0 and version < 1.6 then
						if (count of every window) is greater than 0 then
							set the end of labelledcandidates to "Camino: " & (name of front window)
							set the end of candidateURLs to the «class curl» of front window
							set the end of candidates to name of front window
						end if
					end if
				end tell
			end using terms from
		end if
		if ((application processes whose (name is equal to "firefox-bin")) count) is greater than 0 then
			tell application "Firefox"
				if (count of every window) is greater than 0 then
					set firefoxProperties to properties of front window as list
					set the end of labelledcandidates to "Firefox: " & (item 2 of firefoxProperties)
					set the end of candidateURLs to item 3 of firefoxProperties
					set the end of candidates to item 2 of firefoxProperties
				end if
			end tell
		end if
		if ((application processes whose (name is equal to "NetNewsWire")) count) is greater than 0 then
			tell application "NetNewsWire.app"
				if («class SeTb») is greater than 0 then
					set nnwselT to «class SeTb» -- the news items tab is not present in the lists of titles and tabs, so we have to bump this
					-- gotta prefetch these
					set nnwtitles to «class TbTl»
					set nnwurls to «class TbUr»
					set the end of labelledcandidates to "NetNewsWire: " & (item nnwselT of nnwtitles)
					set the end of candidates to (item nnwselT of nnwtitles)
					set the end of candidateURLs to (item nnwselT of nnwurls)
				end if
			end tell
		end if
		if ((application processes whose (name is equal to "Shiira")) count) is greater than 0 then
			tell application "Shiira.app"
				if (count documents) > 0 then
					set the_doc to document 1
					set the end of labelledcandidates to "Shiira: " & name of the_doc
					set the end of candidates to name of the_doc
					set the end of candidateURLs to URL of the_doc
				end if
			end tell
		end if
		if ((count of labelledcandidates) is greater than 1) then
			set theChosen to {}
			try
				tell application "Adium"
					set theChosen to (choose from list labelledcandidates with prompt severalBrowsersPrompt)
				end tell
			on error
				return ""
			end try
			if theChosen is not equal to {} then
				repeat with chosen in theChosen
					set i to 1
					repeat with aName in labelledcandidates
						if aName & "" is equal to chosen & "" then
							return (item i of candidates) & ": " & (item i of candidateURLs)
						end if
						set i to i + 1
					end repeat
				end repeat
			end if
		else if ((count of labelledcandidates) is 1) then
			return (item 1 of candidates) & ": " & (item 1 of candidateURLs)
		else
			return ""
		end if
	end tell
end substitute