$(document).ready(function()
{
  $("body").append("<div id='tmombra'></div>");
  $("body").append("<div id='tmbox'></div>");

  $("#tmbox").css({position:"absolute",
                    top:0,
                    left:0,
                    width:0,
                    height:0,
					"z-index": 1,
                    display:"none"});
  $("#tmombra").css({position:"absolute",
                   top:0,
                   left:0,
                   width:$(document).width()+"px",
                   height:$(document).height()+"px",
                   background:"black",
                   display:"block",
				   "z-index": 1});
        
  $("#tmombra").fadeOut(1000);
  $("#tmombra").click(function(){$("#tmombra").fadeOut("slow");$("#tmbox").html("").fadeOut(0); return false});
});



  jQuery(document).ready(function() 
  {
    jQuery("#gallery a img").css("display", "none");
    jQuery("#gallery a").mouseover(function()
    {
      img = jQuery("#gallery a img");
      img.css("display", "block");
    });
    
    jQuery("#gallery a img").mouseout(function()
    {
      img = jQuery("#gallery a img");
      img.css("display", "none");    
    });


    jQuery("#gallery a").css({ background:"url(images/gallery_off.jpg) no-repeat",
                               width: "366px",
                               height: "44px",
                               display: "block"});
    
    jQuery("#gallery a img").click(function(){showGallery();});

  });
  
function TmBox(url, titolo, width, height)
{ 
  height += 25;

    x = ($(window).width()-width)/2;
    y = ($(window).height()-height)/2;
    
    box = $("#tmbox");
  
    $("#tmombra").css({position:"absolute",
                   top:0,
                   left:0,
                   width:$(document).width()+"px",
                   height:$(document).height()+"px",
                   background:"white",
                   display:"block"}).fadeOut(0);

    box.css({ background:"black",
              "-moz-border-radius":"10px",
              "border-radius":"10px",
              "webkit-border-radius":"10px",
              behavior:"url(PIE.htc)",
              width:width+"px",
              height:height+"px",
              position:"fixed",
              top:y+"px",
              left:x+"px",
              display:"block",
              "padding":"10px"
             }).fadeOut(0);

    $("#tmombra").fadeTo("1000", 0.7);
    
    height -= 25;
    
    box.html("");
	//boxc.fadeIn(1000);
    box.fadeIn(1000, function()
    {    
      box.html("<a href='#' style='height:25px;display:block;float:right;'><img src='images/close.png' /></a><iframe src='"+url+"' frameborder='0' style='border:0; width:"+width+"px; height:"+height+"px;'/>");
      //box.html("<iframe src='"+url+"' frameborder='0' style='border:0; width:"+width+"px; height:"+height+"px;'/>");
      box.find("a").click(function(){$("#tmombra").click(); return false});
	  
    });
}  
