//  thumbnail rollover
//  Based on "domroll" by Chris Poole ( http://chrispoole.com/scripts/dom_image_rollover_hover )
//
//  This function finds all the images on the page that are in class "clazz"
//  and wraps them in an anchor tag that links to the full sized image.
//  the "href" attribute for the anchor will be the "src" attribute of the image,
//  after a regular expression replace of "pattern" with "repl"

function addAnchorsForThumbnailImages(clazz,pattern,repl) 
{
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;

	var images=document.getElementsByTagName('img');
	for (i=0;i<images.length;i++)
    {
        image = images[i];
		if (image.className.indexOf(clazz)==-1)
            continue;
        src = image.getAttribute('src');
        fullimage = src.replace(pattern,repl);

        var anchor = document.createElement("a");
        anchor.setAttribute("href",fullimage);
        var parent = image.parentNode;
        parent.insertBefore(anchor,image);
        parent.removeChild(image);
        anchor.appendChild(image);
	}
}
