var myimages=new Array()
function PreloadImg()
{
  for (i=0;i<PreloadImg.arguments.length;i++)
  {
    MyImg=new Image();
    MyImg.src=PreloadImg.arguments;
  }
}

var ScrollX=0;
var ScrollY=0;
var ScreenH=0;
var ScreenW=0;
function ApriHidImg(e, ImgUrl)
{
  var MaxWidth=500;
  var MaxHeight=500;
  getScroll();
  getWindowSize();
  var MyImg=new Image;
  if(!e)
    e=window.event;
  if(ImgUrl)
  {
    HidImg.style.display='';
    MyImg.src=ImgUrl;
    var ImgW=MyImg.width;
    var ImgH=MyImg.height;
    if(ImgW>MaxWidth)
    {
      ImgW=MaxWidth;
      MyImg.style.maxWidth=MaxWidth + 'px';
    }
    if(ImgH>MaxHeight)
    {
      ImgH=MaxHeight;
      MyImg.style.maxHheight=MaxHeight + 'px';
    }
    ImgPosX=ScrollX+((ScreenW-ImgW)/2);
    ImgPosY=ScrollY+((ScreenH-ImgH)/2);
    //alert(
    //'Screen=' + ScreenW + ' Width - ' + ScreenH  + ' Height\n' +
    //'Scroll=' + ScrollX + ' X - ' + ScrollY  + ' Y\n' +
    //'Img=' + ImgW + ' Width - ' + ImgH + ' Height\n' +
    //'Img Pos=' + ImgPosX + ' Left - ' + ImgPosY + ' Top');
  }
  else
  {
    HidImg.style.display='none';
  }
  HidImg.replaceChild(MyImg, HidImg.firstChild);
  
  HidImg.style.left=ImgPosX+'px';
  HidImg.style.top=ImgPosY+'px';
}


function getScroll()
{
  if(typeof(window.pageYOffset)=='number')
  {
    ScrollY=window.pageYOffset;
    ScrollX=window.pageXOffset;
  }
  else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
  {
    ScrollY=document.body.scrollTop;
    ScrollX=document.body.scrollLeft;
  }
  else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
  {
    ScrollY=document.documentElement.scrollTop;
    ScrollX=document.documentElement.scrollLeft;
  }
}


function getWindowSize()
{
  if(parseInt(navigator.appVersion)>3)
  {
    if(navigator.appName=="Netscape")
    {
      ScreenW=window.innerWidth;
      ScreenH=window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1)
    {
      ScreenW=document.body.offsetWidth;
      ScreenH=document.body.offsetHeight;
    }
  }
}

function ShowMenu(IdMenu)
{
  //document.getElementById('menu_blu').style.display='none';
  //document.getElementById('menu_giallo').style.display='none';
  //document.getElementById('menu_rosso').style.display='none';
  //document.getElementById('menu_verde').style.display='none';
  var MyMenu=document.getElementById(IdMenu);
  MyMenu.style.display=(MyMenu.style.display=='block') ? 'none':'block';
  SetCookie(IdMenu, MyMenu.style.display);
}

function SetCookie(Nome, Valore)
{
  document.cookie=Nome + '=' + Valore + '; expires=""; path=/';
}

function OverImg(Img, Hover)
{
  if(Hover)
    Img.src=Img.src.replace('.0.', '.1.');
  else
    Img.src=Img.src.replace('.1.', '.0.');
}






















