I'd like to create a subdomain to my wordpress blog with a mobile theme installed on it. The domain will be something like http://mobile.XXXXXX.com
Basically what I want is for the website to detect if it's accessed from a mobile device or a desktop, and then load the mobile theme or the desktop theme accordingly.
How would I go about creating something like this from scratch? Is it possible to set wordpress up so that it uses a different theme when accessed through the http://mobile.XXXXXX.com subdomain?
I'd rather not use any plugins for maximum flexibility.