$(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,
                    display:"none"});
  $("#tmombra").css({position:"absolute",
                   top:0,
                   left:0,
                   width:$(document).width()+"px",
                   height:$(document).height()+"px",
                   background:"black",
                   display:"block"});
        
  $("#tmombra").fadeOut(1000);
  $("#tmombra").click(function(){$(this).fadeOut("slow");$("#tmbox").html("").fadeOut(0);});
  
});



  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 += 40;

    x = ($(document).width()-width)/2;
    y = ($(document).height()-height)/2;
    
    box = $("#tmbox");
  
    $("#tmombra").css({position:"absolute",
                   top:0,
                   left:0,
                   width:$(document).width()+"px",
                   height:$(document).height()+"px",
                   background:"black",
                   display:"block"}).fadeOut(0);

    box.css({ background:"white",
              "-moz-border-radius":"10px",
              "border-radius":"10px",
              "webkit-border-radius":"10px",
              behavior:"url(PIE.htc)",
              width:width+"px",
              height:height+"px",
              position:"absolute",
              top:y+"px",
              left:x+"px",
              display:"block",
              "padding-left":"10px",
              "padding-right":"10px"
             }).fadeOut(0);
    $("#tmombra").fadeTo("1000", 0.7);
    
    height -= 40;
    
    box.html("");
    box.fadeIn(1000, function()
    {    
      box.html("<table style='height:40px;'><tr><td style='text-align:left;line-height:35px'>"+titolo+"</td><td style='text-align:right'><a href='#' style='position:relative;top:5px'><img src='images/close_small.png' /></a></td></tr></table><iframe src='"+url+"' frameborder='0' style='border:0; width:"+width+"px; height:"+height+"px;'/>");
      box.find("a").click(function(){$("#tmombra").click();});
    });
}  



