Focus on autofocus attr in popup

Focuses on an input field with the autofocus attribute defined,
otherwise focuses on the 1st or a button
Merge pull request #1 from zrgravity/fixPopupFocus

Focus on autofocus attar if exists in popup