Hi
1) Can you show the complete code that you tried? Do you have a test page online so that I can try myself?
2) I don't know
But I'm sure you'll be able to find the formula with Google, then if you still have problems to translate it to a post-fx I'll be able to help you more.