/**
 * jQuery.easyOverlay
 * Copyright (c) 2010 c.bavota - http://bavotasan.com
 * Dual licensed under MIT and GPL.
 * Date: 02/15/2010
**/
 
(function($) {
  $.fn.easyOverlay = function(){	
    $(this).click(function(e){
      if($("#easyOverlay")) { $("#easyOverlay").remove(); }
      $("body").append("<p id='easyOverlay'><a href='javascript:void(0)' class='closeit'>X</a></p>");
      $("<img src='"+ this.rel +"' alt='' />").appendTo('#easyOverlay').load(function() {
        var wide = ($(window).width() / 2) - ($(this).width() / 2);
        var high = ($(window).height() / 2) - ($(this).height() / 2);			
		var scrollTop = $(window).scrollTop();
        $("#easyOverlay").css({
          top: high scrollTop + + "px",
          left: wide + "px",
		  display: 'none',
          visibility: "visible"
        }).fadeIn();
      });
    });
    $("a.closeit").live("click", function(){
      $("#easyOverlay").fadeOut();
    });
  };
})(jQuery)
