Hi Frank,
A few things will fix the code you posted.
Remove the following line or add a null check:
f['__VIEWSTATE'].name = 'NOVIEWSTATE'
f['__VIEWSTATE'] could be null and accessing the name property of a null object will cause the script to crash.
Also, you will need to change the name of the login and password properties.
"loginUsername" should be changed to "Username"
"loginPassword" should be changed to "Password"
After those changes are made it should start working!
Cheers,
Mike