function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Inizializzo la variabile identificativa dell'indirizzo della pagina corrente
var QUESTA_PAGINA = document.URL;

document.write("<div>");

if (QUESTA_PAGINA.indexOf("index.html") == (-1) && String(QUESTA_PAGINA).substring(String(QUESTA_PAGINA).length-1, String(QUESTA_PAGINA).length)!="/")
{
    // Stampo a video la voce della pagina NON corrente
    document.write("<a href='index.html' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image1\",\"\",\"img/home2.gif\",1)'><img name='Image1' src='img/home1.gif' border='0'></a>");
}
else
{
    // Stampo a video la voce della pagina corrente evidenziata in grassetto
    document.write("<a href='index.html'><img src='img/home2.gif' border='0'></a>");
}

document.write("");

if (QUESTA_PAGINA.indexOf("azienda.asp") == (-1))
{
    document.write("<a href='azienda.asp'onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image2\",\"\",\"img/azienda2.gif\",1)'><img name='Image2' src='img/azienda1.gif'border='0'></a>");
}
else
{
    document.write("<a href='azienda.asp'><img src='img/azienda2.gif'border='0'></a>");
}

document.write("");

if (QUESTA_PAGINA.indexOf("prodotti.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_ironh.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_ironm.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_ironf.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_steel.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_titanium.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_gold.asp") == (-1) && QUESTA_PAGINA.indexOf("iron.asp") == (-1) && QUESTA_PAGINA.indexOf("attrezzi.asp") == (-1) && QUESTA_PAGINA.indexOf("retroescavatori_specifiche.asp") == (-1) && QUESTA_PAGINA.indexOf("retroescavatori.asp") == (-1) && QUESTA_PAGINA.indexOf("apripista_specifiche.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche_velotak.asp") == (-1) && QUESTA_PAGINA.indexOf("apripista.asp") == (-1) && QUESTA_PAGINA.indexOf("sgt.asp") == (-1) && QUESTA_PAGINA.indexOf("steel.asp") == (-1) && QUESTA_PAGINA.indexOf("gold.asp") == (-1) && QUESTA_PAGINA.indexOf("titanium.asp") == (-1) && QUESTA_PAGINA.indexOf("iron_m.asp") == (-1) && QUESTA_PAGINA.indexOf("iron_f.asp") == (-1) && QUESTA_PAGINA.indexOf("iron_h.asp") == (-1) && QUESTA_PAGINA.indexOf("caratteristiche.asp") == (-1))
{
    document.write("<a href='#' onMouseOut='MM_swapImgRestore(); Layer_menu.Nascondi()' onMouseOver='MM_swapImage(\"Image3\",\"\",\"img/prodotti2.gif\",1); Layer_menu.Mostra(" + "\"" + "menu_id" + "\"" + ", event)'><img name='Image3' src='img/prodotti1.gif'border='0'></a>");
}
else
{
    document.write("<a href='#' onMouseOut='Layer_menu.Nascondi()' onMouseOver='Layer_menu.Mostra(" + "\"" + "menu_id" + "\"" + ", event)'><img src='img/prodotti2.gif'border='0'></a>");
}

document.write("");

if (QUESTA_PAGINA.indexOf("contattaci.asp") == (-1) && QUESTA_PAGINA.indexOf("organizzazione.asp") == (-1) && QUESTA_PAGINA.indexOf("dove.asp") == (-1) && QUESTA_PAGINA.indexOf("rete.asp") == (-1))
{
    document.write("<a href='dove.asp'onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image4\",\"\",\"img/contatti2.gif\",1)'><img name='Image4' src='img/contatti1.gif'border='0'></a>");
}
else
{
    document.write("<a href='dove.asp'><img src='img/contatti2.gif'border='0'></a>");
}

document.write("");

