A quick trip to Google yielded
http://javascript.about.com/library/blfav.htm it looks alright but I haven't tried it.
Make sure you include a <noscript> block with alternate information for all the people browsing with JavaScript turned off for one reason or another.
IMHO it's not worth the effort of adding this feature, those that know about bookmarks will add a bookmark to your site if they want to, while those that don't know about bookmarks probably won't be any the wiser after they've clicked the add link.