Need Help Downloading image from web that IS a URL.

Hi, I’m trying to download an image that is not a jpg or gif. It’s a URL (I think). Here is the website and code that I have so far…

tell application "Safari"
	open location "http://chem.sis.nlm.nih.gov/chemidplus/direct.jsp?regno=000050000"
	delay 2
	repeat with t from 1 to 5 -- this is to wait for the page to be complete.
		if (do JavaScript "document.readyState" in document 1) is equal to "complete" then
			exit repeat
		else
			delay 2
		end if
	end repeat
	
	open location "http://chem.sis.nlm.nih.gov/chemidplus/ProxyServlet?objectHandle=Search&actionHandle=getAll3DMViewFiles&nextPage=jsp%2Fcommon%2FChemFull.jsp%3FcalledFrom%3Dlite&chemid=000050000&formatType=_3D"
	delay 2
	repeat with t from 1 to 5 -- this is to wait for the page to be complete.
		if (do JavaScript "document.readyState" in document 1) is equal to "complete" then
			exit repeat
		else
			delay 2
		end if
	end repeat
end tell

-- The image is in the second page and contained in the URL below, and I have no idea how to save it as a jpg or png file
--http://chem.sis.nlm.nih.gov/chemidplus/RenderImage?maxscale=30&width=200&height=200&superlistid=000050000

Any help is greatly appreciated,
-DW

tell application "Safari"
	open location "http://chem.sis.nlm.nih.gov/chemidplus/RenderImage?maxscale=30&width=200&height=200&superlistid=000050000"
	save document 1
end tell

There’s no reason to use safari for this. The unix program curl an do it. The -o option writes the output file.

set theURL to "http://chem.sis.nlm.nih.gov/chemidplus/RenderImage?maxscale=30&width=200&height=200&superlistid=000050000"

do shell script "curl " & quoted form of theURL & " -o ~/Desktop/RenderImage.png"

This works great!! You guys are awesome, Thank you very much for your help!!!
-DW