//CAMBIA IL FOGLIO DI STILE

//legge la cookie
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = name+'='+value+expires+'; path=/';
}

//scrive la cookie
function readCookie(name) {
  var nameEQ = name + '=';
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
//  return null;
}

//estrae il nome del foglio di stile
function setCSS(nome_file_css) { 
createCookie('paesaggio_skinUtente',nome_file_css,365);
location.reload();
}

//applica il foglio di stile
function setCSShref(nome_file_css) {
var link_ = document.getElementsByTagName("link");
for ($i=0;$i<link_.length;$i++)
	if(link_[$i].media=="screen") link_[$i].href=nome_file_css+".css";
//alert(nome_file_css);

}

function espandi(mID) {
//chiude tutto
	var uls = document.getElementsByTagName("ul");
	for (i=0;i<uls.length;i++) {
		if(uls[i].className=="submenu" && uls[i].id != mID)uls[i].style.display = "none" ;
	}
//apre l' oggetto richiesto
	var submenuA = document.getElementById(mID);
	var display = submenuA.style.display;
	submenuA.style.display = (display == "block") ? "none" : "block";
	}

  
window.onload=function() {

	//
/*var uls = document.getElementsByTagName("col");
var ulsnet = document.getElementsByTagName("p");
	for (i=0;i<uls.length;i++) 
	{
		if(uls[i].className=="subtot")uls[i].style.display ="none";
	}

	if (navigator.appName == "Netscape")
	{
	   for (i=0;i<ulsnet.length;i++) 
	   {
		if(ulsnet[i].className=="hide")ulsnet[i].style.display ="none";
	   }
	}*/

	//imposta i menu 'display none' onLoad
	var uls = document.getElementsByTagName("ul");
        for (i=0;i<uls.length;i++) {
		if(uls[i].className=="submenu")uls[i].style.display ="none";
	}
	
	//legge skin contenuto nel cookie
	nome_file_css = readCookie('paesaggio_skinUtente');
	if(nome_file_css)	setCSShref(nome_file_css);
	//alert(nome_file_css);
	
//link target _blank
if(!document.getElementsByTagName) return;
l=document.getElementsByTagName("a");
  for(i=0;i<l.length;i++)
  {
    if(l[i].className.indexOf("blank")!=-1)
    {
    l[i].onclick=function(){window.open(this.href);return(false)};
    }
  }
  

}


//espandi tabella
function espmenu(mID) {
//chiudi tutto
	var uls = document.getElementsByTagName("col");
	for (i=0;i<uls.length;i++) {
		if (uls[i].className=="subtot" || uls[i].className=="centrali" && uls[i].id != mID)uls[i].style.display = "none" ;
	}
//apri il div richiesto
	var submenuA = document.getElementById(mID);
	var display = submenuA.style.display;
	submenuA.style.display = (display == "block") ? "none" : "block";
	
	}

//PULISCE IL FORM DEL MOTORE DI RICERCA
function S_clearDefault(element) {
  if (element.defaultValue==element.value) element.value = ""
}

/*****************evidenzia colore li aperto**************************/
var control;
var DOM = (document.getElementById) ? 1 : 0;
var IE  = (document.all) ? 1 : 0;
function getObj(name)
{
  if (DOM && document.getElementById(eval("'"+name+"'")))
  {
   return document.getElementById(name).style;
  }
  else if (IE && document.all[name]) 
  {
   return document.all[name].style;
   } 
  else
  {
  return 0;
  }


}

function makeBold(id)
{
	obj = getObj(id);/*non modificabile*/
	
	/*modificabile ¬*/
	obj.fontWeight = 'bold';
	obj.backgroundColor='transparent';
	obj.color='#FF6600';
	obj.marginBottom='2px';
	obj.borderBottom='2px solid #FF6600';
	
	obj.control='0';/*non modificabile*/
}

function makeUnbold(id)
{
	obj = getObj(id);/*non modificabile*/
	
	/*modificabile ¬*/
	obj.fontWeight = 'bold';
	obj.backgroundColor='transparent';
	obj.color='#465780';
	obj.borderBottom='0px';
	
	obj.control='1';/*non modificabile*/
}


 


function clickIt(id)
{
 obj = getObj(id);
  
    if (obj.control!= '0' && id=='a1')
    {
      makeBold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
 
    }
    else if (obj.control== '0' && id=='a1')
    {
       makeUnbold('a1');
    }
    else if (obj.control!= '0' && id=='a2')
    {
       makeBold('a2'); makeUnbold('a1'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a2')
    {
       makeUnbold('a2');
    }
    
     else if (obj.control!= '0' && id=='a3')
    {
       makeBold('a3'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a3')
    {
       makeUnbold('a3');
    }
    
     else if (obj.control!= '0' && id=='a4')
    {
       makeBold('a4'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a5'); makeUnbold('a6'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a4')
    {
       makeUnbold('a4');
    }
    else if (obj.control!= '0' && id=='a5')
    {
       makeBold('a5'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a6'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a5')
    {
       makeUnbold('a5');
    }
    
    else if (obj.control!= '0' && id=='a6')
    {
       makeBold('a6'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a7'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a6')
    {
       makeUnbold('a6');
    }
    
    else if (obj.control!= '0' && id=='a7')
    {
       makeBold('a7'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a7')
    {
       makeUnbold('a7');
    }
    
    else if (obj.control!= '0' && id=='a8')
    {
       makeBold('a8'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a8')
    {
       makeUnbold('a8');
    }
    
     else if (obj.control!= '0' && id=='a9')
    {
       makeBold('a9'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a8'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a9')
    {
       makeUnbold('a9');
    }
    
     else if (obj.control!= '0' && id=='a10')
    {
       makeBold('a10'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a11'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a10')
    {
       makeUnbold('a10');
    }
    
     else if (obj.control!= '0' && id=='a11')
    {
       makeBold('a11'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a12'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a11')
    {
       makeUnbold('a11');
    }
    
     else if (obj.control!= '0' && id=='a12')
    {
       makeBold('a12'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a13');
    }
    else if (obj.control== '0' && id=='a12')
    {
       makeUnbold('a12');
    }
	
	 else if (obj.control!= '0' && id=='a13')
    {
       makeBold('a13'); makeUnbold('a1'); makeUnbold('a2'); makeUnbold('a3'); makeUnbold('a4'); makeUnbold('a5'); makeUnbold('a6'); 
      makeUnbold('a7'); makeUnbold('a8'); makeUnbold('a9'); makeUnbold('a10'); makeUnbold('a11'); makeUnbold('a12');
    }
    else if (obj.control== '0' && id=='a13')
    {
       makeUnbold('a13');
    }
}  



