Refactor find functions for find.php to use a common findWindow function