In S4E01 of The Office, Pam knocks on Michael's door - to correct his hilarious misunderstanding of what a "5k run" means - and Michael clearly tells her to come in. Pam then proceeds to open the door, only to find Michael hurriedly putting on his pants, with his private parts still exposed (blurred on TV).
Why does Michael ask Pam to come in if he's not wearing pants? Does he want Pam to see him naked (he is shown to be attracted to Pam almost throughout the show, although he never seriously pursues a relationship with her)? Or did he, out of stupidity, not realize that he wasn't wearing pants when Pam knocked? Other explanations?