Problem with checkbox and form using jQuery

Problem with checkbox and form using jQuery

Hi all
 
I'm currently developing a webapp that use google map api with some elements overlays on the map using checkbox to activate. I've tried to use jQuery to make iphone style checkbox however it won't work.
 
When a check box is checked, it has the event onClick="SwitchLayer()".
 
SwitchLayer() will search for all element in " document.forms[0].elements[i]" then print overlay elements on google map.
 
However, when I add a tag that activate iphone style checkbox to one of my checkbox element, this element will not be added to the form.
 
Here is the example
My checkbox elements are A,B, and C then
document.forms[0].elements[0] is A
document.forms[0].elements[1] is B
document.forms[0].elements[2] is C
 
but when I add iphone style tag to element A then
document.forms[0].elements[0] is B
 
Element A totally disappear.
 
Any idea and how to fix?