Legend TOC checkboxes not working

I have built a web-map using this sample code and I cannot figure out why the TOC doesn't work in my webmap. The Legend loads properly but the TOC with checkboxes does not. Here's my code. What am I missing?

Jay, thank you that worked! I made that change and the checkbox appeared. Now I have another problem....

I have switched to pulling in to FeatureLayer services instead of the entire MapService. This is exactly how the code sample was structured in the code gallery. For some reason only the first layer is appearing in the legend. The second one does not appear and nothing is appearing at all in the TOC. Here's my code:

Correction, I see now the example code is done with two MapService layers instead of with two FeatureService Layers. So can this even be done with FeatureService layers? I'll try switching to two MapService...

// ************* THIS IS THE CODE to make the checkboxes turn on and off the feature layer ****************************
function layerVisibility(layer) {
(layer.visible) ? layer.hide() : layer.show();
}