There is some code similar to what you want here.

Thread

If you have trouble making it work, or adapting it to simply multi-texturing, then go ahead and post in that thread.

A note: I have heard that a future "3PM" will have an article on this. I may be wrong, tho.