window.onload = function() {
  var linkedName = window.location.hash.split('#')[1];

  var visUrl = "https://openaustin.cartodb.com/u/oa-admin/api/v2/viz/cb394812-8b56-11e5-91c0-0ecd1babdde5/viz.json"
  var toggleLayers = {};

  cartodb.createVis(map, visUrl)
    .on('done', function(vis, layers) {
      for (var i = 0, len = layers[1].layers.length; i < len; i++) {
        var layer = layers[1].layers[i];
        toggleLayers[layer.layer_name] = layer;

        var element = $('<a>')
          .attr('id', layer.layer_name)
          .attr('href', '#' + layer.layer_name)
          .addClass('button')
          .addClass(layer.layer_name)
          .text(layer.layer_name)
          .click(function (event) {
            var clickedName = event.target.id;
            setLayer(clickedName);
          });
        $('#menu').prepend(element);

        if (linkedName !== '' && toggleLayers.hasOwnProperty(linkedName)) {
          setLayer(linkedName);
        } else if (i === 0) {
          setLayer(layer.layer_name);
        }
      };
    });

  function setLayer(layerName) {
    var keys = Object.keys(toggleLayers);
    for (var i = 0, len = keys.length; i < len; i++) {
      var key = keys[i];
      toggleLayers[key].sub.hide();
    }

    toggleLayers[layerName].sub.show();

    $('.button').removeClass('selected');
    $('#' + layerName).addClass('selected');
  }
}

@@ -303,111 +303,55 @@
     
-for (var i = 0, len = layers%5B1%5D.layers.length; i %3C len; i++) %7B%0A        var layer = layers%5B1%5D.layers%5Bi%5D;
+$.each(layers%5B1%5D.layers, function(idx, layer) %7B
 %0A   
@@ -915,16 +915,18 @@
 se if (i
+dx
  === 0) 
@@ -923,24 +923,24 @@
 dx === 0) %7B%0A
-
           se
@@ -982,16 +982,17 @@
 %0A      %7D
+)
 ;%0A    %7D)
@@ -1035,149 +1035,64 @@
     
-var keys = Object.keys(toggleLayers);%0A    for (var i = 0, len = keys.length; i %3C len; i++) %7B%0A      var key = keys%5Bi%5D;%0A      toggleLayers%5Bkey%5D
+$.each(toggleLayers, function(name, layer) %7B%0A      layer
 .sub
@@ -1105,16 +1105,18 @@
 );%0A    %7D
+);
 %0A%0A    to

use $.each for looping instead of Object.keys for IE8 support