function Menu(nome,variabile,stile,stileDis){

	this.nome=nome;
	this.voci=new Array();
	this.x=0;
	this.y=0;
	this.variabile=variabile;
	this.assoluta=false;
	this.mostra=null;
	this.stile=stile;
	this.stileDis=stileDis;
}

Menu.prototype.addVoce=function(testo,link,target){
	this.voci[this.voci.length]=new Voce(testo,link,false,target);
}

Menu.prototype.addVoceClick=function(testo,link){
	this.voci[this.voci.length]=new Voce(testo,link,true);
}

Menu.prototype.addSub=function(testo,sub){
	this.voci[this.voci.length]=new VoceSub(this,testo,sub,this.voci.length);
}

Menu.prototype.abilitazione=function(abilita){
	var stile=this.stileDis;
	if (abilita) stile=this.stile;
	for(var i=0 ; i<this.voci.length; i++)
		document.getElementById(this.nome + i).className=stile;
}

Menu.prototype.setAssoluta=function(pos){
	this.assoluta=pos;
}

Menu.prototype.getTitolo=function(pos){
	return this.voci[pos].getTitolo;
}

Menu.prototype.calcolaPos=function(){
	return !this.assoluta;
}

Menu.prova=function(){
	return false;
}

Menu.prototype.toString=function(){
	var testo='<div';
//	if (this.x!=null){
/*
		testo+=' style="position:';
		if (this.assoluta)
			testo+='absolute';
		else
			testo+='relative';
		testo+=';top:' + this.y + '; left:' + this.x + '">';
	}
	else
*/
		testo+='>';
	for(var i=0 ; i<this.voci.length; i++){
		testo+='<span id="' + this.nome + i + '" class="' + this.stile + '"';
		testo+=' onMouseout="' + this.variabile + '.visualizza()">' + this.voci[i] + '</span>';
	}
	return testo + '</div>';
}

Menu.prototype.visualizza=function(){
	if (this.mostra!=null)
		this.mostra.style.display='none';
}

Menu.prototype.crea=function(contenitore){
	var area;
	if (contenitore==null){
		area=document.body;
	}
	else{
		area=(new getObj(contenitore)).obj;
	}
//	if (document.all){
		area.innerHTML = this;
		for(var i=0; i<this.voci.length; i++)
			area.innerHTML+=this.voci[i].collega();
/*
  }
	else if (document.layers) {
		area.document.open();
		area.document.write(this);
		for(var i=0 ; i<this.voci.length; i++)
			area.document.write(this.voci[i].collega());
		area.document.close();
	}
	else{
		area.innerHTML = this;
		for(var i=0 ; i<this.voci.length; i++)
			area.innerHTML+=this.voci[i].collega();
	}
*/
/*
	for(var i=0 ; i<this.voci.length; i++)
		if (this.voci[i].sub!=null){
			var sub=new getObj(this.voci[i].sub.nome);
			var menu= new getObj(this.nome+i);
			sub.style.left= findPosX(menu.obj) + "px";
		}
*/
}

