As your code is written, you would be callling
There is no variable by that name, so when you end up doing
you will either be doing the equivalent of
or, esp. in MSIE browsers,
alert( the_object_with_the_id_of_layer1 )
(because MSIE treats IDs as object references if you don't override that meaning).