My operating system ha been somewhat malfunctioning over the past week. Everyone once in a while the window I am working on is un-selected, but another one is NOT selected and there are no alerts. I know this is a problem with the OS because it does this across all programs, not just specific ones. I am using Windows 7 Home Edition.
Are you using a desktop or a laptop?
did you install anything before that? run antivirus antimalware scan?
Window may get un selected when another program takes control of active application.
Check if any notification or pop up in the background has came up.