I want to do exactly what SitePoint does when you click on the "insert link" icon. Basically popup a little window asking for the URL and the text to be linked. Then when they click add it will put those values into the textarea on the form. I want to make sure that whatever the user has already wrote into the form is not replaced by the link, but the link is appended to the end.

Any help would be great! Thanks