tell application "Safari"

set username to "_USERNAME_"

set mypasssword to "_PASSWORD_"

set usepass to username & ":" & mypasssword

set theURL to URL of front document

set theURL to do JavaScript "escape(document.URL)" in front document

set theTitle to do JavaScript "escape(document.title)" in front document

set thePlainTitle to do JavaScript "document.title" in front document

set theDelURL to "https://api.del.icio.us/v1/posts/add?url=" & theURL & "&description=" & theTitle & "&tags=@comment&shared=no"

--https://api.del.icio.us/v1/posts/add

set theresult to do shell script "/usr/bin/curl -u " & usepass & " \"" & theDelURL & "\""

tell application "GrowlHelperApp"

-- Perform some Growl housekeeping tasks to register ourselves.

set the allNotificationsList to {"Submit Result"}

set the enabledNotificationsList to {"Submit Result"}

register as application ¬

"@comment Script" all notifications allNotificationsList ¬

default notifications enabledNotificationsList

if theresult contains "done" then

-- Talk to Growl

notify with name ¬

"Submit Result" title thePlainTitle description "Successfully Submitted" application name ¬

"@comment Script"

else

notify with name ¬

"Submit Result" title thePlainTitle description "Submission Failed!" application name ¬

"@comment Script"

end if

end tell

end tell