var cssmenuids=["horizontal_menu_top","footer_menu"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=0 //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu2(){
for (var i=0; i<cssmenuids.length; i++){
  var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul");
    for (var t=0; t<ultags.length; t++){
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px";
    	var spanref=document.createElement("span");
			spanref.className="arrowdiv";
			spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;";
			//ultags[t].parentNode.getElementsByTagName("p")[0].appendChild(spanref);
			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref);
			
    	ultags[t].parentNode.onmouseover=function(){
					this.style.zIndex=100;
					//this.getElementsByTagName("ul")[0].parentNode.style.backgroundColor("#ffffff");
    				this.getElementsByTagName("ul")[0].style.visibility="visible";
					this.getElementsByTagName("ul")[0].style.zIndex=0;
    	}
    	ultags[t].parentNode.onmouseout=function(){
					this.style.zIndex=0;
					this.getElementsByTagName("ul")[0].style.visibility="hidden";
					this.getElementsByTagName("ul")[0].style.zIndex=100;
    	}
    }
  }
}
//Seleziona la prima scheda come default
function focus_on_start_section(){
	var spantags = document.getElementById("horizontal_menu_bottom").getElementsByTagName("span");
	if(spantags.length > 0){
		spantags[0].style.zIndex = 100;
		spantags[0].parentNode.style.backgroundPosition = "0 -26px";
		spantags[0].parentNode.style.color = "#005588";
		spantags[0].parentNode.getElementsByTagName("a")[0].style.color = "#005588";
	}
}
//

function focus_on_section(focus_index){
	var container_width = parseInt(document.getElementById("container").style.width.substring(0,document.getElementById("container").style.width.length-2));
	var spantags = document.getElementById("horizontal_menu_bottom").getElementsByTagName("span");
 	//alert("screen: "+screen.width+"\ncontainer: "+container_width);
	for(var i=0;i<spantags.length;i++){
		if(i != focus_index){
			spantags[i].style.position = "absolute";
			spantags[i].style.left = "0";
			spantags[i].style.visibility =  "hidden";
			spantags[i].parentNode.style.backgroundPosition = "0 0";
			spantags[i].parentNode.style.color = "white";
			spantags[i].parentNode.getElementsByTagName("a")[0].style.textDecoration = "none";
			spantags[i].parentNode.getElementsByTagName("a")[0].style.color = "white";
		}else{
			spantags[i].style.position = "relative";
			spantags[i].style.left = -202*focus_index+"px";
			spantags[i].style.visibility =  "visible";
			spantags[i].parentNode.style.backgroundPosition = "0 -26px";
			spantags[i].parentNode.style.color = "#005588";
			spantags[i].parentNode.getElementsByTagName("a")[0].style.textDecoration = "none";
			spantags[i].parentNode.getElementsByTagName("a")[0].style.color = "#005588";
		}
	}	
}
