ok, i've posted the whole code in my first post.
Well, then I posted the whole answer in my first reply..