var GB_DONE = false;
var GB_HEIGHT = 400;
var GB_WIDTH = 400;

function GB_show(caption, url, height, width) {
  GB_HEIGHT = height || 400;
  GB_WIDTH = width || 400;
  var req = false;
  var contenuto;
  if (window.XMLHttpRequest) {
	  try {
		  req = new XMLHttpRequest();
      } catch (e) {
		  req = false;
      }
  } else if (window.ActiveXObject) {
	  // For Internet Explorer on Windows
	  try {
		  req = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (e) {
      	  try {
			  req = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (e) {
			  req = false;
          }
      }
  }
  if (req) {
	  req.open('GET', url, false);
      req.send(null);
      contenuto = req.responseText;
  } else {
	  element.innerHTML = "Il tuo browser non supporta questo tipo di visualizzazione.";
  }
  
  
  if(!GB_DONE) {
    $(document.body)
      .append("<div id='GB_overlay'></div><div id='GB_window'><p align='right' style='margin:0;'><img src='../img/news/close.gif' alt='Chiudi' title='Chiudi'/></p></div>");
    $("#GB_window img").click(GB_hide);
    $("#GB_overlay").click(GB_hide);

    GB_DONE = true;
  }

  $("#GB_frame").remove();
  $("#GB_window").append("<div id='GB_frame'>"+contenuto+"</div>");

  $("#GB_overlay").show();
  GB_position();

  if(GB_ANIMATION)
    $("#GB_window").slideDown("slow");
  else
    $("#GB_window").show();
}

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;
}

