// the functions in this file require the supplementary library lib.js

listen('load', window, function() {
	mlisten('click', getElementsByClass('thumbnail','a'), imgswap );
});
			

function imgswap(e) {

	// to be passed as an event listener
	// swaps the bigimg on the page with the href of the anchor tag
    
	var element = e.currentTarget;
    
	var target = element.getAttribute('target') || '';
	var newsrc = element.getAttribute('href') || '';

    if (target && newsrc) {
		
		var bigimg = getElem(target) || '';

		if (bigimg)
			bigimg.src = newsrc;
	    
	    e.preventDefault();
	}
}
