
var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;

var colTestoMenu="#86A2A2";			// menu item text color
var colTestoSubmenu="#264D4D";		// submenu item text color and subsubmenu
var hlColor="#ffffff";	


function statteFermo(id){
	clearTimeout(ti);
	if(document.getElementById(id)!=null)
	document.getElementById(id).style.visibility="visible";
		var puliTd=id;
		var i=1;
		var pulipuli="";
		pulipuli=puliTd.replace(/Tbl/i,"Td");
		puliTd=pulipuli.concat("_",i);
		while (document.getElementById(puliTd)!=null)
			{
				document.getElementById(puliTd).style.color=colTestoSubmenu;
				i=i+1;
				puliTd=pulipuli.concat("_",i);
			}
		}

		
function doMenu(td){
	clearTimeout(ti);
	td.style.color=hlColor;
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		for(i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(tdo[i]!=tda[i]){
				if (sT.split("_").length<=2) tdColor=colTestoMenu;
				else tdColor=colTestoSubmenu;
				document.getElementById("td"+sT).style.color=tdColor;
				if(document.getElementById("tbl"+sT)!=null)
					document.getElementById("tbl"+sT).style.visibility="hidden";
			}
		}			
	}
	oTd=td;
	sT="tbl";
	for(i=1;i<tda.length;i++)
		sT+="_"+tda[i];
	if(document.getElementById(sT)!=null)
	{
		document.getElementById(sT).style.visibility="visible";
		}
}

function clearMenu(){
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		var sT="";
		for(var i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if (i==1) tdColor=colTestoMenu;
			else tdColor=colTestoSubmenu;
			document.getElementById("td"+sT).style.color=tdColor;
			if(document.getElementById("tbl"+sT)!=null)
				document.getElementById("tbl"+sT).style.visibility="hidden";
		}
		oTd=null;			
	}
}

function runMenu(strURL){
	top.location.href=strURL;
}


function posiziona(tipo){

var nvocimenu;

if (tipo=='normal') nvocimenu=19;	//menu principale
else nvocimenu=20;
 
//tutto assoluto
var hTdmenu = document.getElementById('td_1').offsetHeight
var menuTop = findPosY(document.getElementById('td_1'))-200-(hTdmenu*nvocimenu);
var menuLeft = findPosX(document.getElementById('td_1')) + document.getElementById('td_1').offsetWidth;



menuTop = findPosY(document.getElementById('td_1'));
menuLeft = findPosX(document.getElementById('td_1'))+ document.getElementById('td_1').offsetWidth;

 document.getElementById("tbl_1").style.top=menuTop+'px';
 document.getElementById('tbl_1').style.left=menuLeft+'px';

 document.getElementById("tbl_2").style.top=menuTop+hTdmenu*1+'px';
 document.getElementById('tbl_2').style.left=menuLeft+'px';
 
 //Prodotti modificato da *2 a -40 altrimenti sfora sotto
 document.getElementById("tbl_3").style.top=menuTop+hTdmenu-40+'px';
 document.getElementById('tbl_3').style.left=menuLeft+'px';
 
 document.getElementById("tbl_4").style.top=menuTop+hTdmenu*3+'px';
 document.getElementById('tbl_4').style.left=menuLeft+'px';
 
 if (tipo=='super')
 {
  document.getElementById("tbl_5").style.top=menuTop+hTdmenu*4+'px';
  document.getElementById('tbl_5').style.left=menuLeft+'px';
  
  document.getElementById("tbl_6").style.top=menuTop+hTdmenu*5+'px';
  document.getElementById('tbl_6').style.left=menuLeft+'px';
  
  document.getElementById("tbl_20").style.top=menuTop+hTdmenu*6+'px';
  document.getElementById('tbl_20').style.left=menuLeft+'px';
 }
 else
 {
  document.getElementById("tbl_20").style.top=menuTop+hTdmenu*5+'px';
  document.getElementById('tbl_20').style.left=menuLeft+'px';
 }
 
 
  // sottomenu di Home - Iscrizione
 var menuLeft = findPosX(document.getElementById('td_1_1')) + document.getElementById('td_1_1').offsetWidth -10;

 document.getElementById("tbl_1_2").style.top=menuTop+hTdmenu*1 +'px';
 document.getElementById('tbl_1_2').style.left=menuLeft+'px';
 
 
  // sottomenu di Oli Essenziali 
 var menuLeft = findPosX(document.getElementById('td_3_1')) + document.getElementById('td_3_1').offsetWidth -10;

	//(modificato da *9 a *9-60 per menu che sfora sotto)
 document.getElementById("tbl_3_8").style.top=menuTop+hTdmenu*9-60+'px';
 document.getElementById('tbl_3_8').style.left=menuLeft+'px';

 // sottomenu di Linea Intestino
 var menuLeft = findPosX(document.getElementById('td_3_1')) + document.getElementById('td_3_1').offsetWidth - 10;
     //
 document.getElementById("tbl_3_17").style.top = menuTop + hTdmenu * 15  + 'px';
 document.getElementById('tbl_3_17').style.left = menuLeft + 'px';
 
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
			
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;		
	return curtop;
}



