<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function mouse_x(e) {
  NS4 = (document.layers)? true:false;
  NS6 = (document.getElementById)? true:false;
//  if (NS4) {mouseX=e.pageX}
  if (NS4) {mouseX=e.x}
  else if (NS6) {mouseX=e.clientX}
  else {mouseX=event.x}
  return mouseX
}

function mouse_y(e) {
  NS4 = (document.layers)? true:false;
  NS6 = (document.getElementById)? true:false;
  IE = (document.all)? true:false
//  if (NS4) {mouseY=e.pageY}
  if (NS4) {mouseY=e.y}
  else if (NS6) {mouseY=e.clientY}
  else {mouseY=event.y}
  return mouseY
}

function mostra_foto(num_foto, image, e){
  // controlla se c'è o non c'è l'immagine nel layer
  immagine = '';
  img_height = 0;
  img_width = 0;
  if(image==1){immagine = '<img name="imgS" id="imgS" src="../foto/piccole/Image'+num_foto+'.jpg">'; img_height = 1; img_width = 1;}
  // imposta il contenuto del layer
  //MM_setTextOfLayer('Layer1','','<table><tr><td align="center" style="background:white; border:1px solid black; padding:3px; font-size:.8em;">'+immagine+'<br/>'+did[num_foto]+'</td></tr></table>');
  MM_setTextOfLayer('Layer1','','<div class="center" style="background:white; border:1px solid black; padding:3px; font-size:.75em;">'+immagine+'<br/>'+did[num_foto]+'</div>');
  ns4 = (document.layers)? true:false;
  ie = (document.all)? true:false;
  ns6 = (document.getElementById)? true:false;
  if(ie){
    if (img_height != 0) {img_height = document.images["imgS"].height}
    if (img_width != 0) {
	  img_width = document.images["imgS"].width;
	  if(img_width < 200){img_width = 200}
	}
	
    //top_page = document.body.scrollTop;
	top_page = document.documentElement.scrollTop;
    //bottom_page = document.body.clientHeight+document.body.scrollTop;
	bottom_page = document.documentElement.clientHeight+document.documentElement.scrollTop;
    //center_y_page = Math.round(document.body.clientHeight/2)+document.body.scrollTop;
  } else if(ns4) { //Netscape 4
    if (img_height != 0) {img_height = document.layers["Layer1"].document.images["imgS"].height}
    if (img_width != 0) {
	  img_width = document.layers["Layer1"].document.images["imgS"].width;
	  if(img_width < 200){img_width = 200}
	}
    top_page = window.pageYOffset;
    bottom_page = window.innerHeight+window.pageYOffset;
    //center_y_page = Math.round(window.innerHeight/2)+window.pageYOffset;
  } else if(ns6) { //Netscape 6
    if (img_height != 0) {img_height = document.getElementById("imgS").height}
    if (img_width != 0) {
	  img_width = document.getElementById("imgS").width
  	  if(img_width < 200){img_width = 200}
	}
    //if (img_height != 0) {img_height = 200}
    top_page = window.pageYOffset;
    bottom_page = window.innerHeight+window.pageYOffset;
    //center_y_page = Math.round(window.innerHeight/2)+window.pageYOffset;
  }
  //alert(img_height);
  top_layer = top_page+mouse_y(e);
  if (img_height != 0) { top_layer = top_layer-Math.round(img_height/2) }
  bottom_layer = top_layer+img_height+80;
  if(bottom_layer > bottom_page) { top_layer = bottom_page-(img_height+80) }
  if(top_layer < top_page+40) { top_layer = top_page+40}
  if (ie) {
    document.all.Layer1.style.top = top_layer;
    document.all.Layer1.style.left = mouse_x(e)-img_width-20;
    document.all.Layer1.style.width = img_width+8;
  } else if (ns4) {
    document.layers.Layer1.top = top_layer;
    document.layers.Layer1.left = mouse_x(e)-img_width-20;
    document.layers.Layer1.width = img_width+8;
  } else if(ns6) {
    //document.getElementById("Layer1").style.top = top_layer;   
    //document.getElementById("Layer1").style.left = mouse_x(e)+20;
    document.getElementById("Layer1").setAttribute('style', 'position:absolute; width:'+(img_width+8)+'px; height:10px; z-index:1; top: '+top_layer+'px; left: '+(mouse_x(e)-img_width-20)+'px;');
	temp = document.getElementById("Layer1").getAttribute('style');
  }
  //alert('Alt. Image: '+img_height+' bottom_layer: '+bottom_layer+' mouse_y: '+mouse_y(e)+' mouse_x: '+mouse_x(e)+' top_layer: '+top_layer+' top_page: '+top_page+' bottom_page: '+bottom_page); exit;
  // mostra il layer
    //MM_setTextOfLayer('Layer1','','<table><tr><td align="center" style="background:white; border:1px solid black; padding:3px">'+'Alt. Image: '+img_height+' bottom_layer: '+bottom_layer+' mouse_y: '+mouse_y(e)+' mouse_x: '+mouse_x(e)+' top_layer: '+top_layer+' top_page: '+top_page+' bottom_page: '+bottom_page+' styleLayer: '+temp+'</td></tr></table>');

  MM_showHideLayers('Layer1','','show');
}

function hide(){
  MM_setTextOfLayer('Layer1','','');
  MM_showHideLayers('Layer1','','hide')
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function popup(str) {
  window.open('foto.htm',str,'scrollbars=auto,resizable=yes,width=2,height=2,status=no,location=no,toolbar=no');
}
//-->

