anchor.diff:              <%
                 if ("foreignSources".equals(heatmap)) {
               %>
  -            location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByForeignSource&foreignSource=" + nodes[0].id;
  +            location.href = "<%=request.getRequestURI()%>?mode=<%=Util.encode(mode)%>&heatmap=nodesByForeignSource&foreignSource=" + encodeURIComponent(nodes[0].id);
               <%
                 }
   
                 if ("categories".equals(heatmap)) {
               %>
  -            location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByCategory&category=" + nodes[0].id;
  +            location.href = "<%=request.getRequestURI()%>?mode=<%=Util.encode(mode)%>&heatmap=nodesByCategory&category=" + encodeURIComponent(nodes[0].id);
               <%
                 }
   
                 if ("monitoredServices".equals(heatmap)) {
               %>
  -            location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByMonitoredService&monitoredService=" + nodes[0].id;
  +            location.href = "<%=request.getRequestURI()%>?mode=<%=Util.encode(mode)%>&heatmap=nodesByMonitoredService&monitoredService=" + encodeURIComponent(nodes[0].id);
               <%
                 }
   
                 if ("nodesByCategory".equals(heatmap) || "nodesByForeignSource".equals(heatmap) || "nodesByMonitoredService".equals(heatmap)) {
               %>
  -            location.href = "/opennms/element/node.jsp?node=" + nodes[0].elementId
  +            location.href = "/opennms/element/node.jsp?node=" + encodeURIComponent(nodes[0].elementId);
               <%
                 }
               %>
  
positive.code:         <%
              if ("foreignSources".equals(heatmap) || "nodesByForeignSource".equals(heatmap)) {
          %>
          <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=categories">Categories</a> / <b>Foreign Sources</b> / <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=monitoredServices">Services</a>
          <%
              } else {
                  if ("categories".equals(heatmap) ||"nodesByCategory".equals(heatmap)) {
          %>
          <b>Categories</b> / <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=foreignSources">Foreign Sources</a> / <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=monitoredServices">Services</a>
          <%
                  } else {
          %>
          <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=categories">Categories</a> / <a href="<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=foreignSources">Foreign Sources</a> / <b>Services</b>
          <%
                  }
              }
  
negative.code:                 ],
                  "labelsEnabled": true,
                  "nodeData": {
                      "id": "<%=Util.encode(heatmap)%>",
                      "children": children
                  }
              }).bind('treemapclick', mouseclickHandler);
  