


function setId(){

 if(document.pagina == "news") closeNews();




if(getQueryVariable("p" , null)){
            var url_pagina = getQueryVariable("p" , null);
            var id_pagina = url_pagina.toLowerCase();
        
         if (document.all){
                var menu_head = document.getElementById("head_" +id_pagina);
                var menu_footer = document.getElementById("footer_" + id_pagina);
                var menu_header = document.getElementById("header_" +id_pagina);
                var menu_up = document.getElementById("menu_up_" +id_pagina);
              

                if (menu_head) document.all[menu_head.id].setAttribute("class" , "img_menutesta_on");
                if (menu_footer) document.all[menu_footer.id].attributes['class'].value = "link_footer_on";
                if (menu_header) document.all[menu_header.id].attributes['class'].value = "img_menu_on";
                if (menu_up) document.all[menu_up.id].attributes['class'].value = "menu_up_on";

                

                      
         }
         else {

            menu_head = document.getElementById("head_" +id_pagina);
            menu_footer = document.getElementById("footer_" + id_pagina);
            menu_header = document.getElementById("header_" +id_pagina);
            menu_up = document.getElementById("menu_up_" +id_pagina);

            if(menu_head) menu_head.setAttribute("class" , "img_menutesta_on");
            if(menu_footer) menu_footer.setAttribute("class" , "link_footer_on");
            if(menu_header) menu_header.setAttribute("class" , "img_menu_on");
            if(menu_up) menu_up.setAttribute("class" , "menu_up_on");
         }
}
    
}



function getQueryVariable(variable , lang) {
  var query = window.location.search.substring(1);
  if(query != ""){
  var vars = query.split("&");
  var id_page = vars[1].split("=");
  var lang_page = vars[0].split("=")
   if (variable == "p") return id_page[1];
   if (variable == "l") {
       if(lang_page[1] == "it") window.location.search = "?l="+lang+"&p=" +id_page[1] ;
       if(lang_page[1] == "eng") window.location.search = "?l="+lang+"&p=" +id_page[1] ;
       return true;
   }
   else return false;
  }
  
  else return false; //window.location.search = "?l=it&p=home"
}


 //

function closeNews() {

    document.getElementById("contenitore_news").style.visibility = "hidden"


}
