// Class LightBoxUI
function LightBoxUI(button)
{
	this.button = button;

	if (typeof LightBoxUI.initialized == "undefined") 
    {
		LightBoxUI.prototype.init = function()
		{
			if ($("#lightbox").length == 0)
			{
				$("body").append("<div id='lightbox'><div class='border'></div></div>");
				$(".border").append("<div class='content'><div class='marge'></div></div>");
			}
			
			var newMarginTop = 100 + $(window).scrollTop();
			$(".border").css("marginTop", newMarginTop + "px");
			
			var html = $.ajax({
				url: $(this.button).attr("href"),
				async: false
			}).responseText;
			
			$(".marge").html(html + "<div class='close'><img src='/images/lightbox_close.png' alt='Fermer'/></div>");
			$("#lightbox").css("display", "block");
			
			$(".close").live("click", this.close);
			
			var event = jQuery.Event("lightBoxComplete");
			event.id = $(this.button).attr("id");
			$("body").trigger(event);
		};

		LightBoxUI.prototype.close = function()
		{
			$("#lightbox").fadeOut(200);
		};
		
		LightBoxUI.initialized = true;
	}
	
	this.init();
}
