// the function addimage() adds an image to hyperlinks with class equal to 'snapshot'
	function addimage() {
		// Loop over all links
		var links=document.getElementsByTagName('a');
	
		// Define test pattern 	
		var previewTest = new RegExp("(^|\\s)" + 'snap_shots' + "(\\s|$)");

		// Loop over all links and filter out links without the necessary class
		for(var i = 0;i<links.length;i++)	{
			if(!previewTest.test(links[i].className)){continue;}
			var newimg = document.createElement('img');
			newimg.src = 'http://open.thumbshots.org/image.aspx?url='+links[i].href;
			newimg.alt = 'loading thumbshot...';
			links[i].parentNode.insertBefore(newimg,links[i].nextSibling);			
		}
	}	
	
	window.onload = function() {
		addimage()
	}
