// JavaScript Document
	var MenuSelezionato = "";
	/***********************************************
	* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/
	var loadedobjects=""

	function ajaxtext(url, containerid){
	   var tmp_text = ""
	   var page_request = false
	   if (window.XMLHttpRequest) // Mozilla, Safari etc
	   	  page_request = new XMLHttpRequest()
	   else if (window.ActiveXObject){ // IE
	   	  try {
		  	  page_request = new ActiveXObject("Msxml2.XMLHTTP")
			  } 
		  catch (e){
		      try{
			  	  page_request = new ActiveXObject("Microsoft.XMLHTTP")
				  }
		 	  catch (e){}
		  }
       }
	   else
	   	   return false
	   page_request.onreadystatechange=function(){
          tmp_text = loadtext(page_request, containerid)
       }
	   page_request.open('GET', url, true)
	   page_request.send(null)
    }
	
	function loadtext(page_request, containerid){
	   if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
		  document.getElementById(containerid).innerHTML=page_request.responseText
	   }
    }

    function loadobjs(){
       if (!document.getElementById)
       	  return
       for (i=0; i<arguments.length; i++){
          var file=arguments[i]
          var fileref=""
          if (loadedobjects.indexOf(file)==-1){ 
             if (file.indexOf(".js")!=-1){ 
                fileref=document.createElement('script') 
                fileref.setAttribute("type","text/javascript");
                fileref.setAttribute("src", file);
			 }
             else if (file.indexOf(".css")!=-1){ 
                fileref=document.createElement("link")
                fileref.setAttribute("rel", "stylesheet");
                fileref.setAttribute("type", "text/css");
                fileref.setAttribute("href", file);
             }
          }
          if (fileref!=""){
             document.getElementsByTagName("head").item(0).appendChild(fileref)
             loadedobjects+=file+" " 
          }
       }
    }
	
	function evidenzia(obj){		
		obj.style.background = "";
	}
	function deevidenzia(obj){
		if (obj.id!=MenuSelezionato){
			obj.style.background = "";
		}
	}
	function ApriLink(ID_Menu, TipoMenu, Indirizzo, Modalita, Destinazione, Parametri){
		var obj;
		var appo;
		if (TipoMenu=="P"){
			AggiornaMenu(ID_Menu.substring(5), "YES");		
		}
		if (TipoMenu=="S"){			
			AggiornaMenu(ID_Menu.substring(5), "YES");		
		}
		if (MenuSelezionato!=""){
			obj = getObjectById(MenuSelezionato);
			obj.style.background = "";		
		}
		MenuSelezionato=ID_Menu;
		/*
		if(Parametri!=indiceHomepage && Parametri!=""){
			document.getElementById("logo").style.display="none";
		}else{
			document.getElementById("logo").style.display="";
		}
		*/
		obj = getObjectById(MenuSelezionato);
		obj.style.background = "";
		if (Indirizzo!=""){
			if (Indirizzo!="index.php"){
				appo = "";
				appo += "<form name='parametri' action='" + Indirizzo + "' method='" + Modalita + "' target='" + Destinazione + "'>";
				if (Parametri!=""){
					var parametri_array=Parametri.split("&");
					for (i=0; i<parametri_array.length; i++){
						var dettaglio_parametri=parametri_array[i].split("=");
						//
						appo += "<input type='hidden' name='" + dettaglio_parametri[0]  + "' value='" + dettaglio_parametri[1] + "'>";					
						appo += "</form>";
					}
				}
				document.getElementById('spazioform').innerHTML=appo;		
				document.parametri.submit();
			}else{
				appo = "";
				// VERSIONE CON CHIAMATA STANDARD
				 
				appo += "<form name='parametri' action='" + Indirizzo + "' method='" + Modalita + "' target='" + Destinazione + "'>";
				if (Parametri!=""){
					var parametri_array=Parametri.split("&");
					for (i=0; i<parametri_array.length; i++){
						var dettaglio_parametri=parametri_array[i].split("=");
						appo += "<input type='hidden' name='ID_Menu' value='" + ID_Menu + "'><input type='hidden' name='" + dettaglio_parametri[0]  + "' value='" + dettaglio_parametri[1] + "'>";
						//appo += "<input type='hidden' name='<?php echo session_name(); ?>' value='<?php echo session_id(); ?>'></form>";
						appo += "</form>";
					}
				}
				document.getElementById('spazioform').innerHTML=appo;		
				document.parametri.submit();
				

				// VERSIONE CON CHIAMATA AJAX
				/*
				appo+="getcontent.php";
				if (Parametri!=""){
					appo += "?ID_Menu=" + ID_Menu;
					var parametri_array=Parametri.split("&");
					for (i=0; i<parametri_array.length; i++){
						var dettaglio_parametri=parametri_array[i].split("=");
						appo += "&" + dettaglio_parametri[0] + "=" + dettaglio_parametri[1];
					}
					//appo += "&<?php echo session_name(); ?>=<?php echo session_id(); ?>";
				}
				ajaxtext(appo, 'area_contenuto');
				*/

				// VERSIONE CON CHIAMATA IFRAME
				/*
				appo+="getcontentNew.php";
				if (Parametri!=""){
					appo += "?ID_Menu=" + ID_Menu;
					var parametri_array=Parametri.split("&");
					for (i=0; i<parametri_array.length; i++){
						var dettaglio_parametri=parametri_array[i].split("=");
						appo += "&" + dettaglio_parametri[0] + "=" + dettaglio_parametri[1];
					}
					//appo += "&<?php echo session_name(); ?>=<?php echo session_id(); ?>";
				}
				document.getElementById('area_contenuto').src=appo;
				*/
			}
		}		
	}
		
	function ApriPagina(ID_Pagina){
		// VERSIONE CON CHIAMATA STANDARD
		
		var appo = "";
		appo += "<form name='parametri' action='index.php' method='get'>";
		appo += "<input type='hidden' name='id_pagina' value='" + ID_Pagina + "'>";
		//appo += "<input type='hidden' name='<?php echo session_name(); ?>' value='<?php echo session_id(); ?>'></form>";
		appo += "</form>";
		document.getElementById('spazioform').innerHTML=appo;		
		document.parametri.submit();
		
		
		// VERSIONE CON CHIAMATA AJAX
		/*
		appo = "getcontent.php";
		appo += "?id_pagina=" + ID_Pagina;
		ajaxtext(appo, 'area_contenuto');
		*/
		// VERSIONE CON CHIAMATA IFRAME
		/*
		appo = "getcontentNew.php";
		appo += "?id_pagina=" + ID_Pagina;
		document.getElementById('area_contenuto').src=appo;
		*/
	}


	
