/**
 * Litebox Plugin
 *
 * @version 0.2 (07/12/2009)
 * @requires jQuery v1.3.2+
 * @author Alex Weber <alexweber.com.br>
 * @copyright Copyright (c) 2009, Alex Weber
 * @license http://www.opensource.org/licenses/bsd-license.php
 *
 * Distributed under the terms of the new BSD License
 */
 
(function(a){a.fn.litebox=function(b){var c={target:"litebox",close:"close",overlay:"overlay",overlayBg:"222",overlayOpacity:"0.8",overlayShowSpeed:300,overlayHideSpeed:900,liteboxShowSpeed:450,liteboxHideSpeed:500};if(b){if(typeof b=="object"){a.extend(c,b)}else{c.target=b}}this.each(function(){var f=a(this),e,g,d=a("#"+c.target);d.hide();e=(d.width()+parseInt(d.css("paddingLeft").replace("px",""))+parseInt(d.css("paddingRight").replace("px","")))/2;g=(d.height()+parseInt(d.css("paddingTop").replace("px",""))+parseInt(d.css("paddingBottom").replace("px","")))/2;a.data(f.get(0),"litebox",d.html());d.remove();d=null;f.click(function(){var h,j,i;j=(a(window).width()/2)-e;i=(a(window).height()/2)-g;h='<div id="'+c.overlay+'" style="opacity:'+c.overlayOpacity+";height: 100%;width: 100%;background: #"+c.overlayBg+';display: none;position: fixed;top: 0;left: 0;"><div id="'+c.target+'" style="position: absolute;left:'+j+"px;top:"+i+'px;">'+a.data(f.get(0),"litebox")+"</div></div>";a("body").append(h).find("#"+c.overlay).find("#"+c.target).hide().end().fadeIn(c.overlayShowSpeed,function(){a("#"+c.target).slideDown(c.liteboxShowSpeed)})});a("#"+c.target+" #"+c.close).live("click",(function(){a("#"+c.target).slideUp(c.liteboxHideSpeed);a("#"+c.overlay).fadeOut(c.overlayHideSpeed,function(){a(this).remove()})}))});return this}})(jQuery);
