jQuery(function($) {
	$('a.image-swapper-link').live('click', function(e) {
		var width; // = $(this).closest('.article').find('.article-media img').attr('width');
		var new_href = $(this).attr('href');
		//width = (width) ? ' width="'+width+'"' : '';
		$(this).closest('.article').find('a.image-swapper-link.active').removeClass('active');
		$(this).addClass('active');
		var image = $('<img src="' + new_href.replace('/icon','/medium') + '" alt="' + $(this).attr('title') + '"'+width+' class="article-image" />');
		var caption = '<p class="article-media-caption">' + $(this).attr('title') + '</p>';
		$(this).closest('.article').find('.modal-box-link').attr('href',new_href.replace('/icon','').replace('/medium',''));

		$(this).closest('.article').find('.media-wrapper.image').html(image);
		
		$(this).closest('.article').find('.article-media-caption').remove();
		$(this).closest('.article').find('.article-media').append(caption);

		Shadowbox.init();
				Shadowbox.setup(".modal-box-link", {
					gallery:  "Images",
					height:		602,
					width:		963				});


		e.preventDefault();
	});
});
