Question [Q] Is it possible to select input method depending on phone orientation?

I like Swype, and I like 8pen, depending on the orientation my phone is in at the time. If my phone is upright, then I would like to use 8pen as my input method. However when I turn my phone on its side I would like the input method to automatically switch to Swype, and then back to 8pen if my phone is upright again. Is there a way I can do this?