Script works in Jaguar, not in Panther

this script is working fine in jaguar

tell application "Finder" to quit
display dialog "Show Hidden Files..." buttons {"ON", "OFF"} �
	default button 3
copy the result as list to {buttonpressed}

try
	if the buttonpressed is "OFF" then do shell script �
		"defaults write com.apple.finder AppleShowAllFiles OFF"
	if the buttonpressed is "ON" then do shell script �
		"defaults write com.apple.finder AppleShowAllFiles ON"
end try

tell application "Finder" to launch

but when i run this in Panther it gives error “Parameter Error”
please give some suggestion.
Thanks

I cleaned your script a bit so the default button toggles between “OFF” & “ON” and streamlined the rest of the code. This works fine on my Mac OS 10.3.2 system:

property last_button : 2

if last_button = 2 then
	set last_button to 1
else
	set last_button to 2
end if
tell application "Finder" to quit
set buttonpressed to button returned of (display dialog "Show Hidden Files..." buttons {"ON", "OFF"} default button last_button)

try
	do shell script "defaults write com.apple.finder AppleShowAllFiles " & buttonpressed
end try

tell application "Finder" to launch

Jon

thanks you very much john8 you have helped me a lot many times.
i am still wondering is there any difference between jaguar and panther scripting.