/**
 * Show thumbnail
 * @param {Object} padding padding to apply to the right
 * @param {Object} url the url to the image to display
 */
function showPopup(left, elem, url)
{
	var padding = 15;
	elem = $(elem);
	var position = elem.offset();
	
	$("body").append('<div id="popup" style="position: absolute; border: 1px solid black; z-index: 999;"><img src="'+ url + '" /></div>');
	
	if(left)
	{
		$("#popup").css("right", $(document).width() - position.left + padding).css("top", position.top - 150);
	}
	else
	{
		$("#popup").css("left", position.left + elem.width() + padding).css("top", position.top - 150);
	}
}

/**
 * Close thumbnail
 */
function closePopup()
{
	$("#popup").remove();
}