﻿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 impila(id){
	for (var count=1; count<=5; count++){
		if (count==id){
	    MM_findObj('layer'+count).style.display='block';
		}
		else
		{
		MM_findObj('layer'+count).style.display='none';
		}
		
		if (id==1)
		CambiaLayer1(1);
		if (id==2)
		CambiaLayer2(6);
	
	}
}
function CambiaLayer1(id)
{
    for (var i=1; i<=5; i++)
    {
    var count = i+5;
        if (i==id)
        {
            document.getElementById('Button'+id).style.background='url(Img/BottoneSelezionato.png)';
            document.getElementById('Button'+id).style.color='Black';
        }
        else
        {
            document.getElementById('Button'+i).style.background='url(Img/Bottone.png)';
            document.getElementById('Button'+i).style.color='White';
        }
        
     if (i==id)
     {
	    MM_findObj('layer'+count).style.display='block';
	 }
	 else
	 {
		MM_findObj('layer'+count).style.display='none';
	 }
	
	
	    document.getElementById('Button5').style.color='#85cc22';
    if (id==5)
        document.getElementById('Button5').style.color='#66ad03';
	
    }

}
function CambiaLayer2(id)
{
    
    for (var i=6; i<=10; i++)
    {
    var count = i+5;
        if (i==id)
        {
            document.getElementById('Button'+id).style.background='url(Img/BottoneSelezionato.png)';
            document.getElementById('Button'+id).style.color='Black';
        }
        else
        {
            document.getElementById('Button'+i).style.background='url(Img/Bottone.png)';
            document.getElementById('Button'+i).style.color='White';
        }
        
     if (i==id)
     {
	    MM_findObj('layer'+count).style.display='block';
	 }
	 else
	 {
		MM_findObj('layer'+count).style.display='none';
	 }
	
	
	    document.getElementById('Button10').style.color='#85cc22';
    if (id==10)
        document.getElementById('Button10').style.color='#66ad03';
	
    }
}
