Ping Ip and Mount share if exists

Hi there. I am trying to write a script for a server to mount a share. This means not manually clicking ‘ok’ if the share I am trying to mount is offline. I’ve put together the below but the script is returning the packet details in a new window instead of just passing to the next part of the script. Attached what the script is returning below.

What I need it to do is test if the Ip adress exists and if so mount the share if its not already mounted.

http://dl.dropbox.com/u/6790294/Screen%20shot%202012-04-11%20at%2010.42.56%20AM.png

        set IP_Address to "xx.x.xx.xxx"
	repeat while (do shell script "ping -c 2 -q " & IP_Address) contains "100% packet loss"
		delay 5
	end repeat
	-- end test if sfnas exists
	tell application "Finder"
		set theVOLUMES to every disk in desktop
	end tell
	try
		set theExistingVolumes to {}
	on error
		{}
	end try
	
	--make a list of all the volume names
	try
		repeat with i in theVOLUMES
			set a to name of i
			set end of theExistingVolumes to a
		end repeat
	on error
		{}
	end try
	if "share" is not in theExistingVolumes then
		repeat until "share" is in theExistingVolumes
			
			try
				mount volume "smb://adress/share"
				
			end try
		end repeat
	end if

Alternatively I have also tried the script below. Problem being that even if the ping fails, after the delay of 30 seconds the script just proceeds the mounting step.

	-- connect to hotfolder start	
	-- test if sfnas exists
	set serverIP to "x.x.x.x"
	set pingResult to "100% packet loss"
	set serverFound to false
	
	repeat while not serverFound
		try
			set pingResult to (do shell script ("ping -c 1 " & serverIP))
		on error e
			set pingResult to e
		end try
		
		if pingResult contains "100% packet loss" then
			-- server not found; delay and then try again
			set serverFound to false
			delay 5
		else
			-- server found; exit loop and mount server
			set serverFound to true
		end if
		
	end repeat
	
	-- delay to allow server to finish booting
	delay 30
	-- end test if sfnas exists
	
	
	tell application "Finder"
		set theVOLUMES to every disk in desktop
	end tell
	try
		set theExistingVolumes to {}
	on error
		{}
	end try
	
	--make a list of all the volume names
	try
		repeat with i in theVOLUMES
			set a to name of i
			set end of theExistingVolumes to a
		end repeat
	on error
		{}
	end try
	if "share" is not in theExistingVolumes then
		repeat until "share" is in theExistingVolumes
			
			try
				mount volume "smb://server/share"
				
			end try
		end repeat
	end if
	-- connect to hotfolder end