/* 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)
 */

var GB_HEIGHT = 100;
var GB_WIDTH = 150;

function GB_show(caption, url, width, height) {
  GB_HEIGHT = height+30;
  GB_WIDTH = width+30;
  $("#GB_window .close").click(GB_hide);
  $("#GB_overlay").click(GB_hide);
  $("#GB_caption").html(caption);
  GB_position();
  $("#GB_overlay").show();
  $("#GB_window").slideDown("slow");
  return false;
}

function GB_hide() {
  $("#GB_window,#GB_overlay").hide();
}

function GB_position() {
  var de = document.documentElement;
  var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  $("#GB_window").css({width:GB_WIDTH+"px",height:GB_HEIGHT+"px",
    left: ((w - GB_WIDTH)/2)+"px" });
  $("#GB_frame").css("height",GB_HEIGHT - 32 +"px");
}

