How does the phone know it has been docked
Typically, the phone knows whether it has been docked by the placement of a magnet on a certain area on the back of the phone.  You can therefore create your own cheap dock using a magnet and some sort of stand.  Here is an example with the Droid.