answered Jul 5 '13
I guess this stackoverflow topic gives you a hint on how you could approach the problem.