Function.prototype.setScope = function(scope) {
	var f = this;
	return function() {
		f.apply(scope);
	}
}

function init_js_menu(){

var JS_MENU=document.getElementById('menu_principale');
var voci_principali = JS_MENU.getElementsByTagName('li');
var voceMenu=function(list_item){
	this.voce=list_item;
	this.classe=this.voce.className;
	this.sottomenu=document.getElementById('js_sottomenu_'+this.voce.getAttribute('title'));
	this.selected=false;

	this.evidenziaOn=(function(){
		return this.voce.className=this.classe+' hover';
	}).setScope(this);

	this.evidenziaOff=(function(){
		return this.voce.className=this.classe;
	}).setScope(this);

	this.voce.onmouseover=(function(){
		this.sottomenu.style.display='block';
		this.evidenziaOn();
	}).setScope(this);
	this.voce.onmouseout=(function(){
		this.sottomenu.style.display='none';
		this.evidenziaOff();
	}).setScope(this);
	this.sottomenu.onmouseover=(function(){
		this.sottomenu.style.display='block';
		this.evidenziaOn();
	}).setScope(this);
	this.sottomenu.onmouseout=(function(){
		this.sottomenu.style.display='none';
		this.evidenziaOff();
	}).setScope(this);
};


for(i=0;i<voci_principali.length;i++){
	if(voci_principali[i].className.indexOf('voce-principale')>=0){
		new voceMenu(voci_principali[i]);
	}
}


}