mail.app go online script help

I have a script for entourage that allows me to go on and offline when salling clicker app tells it to. It looks like this:

— Handle proximity events

on entered_proximity()
tell application “System Events”
if exists process “Entourage” then
tell application “Entourage”
set status to go_offline
if status then
set go_offline to false
end if
end tell
end if
end tell
end entered_proximity

on left_proximity()
tell application “System Events”
if exists process “Entourage” then
tell application “Entourage”
set status to go_offline
if status is false then
set go_offline to true
end if
end tell
end if
end tell
end left_proximity

I don’t know anything about scripts, but I would like it to do the same thing in mail.app

Thanks in advance for any help