// Image Node Auto-Format with Auto Image Grouping
// Steve McKenzie

function lightbox2_image_nodes() {
	var nodes = document.getElementsByClassName("image");
	for (var i = 0; i < nodes.length; i++) {
		if (Element.hasClassName(nodes[i], "thumbnail")) {
			var parent = nodes[i].parentNode;

      //MS: The following two lines check to see if this is the list of galleries, and if it is, does not run the AJAX.
      var galCheck = nodes[i].parentNode.parentNode.parentNode;
      if(galCheck.className != 'galleries') {
        //MS: And, of course, there's a closing bracket around this whole thing too, four lines down.
        parent.rel = "lightbox[node_thumbnails]";
	  		parent.href = nodes[i].src.replace(".thumbnail", "");
		  	parent.title = nodes[i].alt;
      }
    }
	}
}

if (isJsEnabled()) {
  addLoadEvent(lightbox2_image_nodes);
}
