// JavaScript Document

// create an object with a  method(function) to be called by core.start
var LinkIcons = 
{
	init: function()
	{
// step one : collect all the link elements in the content div
	var content = document.getElementById("content");
	var docLinks = content.getElementsByTagName("a");
	// creates an array called docLinks

// step two: find which ones have an image as a child element
	// keep going until all links checked
	for (var i = 0; i < docLinks.length; i++)
	{
		// current link
		var thisLink = docLinks[i];
		// this link may have multiple children - new nodeslist
		var children = thisLink.childNodes;
		// go through all children looking for images
		for (var j = 0; j < children.length; j++)
			{
				// current child
				var thisChild = children[j];		
				// if the current child is an image
				if (thisChild.nodeName == "IMG")
				// give the current link the class noIcon
				Core.addClass(thisChild.parentNode, "noIcon");
			}
		};
	}
}
Core.start (LinkIcons);
