Summary:
You have customized the ADFS sign-in page with your own jscript code per
https://technet.microsoft.com/en-us/library/dn636121.aspx
All works fine when the page is viewed in IE, but does not work right when viewed as a popup from Office.
Current Status:
Right now this is a design limitation, the code simply does not run.
The product group has been informed of this limitation and it may or may not be addressed in the future.