﻿/// <reference path="../js/jquery-vsdoc.js" />
/// Places image's alt in div under the picture
(function($) {
	jQuery.fn.labeled_image = function() {
		$("img", this).each(function() {
			if ($(this).attr("alt") != '') {
				var padding = parseFloat($(this).offsetParent().css('padding-left'));
				var left = $(this).position().left;
				if (jQuery.browser.msie && parseFloat(jQuery.browser.version) < 7) {
				//	left = left - padding;
				}
				var PicName = $("<div class='ImageLabel'>" + $(this).attr("alt") + "</div>")
		.insertAfter($(this))
		.css({
			"position": "absolute",
			"left": left + "px",
			"top": parseFloat($(this).position().top) + parseFloat($(this).outerHeight(false)) + 5 + "px",
			"width": parseFloat($(this).innerWidth()) + 2 + "px"
		});
				$(this).css("margin-bottom", parseFloat(PicName.outerHeight(true)) + parseFloat($(this).css("margin-bottom")) + "px");
			};
		});
		return this;
	};
})(jQuery);
