var DDSPEED = 10;
var DDTIMER = 15;

// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}


function menu()
{
	var str='';
	str +='<!--IMMAGINE TOP CON MAPPA-->';
	str +='<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="770" id="AutoNumber4" background="../../images/top2.jpg" height="90">';
	str +='<tr><td width="50%">&nbsp;</td><td width="50%"><font size="3" color="#FFFFFF"><b>Sportiva Lanzada</b></font><font color="#FFFFFF"><br></font><font size="2" color="#FFFFFF">Via Vetto, 675 - 23020 Lanzada (SO)<br>';
	str +='<a href="http://www.sportivalanzada.it" style="text-decoration: none"><font color="#FFFFFF">www.sportivalanzada.it</font></a>&nbsp;-&nbsp;<a style="text-decoration: none" href="mailto:info@sportivalanzada.it?subject=Da www.sportivalanzada.it"><font color="#FFFFFF">info@sportivalanzada.it</font></a></font><font color="#FFFFFF"> </font>';
	str +='</td></tr></table>';
	str +='<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="770" id="AutoNumber5" height="1%">';
	str +='<tr><td width="50%" class=sfondorosa></td><td width="1%"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber6">';
	str +='<tr><td class=sfondohome width="56" nowrap><font size="2" color="#FFFFFF"><b><a href="../../home/www/index.htm" style="text-decoration: none">&nbsp;<font color="#FFFFFF">Home</font></a><font color="#FFFFFF">&nbsp;&nbsp;';
	str +='</font></b></font></td><td width="196" nowrap>';
	str +='<dl class="dropdown">';
	str +='<dt id="two-ddheader" onmouseover="ddMenu(\'two\',1)" onmouseout="ddMenu(\'two\',-1)">Manifestazioni</dt>';
	str +='<dd id="two-ddcontent" onmouseover="cancelHide(\'two\')" onmouseout="ddMenu(\'two\',-1)">';
	str +='<ul><br><li><a href="../../manifestazioni/calendario/index.htm" class="underline">Calendario</a></li>';
	str +='<br><b>&nbsp;INVERNO:</b><br>';
	str +='<li><a href="../../manifestazioni/fondo/index.htm" class="underline">&nbsp;&nbsp;Notturna di fondo</a></li>';
	str +='<li><a href="../../manifestazioni/befana/index.htm" class="underline">&nbsp;&nbsp;Gara della Befana</a></li>';
	str +='<li><a href="../../Manifestazioni/Olimpiadi/index.htm" class="underline">&nbsp;&nbsp;Olimpiadi a Pradasc</a></li>';
	str +='<li><a href="../../manifestazioni/scalino/index.htm" class="underline">&nbsp;&nbsp;Gara del Pizzo Scalino</a></li>';
	str +='<li><a href="../../manifestazioni/stramilano/index.htm" class="underline">&nbsp;&nbsp;Pullman per la Stramilano</a></li>';
	str +='<li><a href="../../manifestazioni/gigantone/index.htm" class="underline">&nbsp;&nbsp;Gigantone di Campagneda</a></li>';
	str +='<br><b>&nbsp;ESTATE:</b><br>';
	str +='<li><a href="../../manifestazioni/pista/index.htm" class="underline">&nbsp;&nbsp;Serata di Atletica in pista</a></li>';
	str +='<li><a href="../../manifestazioni/uboldi/index.htm" class="underline">&nbsp;&nbsp;Trofeo Uboldi/Bardea</a></li>';
	str +='<li><a target="_blank" href="http://www.international-skyrace.org" class="underline">&nbsp;&nbsp;Skyrace Internazionale</a></li>';
	str +='<li><a href="../../manifestazioni/bike junior/index.htm" class="underline">&nbsp;&nbsp;Lanzada Bike Junior</a></li>';
	str +='<li><a href="../../manifestazioni/gesa/index.htm" class="underline">&nbsp;&nbsp;Gir de la Gesa</a></li>';
	str +='<li><a href="../../manifestazioni/ponte/index.htm" class="underline">&nbsp;&nbsp;Gara podistica di Ponte</a></li>';
	str +='<li><a href="../../manifestazioni/ciclismo/index.htm" class="underline">&nbsp;&nbsp;Ciclismo Lanzada - Campomoro</a></li>';
	str +='<li><a href="../../manifestazioni/gite/index.htm#" class="underline">&nbsp;&nbsp;Gita in montagna</a></li>';
	str +='<li><a href="../../manifestazioni/staffetta/index.htm" class="underline">&nbsp;&nbsp;Staffetta Trofeo del Magnan</a></li>';
	str +='<li><a href="../../manifestazioni/campestre/index.htm" class="underline">&nbsp;&nbsp;C. provinciale corsa campestre</a></li><br>';
	str +='</ul></dd></dl>';
	str +='</td><td width="196" nowrap><dl class="dropdown"><dt id="atleti-ddheader" onmouseover="ddMenu(\'atleti\',1)" onmouseout="ddMenu(\'atleti\',-1)">Atleti</dt>';
	str +='<dd id="atleti-ddcontent" onmouseover="cancelHide(\'atleti\')" onmouseout="ddMenu(\'atleti\',-1)">';
	str +='<ul><br><b>&nbsp;FIDAL:</b><br>';
	str +='<li><a href="../../atleti/fidal/fidal.htm" class="underline">&nbsp;&nbsp;Elenco Atleti</a></li>';
	str +='<li><a href="../../atleti/fidal/risultati.htm" class="underline">&nbsp;&nbsp;Risultati</a></li>';
	str +='<br><b>&nbsp;FISI:</b><br>';
	str +='<li><a href="../../atleti/fisi/fisi.htm" class="underline">&nbsp;&nbsp;Elenco Atleti</a></li>';
	str +='<li><a href="../../atleti/fisi/risultati.htm" class="underline">&nbsp;&nbsp;Risultati</a></li><br>';
	str +='</ul></dd></dl></td><td width="196" nowrap >';
	str +='<dl class="dropdown"><dt id="tesseramento-ddheader" onmouseover="ddMenu(\'tesseramento\',1)" onmouseout="ddMenu(\'tesseramento\',-1)">Tesseramento</dt>';
	str +='<dd id="tesseramento-ddcontent" onmouseover="cancelHide(\'tesseramento\')" onmouseout="ddMenu(\'tesseramento\',-1)">';
	str +='<ul><br><li><a href="../../tesseramento/2010/index.htm" class="underline">Tesseramento 2010</a></li>';
	str +='<li><a href="../../tesseramento/2010/sconti.htm" class="underline">Elenco sconti</a></li><br>';
	str +='</ul></dd></dl></td>';
	str +='<td width="69" class=sfondoconsiglio nowrap>';
	str +='<font size="2" color="#FFFFFF"><b>&nbsp;<a href="../../Consiglio/2008-2010/index.htm" style="text-decoration: none"><font color="#FFFFFF">Consiglio</font></a></b></font></td>';
	str +='</tr></table></td><td width="50%" class=sfondorosa>&nbsp;</td>';
	str +='</tr></table>';

	document.write( str )

}

