// JavaScript Document
intHeight = document.documentElement.clientHeight;
intWidth = document.documentElement.clientWidth;
var intT = ( ( intHeight / 2 ) - ( 650 / 2 ) );
var intL = ( ( intWidth / 2 ) - ( 1000 / 2 ) ) - 5;
var BG_DONE = false;
var BG_HEIGHT = 650;
var BG_WIDTH = 1000;
function BG_show(caption, url, height, width) {
  BG_HEIGHT = height || 650;
  BG_WIDTH = width || 1000;
  if(!BG_DONE) {
    $(document.body)
      .append( "<div id='BG_overlay'></div><div id='BG_window'><div id='BG_caption'></div>"
        + "<div id='fechar' alt='Fechar' title='Fechar'><a></a></div>"+
"</div>");
    $("#fechar").click(BG_hide);
    $("#homeSmiles").click(BG_hide);
    $("#homeCartao").click(BG_hide);
    $("#BG_overlay").click(BG_hide);
    $(window).resize(BG_position);
    BG_DONE = true;

  }

  $("#BG_frame").remove();
  $("#BG_window").append
					(
						"<iframe id='BG_frame' src='"+url+"' Frameborder='0' allowtransparency='true'>"+
						"</iframe>"
					);

  $("#BG_caption").html(caption);
  $("#BG_overlay").show();
  BG_position();

  if(BG_ANIMATION)
    $("#BG_window").show();
  else
    $("#BG_window").show();
}

function BG_hide() {
//location.href = 'index.htm';
		GB_hide();
  $("#BG_window,#BG_overlay").hide();
}

function BG_position() {
intHeight = document.documentElement.clientHeight;
intWidth = document.documentElement.clientWidth;
var intT = ( ( intHeight / 2 ) - ( 400 / 2 ) ) - 10;
var intL = ( ( intWidth / 2 ) - ( 600 / 2 ) ) - 5;
  $("#BG_window").css({width:"600px",height:"400px",
    left: intL+"px", top:intT+"px" });
  $("#BG_frame").css("height","400px");
  $("#BG_frame").css("width","600px");
	$("#fechar a").css("width","30px");
	$("#fechar a").css("height","30px");
	$("#fechar a").css("position","absolute");
	$("#fechar a").css("left","530px");
	$("#fechar a").css("top","50px");
	$("#fechar a").css("z-index","1000");

}

      var BG_ANIMATION = true;
      $(document).ready(function(){
        $("a.greybox").click(function(){
          var t = this.title || $(this).text() || this.href;
          BG_show("",this.href,600,1000);
          return false;
        });

      });

