// insert a images file in the current document, instead of popping up a new
// window when "cover photo" is clicked.
// if no script available, then still create new window with image
// remove the link that was clicked on to get image
function insert_image(node, image)
{
	var newnode = document.createElement("img");
	newnode.setAttribute("src",image);
	node.parentNode.insertBefore(newnode,node);
	node.parentNode.removeChild(node);
}

// search and execute all insert_image function
function expand_images(d)
{
	for(var i = d.links.length-1; i >= 0; i--)
	{
		// look for all image files, which have href=image/
		// the link will be expanded out to include full address so look for any occurance of image
		if(d.links[i].href.indexOf("images") == -1)
			continue; // not an image link
		d.links[i].onclick();
	}
}