function MM_swapImgRestore() { 
  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() { 
  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) {
  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() { 
  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];}
}



function scrivia(user, site){
document.write('<a href=\"mailto:' + user + '@' + site + '.com' + '\" class="">');
document.write(user + '@' + site + '.com' + '</a>');
}

function scriviaindex(user, site){
document.write('<a href=\"mailto:' + user + '@' + site + '.com' + '\" class="index">');
document.write(user + '@' + site + '.com' + '</a>');
}

function scriviavisuals(user, site){
document.write('<a href=\"mailto:' + user + '@' + site + '.com' + '\" class="">');
document.write(user + '@' + site + '.com' + '</a>');
}

function scriviamoka(user, site){
document.write('<a href=\"mailto:' + user + '@' + site + '.net' + '\" class="">');
document.write(user + '@' + site + '.net' + '</a>');
}

function scriviamap(user, site){
document.write('<AREA SHAPE="RECT" COORDS="120,15,240,30" HREF="mailto:' +user + '@' + site + '.com' + '" alt="">');
}

function scriviaico(user, site){
document.write('<a href=\"mailto:' + user + '@' + site + '.com' + '\" onMouseOut=\"MM_swapImgRestore()\"  onMouseOver=\"MM_swapImage(\'roll-posta\',\'\',\'http://www.fitomedical.com/img/p_posta-b.gif\',1)\">');
document.write('<span style=\"color: #990033\">scrivi</span>&nbsp;&nbsp;<img name=\"roll-posta\" border=\"0\" src=\"http://www.fitomedical.com/img/p_posta.gif\" width=\"20\" height=\"20\"></a>');
}



//Che anno è?
var now = new Date();
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
							}
today = (fourdigits(now.getYear()));
 
 
 
 
 // workaround ie
function animazione()
{
   document.write('<div class="topimageindex">\n');
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="200" height="200"> ');
   document.write('<param name="allowScriptAccess" value="sameDomain" /> ');
   document.write('<param name="movie" value="http://www.fitomedical.com/img/fito-animazione-07.swf" /> ');
   document.write('<param name="quality" value="high" /> ');
   document.write('<param name="menu" value="false" /> ');
   document.write('<param name="bgcolor" value="#FFFFFF" /> ');
   document.write('<param name="WMODE" VALUE="transparent" /> ');
   document.write('<param name="loop" VALUE="false" /> ');
   document.write('<param name="scale" VALUE="exactfit" /> ');
   document.write('<param name="salign" VALUE="LT" /> ');
   document.write('<embed WMODE="transparent" src="http://www.fitomedical.com/img/fito-animazione-07.swf" ');
   document.write('loop="false" quality="high" bgcolor="#ffffff" width="200" height="200" scale="exactfit" salign="LT"  menu="FALSE" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></EMBED>');
   document.write('</object></div>');
}



 // invio email disicrizione newsletter
function disiscrivi(formname)
{
    var ind=-1;
    for(var i=0; i <= document.forms.length -1; i++){	
		  if (document.forms[i].name==formname) ind=i;
		}
		
	if (ind != -1 ) {
		  if (anyField(ind)) document.forms[ind].submit();
		  else alert("Inserire l'indirizzo email");
		}
	
}

