(function($) {
	$.fn.togglePhoto = function() {
		
		if ($(this).find('option:selected').attr('data-part-number').length) {
			var size = $(this).find('option:selected').attr('data-part-number');
			var imageDiv = $(this).find('div.' + size);
			
			if (imageDiv.length) {
				if (imageDiv.find('img').attr('complete')) { // FF returns true even if the image is not loaded
					$(this).parent().parent().find('div').css('z-index', '0');
					imageDiv.css('z-index', '1');
					imageDiv.show();
				}
			}
		}
	};
})(jQuery)
