/* Greybox Redux
 * Required: http://jquery.com/
 * Written by: John Resig
 * Based on code by: 4mir Salihefendic (http://amix.dk)
 * License: LGPL (read more in LGPL.txt)
 */
jQuery.noConflict();     
var GB_DONE_GENERAL = false;
var GB_HEIGHT_GENERAL = 400;
var GB_WIDTH_GENERAL = 400;

function GB_show_general(caption, url, height, width) {
  GB_HEIGHT_GENERAL = height || 400;
  GB_WIDTH_GENERAL = width || 400;
  if(!GB_DONE_GENERAL) {
    jQuery(document.body)
      .append("<div id='GB_overlay_general'></div><div id='GB_window_general'><div id='GB_caption_general'></div>"
        + "<img src='js/greybox/greybox_general/close.gif'  alt='Fermer'/></div>");
    jQuery("#GB_window_general img").click(GB_hide_general);
    jQuery("#GB_overlay_general").click(GB_hide_general);
    jQuery(window).resize(GB_position_general);
    GB_DONE_GENERAL = true;
  }

  jQuery("#GB_frame_general").remove();
  jQuery("#GB_window_general").append("<iframe id='GB_frame_general' src='"+url+"'></iframe>");

  jQuery("#GB_caption_general").html(caption);
  jQuery("#GB_overlay_general").show();
  GB_position_general();

  if(GB_ANIMATION)
    jQuery("#GB_window_general").slideDown("slow");
  else
    jQuery("#GB_window_general").show();
}

function GB_hide_general() {
  jQuery("#GB_window_general,#GB_overlay_general").hide();
}

function GB_position_general() {
  var de = document.documentElement;
  var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  jQuery("#GB_window_general").css({width:GB_WIDTH_GENERAL+"px",height:GB_HEIGHT_GENERAL+"px",
    left: ((w - GB_WIDTH_GENERAL)/2)+"px" });
  jQuery("#GB_frame_general").css("height",GB_HEIGHT_GENERAL - 32 +"px");
}

