RE-did the function to select the window upon clicking taskbar icons and
main window icons