The question boils down to the same one asked here:
There are some solutions given in that thread that you could incorporate.