(function($){
	$.fn.lightbox=function($element, options){
		var defaults={position:'absolute'};
		var options=$.extend(defaults,options);
		$element.hide().prependTo('body');
		$(window).resize(function(){
			$('div#screen:visible').css({width:$(window).width(),height:$(document).height()});
			$element.filter(':visible').css('left',($(window).width()-$element.width())/2+'px');
		});
		return this.each(function(){
			$(this).click(function(){
				$('body').prepend('<div id="screen"></div>');
				$('div#screen')
					.hide()
					.css({position:'absolute',left:'0px',top:'0px',background:'#000',opacity:0.8,width:$(window).width(),height:$(document).height()})
					.fadeIn()
					.click(function(){$element.closebox();});
				$element.css(options).css({top:$(window).scrollTop()+20+'px',left:($(window).width()-$element.width())/2+'px'}).slideDown();
			});
		});
	};
	$.fn.closebox=function(){
		$(this).slideUp();
		$('div#screen').fadeOut(function(){$(this).remove();});
	};
})(jQuery);