if (QUESTA_PAGINA.indexOf("notizie.asp") == (-1))
{
    document.write("<a href='notizie.asp'onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image5\",\"\",\"img/notizie2.gif\",1)'><img name='Image5' src='img/notizie1.gif'border='0'></a>");
}
else
{
    document.write("<a href='notizie.asp'><img src='img/notizie2.gif'border='0'></a>");
}

document.write("");

if (QUESTA_PAGINA.indexOf("lavoro.asp") == (-1))
{
    document.write("<a href='lavoro.asp'onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image6\",\"\",\"img/lavoro2.gif\",1)'><img name='Image6' src='img/lavoro1.gif'border='0'></a>");
}
else
{
    document.write("<a href='lavoro.asp'><img src='img/lavoro2.gif'border='0'></a>");
}

document.write("</div>");


//------------------- menu tendina ------------------------

document.write("<style type='text/css'>");
document.write("div.menu");
document.write("{");
document.write("position:absolute; visibility:hidden;");
document.write("width:150px; left:0; top:0; z-index:500;");
document.write("background-color:#959595;");
document.write("filter:alpha(opacity=90);");
document.write("-moz-opacity: 0.9;");
document.write("opacity: 0.9;");
document.write("}");
document.write("div.menu a { text-decoration:none; white-space:nowrap; font-weight:normal;}");
document.write("div.menu a:link { color:#ffffff }");
document.write("div.menu a:visited { color:#ffffff }");
document.write("</style>");

document.write("<div id='menu_id' class='menu'>");
document.write("<table width=100% cellpadding=0 cellspacing=0 bordercolor=lightgrey style='border:1px solid' onmouseover='MM_swapImage(\"Image3\",\"\",\"img/prodotti2.gif\",1);' onMouseOut='MM_swapImgRestore();'>");
document.write("<tr><td align='center' style='border-bottom:1px solid' onMouseOver='this.bgColor=" + "\"" + "#fdd541" + "\"" + "' onMouseOut='this.bgColor=" + "\"" + "#959595" + "\"" + "'><font face='verdana' size='2'>");
document.write("<a href='prodotti.asp'>Caricatori frontali</a>");
document.write("</font></td></tr>");
document.write("</a>");
document.write("<tr><td align='center' style='border-bottom:1px solid' onMouseOver='this.bgColor=" + "\"" + "#fdd541" + "\"" + "' onMouseOut='this.bgColor=" + "\"" + "#959595" + "\"" + "'><font face='verdana' size='2'>");
document.write("<a href='apripista.asp'>Lame apripista</a>");
document.write("</font></td></tr>");
document.write("<tr><td align='center' style='border-bottom:1px solid' onMouseOver='this.bgColor=" + "\"" + "#fdd541" + "\"" + "' onMouseOut='this.bgColor=" + "\"" + "#959595" + "\"" + "'><font face='verdana' size='2'>");
document.write("<a href='retroescavatori.asp'>Retroescavatori</a>");
document.write("</font></td></tr>");
document.write("<tr><td align='center' style='border-bottom:1px solid' onMouseOver='this.bgColor=" + "\"" + "#fdd541" + "\"" + "' onMouseOut='this.bgColor=" + "\"" + "#959595" + "\"" + "'><font face='verdana' size='2'>");
document.write("<a href='pc.asp'>PC</a>");
document.write("</font></td></tr>");
document.write("<tr><td align='center' onMouseOver='this.bgColor=" + "\"" + "#fdd541" + "\"" + "' onMouseOut='this.bgColor=" + "\"" + "#959595" + "\"" + "'><font face='verdana' size='2'>");
document.write("<a href='attrezzi.asp'>Attrezzi terminali</a>");
document.write("</font></td></tr>");
document.write("</table>");
document.write("</div>");

