You can use a story variables to track the current state of each of your toggles.
1. Initialise the story variables within your projects StoryInit special passage.
note: I'm not sure if your toggles start out as displaying the content or not so I will assure that they do and assign the variable an initial value of true, if they don't then change the initial value to be false.
<<set $background to true>>
2. You can then change your toggle links to flip the associated story variable between true and false whenever they are selected.
<<click "Toggle: Background">>
<<script>>$('#scene .layer0').toggle()<</script>>
<<set $background to not $background>>
<</click>>