Simplify fader code

There is no need to calculate prev as we already had it.
Do not start fader twice

It automatically starts in initialize(), starting it second time causes
these two faders to compete and in case of two images it actually
disables fading.
Whitespace cleanup
Coding style improvements
Fix some possible issues in javascript