var Layer_menu = {  

  Menu_Attivo: null,
  timer: null,
  
  Mostra: function(id, e) {
    var menu_att = document.getElementById? document.getElementById(id): null;
    if (!menu_att) return;
    this.Menu_Attivo = id;
    if ( menu_att.onmouseout == null ) menu_att.onmouseout = this.Check_OnMouseOut;
    if ( menu_att.onmouseover == null ) menu_att.onmouseover = this.Azzera_Tempo;
    PosizioniXY.getTutto();
    this.Posizione(menu_att,e);
  },
  
  Nascondi: function() {
    this.Azzera_Tempo();
    if (this.Menu_Attivo && document.getElementById) 
      this.timer = setTimeout("document.getElementById('"+Layer_menu.Menu_Attivo+"').style.visibility = 'hidden'", 100);
  },
  
  Posizione: function(menu_att, e) {
  
	// posizione fissa del menu
	var x =  (PosizioniXY.width*609)/1260;
	var y =  96;
	
	var browser = navigator.appName;	
	if (!document.all || browser=='Netscape' || browser=='Opera')
	{
		x =  x + 10;
	}

    if ( x + menu_att.offsetWidth > PosizioniXY.width + PosizioniXY.scrollX )
      x = x - menu_att.offsetWidth;  
    if ( y + menu_att.offsetHeight > PosizioniXY.height + PosizioniXY.scrollY )
      y = ( y - menu_att.offsetHeight > PosizioniXY.scrollY )? y - menu_att.offsetHeight : PosizioniXY.height + PosizioniXY.scrollY - menu_att.offsetHeight;

	menu_att.style.left = x + "px"; menu_att.style.top = y + "px";
    this.timer = setTimeout("document.getElementById('" + Layer_menu.Menu_Attivo + "').style.visibility = 'visible'", 100);

  },
  
  Check_OnMouseOut: function(e) {
    e = e? e: window.event;
    var menu_att = document.getElementById(Layer_menu.Menu_Attivo);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
    if ( menu_att != toEl && !Layer_menu.Contenuto(toEl, menu_att) ) Layer_menu.Nascondi();
  },
  Contenuto: function(oNode, oCont) {
    if (!oNode) return; 
    while ( oNode = oNode.parentNode ) 
      if ( oNode == oCont ) return true;
    return false;
  },

  Azzera_Tempo: function() {
    if (Layer_menu.timer) clearTimeout(Layer_menu.timer);
  }
  
}

PosizioniXY = {

  getlarghezza: function () {
    this.width = 0;
    if (window.innerWidth) this.width = window.innerWidth - 18;
    else if (document.documentElement && document.documentElement.clientWidth) 
  		this.width = document.documentElement.clientWidth;
    else if (document.body && document.body.clientWidth) 
  		this.width = document.body.clientWidth;
  },

  getaltezza: function () {
    this.height = 0;
    if (window.innerHeight) this.height = window.innerHeight - 18;
  	else if (document.documentElement && document.documentElement.clientHeight) 
  		this.height = document.documentElement.clientHeight;
  	else if (document.body && document.body.clientHeight) 
  		this.height = document.body.clientHeight;
  },
  
  getScrollX: function () {
    this.scrollX = 0;
  	if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
  	else if (document.documentElement && document.documentElement.scrollLeft)
  		this.scrollX = document.documentElement.scrollLeft;
  	else if (document.body && document.body.scrollLeft) 
  		this.scrollX = document.body.scrollLeft; 
  	else if (window.scrollX) this.scrollX = window.scrollX;
  },
  
  getScrollY: function () {
    this.scrollY = 0;    
    if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
    else if (document.documentElement && document.documentElement.scrollTop)
  		this.scrollY = document.documentElement.scrollTop;
  	else if (document.body && document.body.scrollTop) 
  		this.scrollY = document.body.scrollTop; 
  	else if (window.scrollY) this.scrollY = window.scrollY;
  },
  
  getTutto: function () {
    this.getlarghezza(); this.getaltezza();
    this.getScrollX();  this.getScrollY();
  }
  
}

//------------------- menu tendina ------------------------
