contact form in popup block
You don't need to write a custom module. You can use the popups api module. All you will have to do is assign the link a class called as "popups". Refer to the api if you want to do it the custom way as well using the popup api.

Summary of the module


  API for building modal ajax dialogs. Its focus is on putting forms
  inside of ajax popup dialogs. Current example can present pages as
  popups (of the lightbox type). This is amazingly useful for things
  like confirmation pages. And the best part is it can be applied
  retroactively to a page without needing to modify the generating
  module, and (of course) it degrades gracefully.