(function($) 
	{
	$.fn.lightbox_me = function(options) 
		{
		return this.each(function() 
			{
			var
      $overlay = $('<div class="' + options.classPrefix + '_overlay"/>'),
      $self = $(this);
      $('body').append($self).append($overlay);
			setSelfPosition();
			$self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1,  zIndex: (1002) });
			setOverlayHeight();
      $overlay.css({ position: 'fixed', width: '100%', top: 0, left: 0, zIndex: (1001), display: 'none' }).css({background: 'black', opacity: .5});
			$overlay.fadeIn(300, function() 
				{
				$self["fadeIn"]("fast", function() { setOverlayHeight(); });
				});
			function setOverlayHeight() 
				{
				if($(window).height() < $(document).height()) 
					{
					$overlay.css({height: $(document).height() + 'px'});
					}
				else 
					{
					$overlay.css({height: '100%'});
          }
				}
			function setSelfPosition() 
				{
				var window_width = (window.innerWidth ? window.innerWidth : document.body.offsetWidth);
				$overlay.css({width: window_width});
				if($self.height() + 80  >= $(window).height()) 
					{
			 		var topOffset = $(document).scrollTop() + 40;
					$self.css({position: 'fixed', top: topOffset + 'px', marginTop: 0})
					} 
				else if($self.height()+ 80  < $(window).height()) 
					{
          $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1})
					}
				}
			});
		};
	})(jQuery);
