var largeImg = document.getElementById('largeImg');
document.getElementById('thumbs').onclick = function(event) {
while (event.target != this) {
if (event.target.nodeName == 'A') {
largeImg.src = event.target.href;
return false;
}
event.target = event.target.parentNode;
}
}
event.target = event.target.parentNode;