$(this).attr('href')
get current a tag href
attribute.
$(".thumnails").on("mouseover mouseout", "a", function () {
$('#' + $(this).attr('href')).toggle();
});
and
set 2nd image id to image-2
Id must be unique. Don't use same id for multiple elements.
Read Two HTML elements with same id attribute: How bad is it really?