The IBM/Lenovo Thinkpads' Access Connections program will do this automatically, and will seamlessly work across multiple DUN, wireless and wired networks. I currently have 15 profiles stored, of which I use 8 regularly. The AC program figures out what profile to apply based on what available connection it sees.
Caveat: It may or may not work with your laptop, as I've never tried it on anything other than a Thinkpad.*
* Of course, this begs the question why anyone would use anything other than a Thinkpad, but we can save that religious war for another day. 