Hello. I didn't read the thread, but I think, that this code help you https://gist.github.com/1031576.