JSlint
Run the 'temporary set layer visibility property to false ...' only on
set visibility to true.

Move the delayed setVisibility true in the WMS layer to be delayed in
all case.
Merge pull request #619 from camptocamp/fix-wmts-layers

 Run the 'temporary set layer visibility property to false ...' only on