/* Light thickBox
 * By : Laurent Aronica
 * Based on code by: 4mir Salihefendic (http://amix.dk)
 */

var LA_DONE = false;
var LA_HEIGHT = 400;
var LA_WIDTH = 400;
var LA_TOP = 20
function LA_show(caption, url, height, width) {
  LA_HEIGHT = height || 400;
  LA_WIDTH = width || 400;
  if(!LA_DONE) {
    $(document.body)
      .append("<div id='LA_overlay'></div><div id='LA_window'><div id='LA_Box' class='dialog'><div class='dialog_content'><div class='t'></div><div class='wrapper clearfix'><div id='LA_caption'><span></span></div><img src='/images/close.gif' alt='Fermer'/>"+ "</div></div><div class='b'><div></div></div></div>");
    $("#LA_window img").click(LA_hide);
    $("#LA_overlay").click(LA_hide);
    $(window).resize(LA_position);
    LA_DONE = true;
  }

  $("#LA_frame").remove();

  $("#LA_window .wrapper").append("<iframe FRAMEBORDER='0px' id='LA_frame' src='"+url+"'></iframe>");
  if($.browser.safari){
		$("#LA_frame").attr({"src": url});
  }
  $("#LA_caption").html(caption);
  $("#LA_overlay").show();
  LA_position();

  $("#LA_window").fadeIn("slow");

}

function LA_hide() {
  $("#LA_window,#LA_overlay").hide();
}

function LA_position() {
	var x,y;
	if (self.innerHeight) // all except Explorer 
	{
		x = self.innerWidth;
		y = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) // IE6 Strict Mode 
	{
		x = document.documentElement.clientWidth; 
		y = document.documentElement.clientHeight;
	} else if (document.body) // other Explorers 
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	document.getElementById('LA_window').style.left = (x-LA_WIDTH)/2 + 'px'; 
	document.getElementById('LA_window').style.top = (y-LA_HEIGHT)/2 + 'px'; 
	$("#LA_window").css("width", LA_WIDTH );
	$("#LA_frame").css("height",LA_HEIGHT - 25+"px");
}

