How do I make my dome light fade away when you shut the door?

This is what I found for the "soft off" lighting. http://www.mazdaspeeders.com/index.php?topic=68353.0