var descActive = 0;
var flashActive = true;

function createFileLink(path){
	window.open(path,'','resizable=yes,menubar=no,status=no,width=780,height=530');
}
function mostraDesc(n){
	if(descActive==n){
		document.getElementById("slide_"+n).style.visibility = "hidden";
		descActive = 0;
	}
	else{
		var distTop = parseInt(document.getElementById("contNomeProdotto").offsetHeight + document.getElementById("contMenuTerzoLivello").offsetHeight + 210 - document.getElementById("slide_"+n).offsetHeight);
		if(descActive)
			document.getElementById("slide_"+descActive).style.visibility = "hidden";
		document.getElementById("slide_"+n).style.left = moveDescLeft(n)+"px";
		document.getElementById("slide_"+n).style.top = distTop+"px";
		document.getElementById("slide_"+n).style.visibility = "visible";
		descActive = n;
	}
}
function moveDescLeft(n){
	var distLeft = 0;
	for(var i=1; i<n; i++){
		distLeft+=document.getElementById("tab_desc_"+i).offsetWidth;
	}
	distLeft = distLeft+i+9;
	if((distLeft+245)>740){
		var dif = 245-document.getElementById("tab_desc_"+i).offsetWidth;
		if(document.all)
			dif-=2	
		distLeft = distLeft-dif;
	}
	return distLeft;
}

function openWindow(arg)
{
var htmlRes = '<html>';
htmlRes+='<head>';
htmlRes+='  <title>Iveco Motors</title>';
htmlRes+='</head>';
htmlRes+='<body style="margin:0px;">';	
htmlRes+='<img id="smartImage" border="0" src="'+arg+'">';
htmlRes+='<script>var larg=document.getElementById("smartImage").offsetWidth;';
htmlRes+='var alt=document.getElementById("smartImage").offsetHeight;';
htmlRes+='window.resizeTo(larg,alt);';
htmlRes+='</script></body></html>';
finestra = window.open('about:blank','popup','scrollbars=0');
finestra.document.open();	
finestra.document.write(htmlRes);
finestra.document.close();
finestra.focus();
}

function show(id){
	for(var i=1; i>0; i++){
		if(document.getElementById("menu"+i+"open"))
			hide(i);
		else
			break;
	}
	var distLeft = 0;
	for(i=0; i<id; i++){
		distLeft += document.getElementById("lineaMenu"+i).offsetWidth+i;
	}
	distLeft += 9;
	document.getElementById("menu"+id+"open").style.left = distLeft+"px";
	document.getElementById("menu"+id+"open").style.visibility="visible";
 	document.getElementById("lineaMenu"+id).className="BgAzzurroMenu";
}


function hide(id){	
	document.getElementById("menu"+id+"open").style.visibility="hidden";
  	document.getElementById("lineaMenu"+id).className="BgBiancoMenu";
}

function switchvis(id){
  if(document.getElementById(id)){
    var ele = document.getElementById(id);
    if(ele.style.visibility=="visible"){
      ele.style.visibility="hidden";
    }
    else{
      ele.style.visibility="visible";
    }
  }
}

function nascondiFlashTrue(img){
	document.getElementById("contFlashHome").style.backgroundImage = "url("+img+")";
	if(!document.all){
		document.getElementById("contFlash").style.visibility="hidden";
		flashActive = false;		
	}
	return false;
}

