var isDOM = document.getElementById?1:0;
var isIE = document.all?1:0;
var isNS4 = (navigator.appName=='Netscape' && !isDOM)?1:0;
var isIE4 = (isIE && !isDOM)?1:0;
var isDyn = (isDOM||isIE4||isNS4);

function getRef(id, par)
{
	par = (!par ? document : (par.navigator ? par.document : par));
	return (isIE ? par.all[id] : (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) : par.layers[id]));
}

function getSty(id, par)
{
	return (isNS4 ? getRef(id, par) : getRef(id, par).style)
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par', 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');

function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
	LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0]; with (this) { '+fc+' }');
}

LyrFn('x','if (!isNaN(a[0])) sty.left=p; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(a[0])) sty.top=p; else return parseInt(sty.top)');
LyrFn('vis','sty.visibility=p');
LyrFn('bgColor','if (isNS4) sty.bgColor=(p?p:null); ' + 'else sty.backgroundColor=(p?p:"transparent") ');
LyrFn('bgImage','if (isNS4) sty.background.src=(p?p:null); ' + 'else sty.backgroundImage=(p?"url("+p+")":"") ');
LyrFn('write','if (isNS4) with (ref.document) {write(p);close()} else ref.innerHTML=p');

function setLyr(lVis, docW, par)
{
	if (!this.seq) seq = 0;
	if (!docW) docW = 0;
	var obj = (!par ? (isNS4 ? window : document.body) : (!isNS4 && par.navigator ? par.document.body : par));
	var newID = '_js_layer_' + seq++;

	if (isIE) obj.insertAdjacentHTML('beforeEnd', '<div id="' + newID + '" style="position:absolute"></div>');
	else if (isDOM) {
		var newL = document.createElement('div');
		obj.appendChild(newL);
		with (newL) { id = newID; style.position='absolute' }
	}
	else if (isNS4) {
		var newL = new Layer(docW, obj);
		newID = newL.id;
	}

	var lObj = getLyr(newID, par);
	with (lObj) { vis(lVis); x(0); y(0); sty.width=docW }
	return lObj;
}

function popOver(mN, iN) {
	with (this) {
		clearTimeout(hideTimer);
		overM = mN;
		overI = iN;
		var thisI = menu[mN][iN];
		if (iN && this.onmouseover) this.onmouseover();
		litOld = litNow;
		litNow = new Array();
		var litM = mN, litI = iN;
		while(1) {
	 		litNow[litM] = litI;
			if (litM == 'root') break;
			litI = menu[litM][0].parentItem;
			litM = menu[litM][0].parentMenu;
		}
		var same = true;
		for (var z in menu) if (litNow[z] != litOld[z]) same = false;
		if (same) return;
		for (thisM in menu) {
	 		if (!menu[thisM][0].lyr) continue;
			litI = litNow[thisM];
			oldI = litOld[thisM];
			if (litI && (litI != oldI)) changeCol(thisM, litI, true);
			if (oldI && (oldI != litI)) changeCol(thisM, oldI, false);
			if (isNaN(litI)) { menu[thisM][0].lyr.vis('hidden') }
		}
		clearTimeout(showTimer);
		nextMenu = '';
		if (thisI.type == 'sm:')
 		{
	 		var targ = thisI.href, lyrM = menu[mN][0].lyr;
			with (menu[targ][0]) {
	  			if (!lyr) update(targ);
				lyr.x(eval(offX) + (typeof(offX)=='number' ? lyrM.x() + thisI.lyr.x() : 0));
				lyr.y(eval(offY) + (typeof(offY)=='number' ? lyrM.y() + thisI.lyr.y() : 0));
				showStr = myName + '.menu.' + targ + '[0].lyr.vis("visible")';
				nextMenu = targ;
				if (showDelay) showTimer = setTimeout(showStr, showDelay);
				else eval(showStr);
			}
		}
	}
}

function popChangeCol(mN, iN, isOver) {
	with (this.menu[mN][iN]) {
		var col = isOver ? overCol : outCol;
		if (col.indexOf('.') == -1) lyr.bgColor(col);
		else lyr.bgImage(col);
		if ((overClass == outClass) && (outBorder == overBorder)) return;
		if (isNS4) lyr.write(this.getHTML(mN, iN, isOver));
		else with (lyr.ref) {
			className = (isOver ? overBorder : outBorder);
			var chl = (isDOM ? childNodes : children)
			for (var i = 0; i < chl.length; i++) chl[i].className = (isOver ? overClass : outClass);
		}
	}
}

function popOut(mN, iN) {
	with (this) {
		if ((mN != overM) || (iN != overI)) return;
		if (this.onmouseout) this.onmouseout();

		var thisI = menu[mN][iN];
		if (thisI.href != nextMenu) clearTimeout(showTimer);
		if (hideDelay) {
			var delay = ((mN == 'root') && (thisI.type != 'sm:')) ? 50 : hideDelay;
			hideTimer = setTimeout(myName + '.over("root", 0)', delay);
		}
		overM = 'root';
		overI = 0;
	}
}

function popClick(evt) {
	with (this) {
		if (overI) {
			if (this.onclick) this.onclick();
			var thisI = menu[overM][overI];
			with (thisI)
				switch (type) {
					case 'sm:': return;
					case 'js:': { eval(href); break }
					case '': type = 'window';
					default: if (href) eval(type + '.location.href = "' + href + '"');
				}
		}
		over('root', 0);
	}
}

function popClearLyr(wN) {
	with (this) {
		for (mN in menu) with (menu[mN][0]) if (par == wN) lyr = null;
	}
}

function addProps(obj, data, names, addNull) {
	for (var i = 0; i < names.length; i++) if(i < data.length || addNull) obj[names[i]] = data[i];
}

function ItemStyle() {
	var names = ['len', 'spacing', 'popInd', 'popPos', 'pad', 'outCol', 'overCol', 'outClass', 'overClass', 'outBorder', 'overBorder'];
	addProps(this, arguments, names, true);
}

function popStartMenu(mName) {
	with (this) {
		if (!menu[mName]) { menu[mName] = new Array(); menu[mName][0] = new Object(); }
		actMenu = mName;
		menu[mName].length = 1;
		nextItem = 1;
		var aM = menu[mName][0];
		var names = ['isVert', 'isVert', 'offX','offY', 'width', 'itemSty', 'par', 'parentMenu', 'parentItem'];
		addProps(aM, arguments, names, true);
		if (!aM.lyr) aM.lyr = null;
	}
}

function popAddItem() {
	with (this) {
		var aI = menu[actMenu][nextItem++] = new Object();
		var names = ['text', 'href', 'type', 'itemSty', 'len', 'spacing', 'popInd', 'popPos', 'iW', 'iH', 'lyr'];
		addProps(aI, arguments, names, true);
		var iSty = (arguments[3] ? arguments[3] : menu[actMenu][0].itemSty);
		for (prop in iSty) if (aI[prop] == window.UnDeFiNeD) aI[prop] = iSty[prop];
		if (isNS4 && aI.outBorder) aI.pad++;
	}
}

// MENU 
function popGetHTML(mN, iN, isOver) {
	with (this) {
		var itemStr = '';
		with (menu[mN][iN]) {
			var textClass = (isOver ? overClass : outClass);
			if ((type == 'sm:') && popInd) {
				if (isNS4) itemStr += '<layer class="' + textClass + '" left="'+ ((popPos+iW) % iW) + '" top="' + pad + '">' + popInd + '</layer>';
				else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' + ((popPos+iW) % iW) + '; top: ' + pad + '">' + popInd + '</div>';
			}
			if (isNS4) itemStr += (outBorder ? '<span class="' + (isOver ? overBorder : outBorder) + '"><spacer type="block" width="' + (iW - 8) + '" height="' + (iH - 8) + '"></span>' : '') + '<layer left="' + pad + '" top="' + pad + '" width="' + (iW - (2 * pad)) + '" height="' + (iH - (2 * pad)) + '"><a class="' + textClass + '" href="#" ' + 'onClick="return false" onMouseOver="status=\'\'; ' + myName + '.over(\'' + mN + '\',' + iN + '); return true">' + text + '</a></layer>';
			else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' + pad + '; top: ' + pad + '; width: ' + (iW - (2 * pad)) + '; height: ' + (iH - (2 * pad)) + '">' + text + '</div>';
		}
		return itemStr;
	}
}

function popUpdate(upMN) {
	with (this) {
		if (!isDyn) return;
		for (mN in menu) with (menu[mN][0]) {
			if (upMN && (upMN != mN)) continue;
			var eP = eval(par);
			if (eP && eP.navigator && (eP.document.readyState != 'complete')) continue;
			var str = '', iX = 0, iY = 0;
			for (var iN = 1; iN < menu[mN].length; iN++) with (menu[mN][iN]) {
				var itemID = myName + '_' + mN + '_' + iN;
				if (type == 'sm:') {
					menu[href][0].parentMenu = mN;
					menu[href][0].parentItem = iN;
				}
				var shrink = (outBorder && isDOM && !isIE ? 2 : 0)
				iW = (isVert ? width : len) - shrink;
				iH = (isVert ? len : width) - shrink;
				var isImg = (outCol.indexOf('.') != -1) ? true : false;
				if (isDOM || isIE4) {
					str += '<div id="' + itemID + '" ' + (outBorder ? 'class="' + outBorder + '" ' : '') + 'style="position: absolute; left: ' + iX + '; top: ' + iY + '; width: ' + iW + '; height: ' + iH + '; ' + (outCol ? 'background: ' + (isImg ? 'url('+ outCol+')' : outCol) : '') + '" ';
				}
				if (isNS4) {
					str += '<layer id="' + itemID + '" left="' + iX + '" top="' + iY + '" width="' + iW + '" height="' + iH + '" ' + (outCol ? (isImg ? 'background="' : 'bgcolor="') + outCol + '" ' : '');
				}
				str += 'onMouseOver="' + myName + '.over(\'' + mN + '\',' + iN + ')" ' + 'onMouseOut="' + myName + '.out(\'' + mN + '\',' + iN + ')">' + getHTML(mN, iN, false) + (isNS4 ? '</layer>' : '</div>');
				var spc = (outBorder ? 1 : 0)
				if (isVert) iY += len + spacing - spc;
				else iX += len + spacing - spc;
			}

			if (!lyr) lyr = setLyr('hidden', 3, eval(par));
			else if (isIE4) setTimeout(myName + '.menu.' + mN + '[0].lyr.sty.width=9', 50);
			with (lyr) { sty.zIndex = 1000; write(str); sty.cursor = (isIE ? 'hand' : 'pointer') }
			for (var i = 1; i < menu[mN].length; i++) menu[mN][i].lyr = getLyr(myName + '_' + mN + '_' + i, lyr.ref);
		}
		position();
		menu.root[0].lyr.vis('visible');
	}
}

function popPosition(wN) {
	with (this) {
		for (mN in menu) if (!wN || menu[mN][0].par == wN) with (menu[mN][0]) {
			if (!lyr) return;
			if (typeof(offX)!='number' || mN=='root') lyr.x(eval(offX));
			if (typeof(offY)!='number' || mN=='root') lyr.y(eval(offY));
		}
	}
}

//MENU MAIN CONSTRUCTOR ***
function PopupMenu(myName)
{
	this.myName = myName;
	this.showTimer = 0;
	this.hideTimer = 0;
	this.showDelay = 0;
	this.hideDelay = 500;
	this.showMenu = '';
	this.menu =  new Array();
	this.litNow = new Array();
	this.litOld = new Array();
	this.overM = 'root';
	this.overI = 0;
	this.actMenu = '';
	this.nextItem = 1;
	this.over = popOver;
	this.changeCol = popChangeCol;
	this.out = popOut;
	this.click = popClick;
	this.clearLyr = popClearLyr;
	this.startMenu = popStartMenu;
	this.addItem = popAddItem;
	this.getHTML = popGetHTML;
	this.update = popUpdate;
	this.position = popPosition;
}

var hBar2 = new ItemStyle(80, 1, '', 0, 3, '#dbdbdb', '#EDECEC', 'itemText', 'crazyText', '', '');
var hBar = new ItemStyle(80, 1, '', 0, 3, '#dbdbdb', '#EDECEC', 'itemText', 'crazyText', '', '');
var subM = new ItemStyle(22, 1, '', 0, 3, '#dbdbdb', '#EDECEC', 'itemText', 'crazyText', '', '');
//var crazy = new ItemStyle(22, 1, '&gt;', -15, 3, '#5b87be', '#BFCEDB', 'crazyText', 'crazyHover','crazyBorder', 'crazyBorderOver');

var pMenu = new PopupMenu('pMenu');
with (pMenu) {
	//startMenu('root', true, 1, 91, 148, hBar);
	startMenu('root', true, 1, 120, 148, hBar);
	var i,j;
	var strLink;
	var direzione;
	var nomeTipologia;
	var Lun = new Array();
	var valFascia;
	var tipo;
	var oper;
	oper='';
for (j=0;j<=jsTipoAr.length-2;j++)
{

	//---- Gestione Spazi con il carattere ~
	jsTipoAr[j] = jsTipoAr[j].replace(/\~/g,'&nbsp;');
	//---- Gestione Spazi con il carattere ~

	strGen=jsTipoAr[j].toString();
	pos=strGen.indexOf("|");
	if (pos!=-1) {
		Tipo=strGen.substr(0,pos);
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie=strGen.substr(pos+1,strGen.length -pos);
	}
	else {
		Tipo=strGen;
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie="";
	}
	lungItem=20;
	if (strTipologie.length>0)
	{
		if (codTipo =='Acquista' || codTipo =='PrevONLine' || codTipo =='PrevONLine_Disab' || codTipo == 'DispNOGar' || codTipo == 'DispGar' || codTipo == 'ProntaConsegna' || codTipo == 'PromoPassword' || codTipo == 'Carrello' || codTipo == 'OptionPack' || codTipo == 'Home Page' || codTipo == 'Area Personale' || codTipo == 'Punti Vendita' || codTipo == 'Assistenza Prodotti' || codTipo == 'Servizi' || codTipo == 'Gestione eVendita' || codTipo == 'Notizie' || codTipo == 'Depliant_Altro' || codTipo == 'Loghi' || codTipo == 'Occasioni' || codTipo == 'Assistenza' || codTipo == 'Commerciali' || codTipo == 'Consumer' || codTipo == 'Consumer_Sel' || codTipo == 'Spazio')
		{
			if (codTipo == 'PromoPassword'){
				addItem('&nbsp; ' + '<img src="/images/arrowsmall.gif"> ' + desTipo, codTipo, 'sm:',hBar,lungItem);
			}
			if (codTipo == 'Carrello'){
				if (iTotaleGenerale > 0) {
					addItem(desTipo, 'http://' + strsv + '/Prodotti_Vendita/carrello.asp', '',hBar,40);
				}
				else {
					if (Lingua == 'De') {
						addItem(desTipo, 'PopIt("Warenkorb","Ihr Warenkorb Ist Leer","",300,150);', 'js:',hBar,40);
					}
					else {
						addItem(desTipo, 'PopIt("Carrello","Il carrello è vuoto","",300,150);', 'js:',hBar,40);
					}
				}
			}
			if (codTipo == 'Spazio') {
				addItem('&nbsp;', '#', '',hBar,lungItem);
			}
			if (codTipo =='Acquista')
			{
				addItem('&nbsp; ' + '<img src="/Prodotti_Vendita/Images/AreaRivenditori/verde.gif"> ' + desTipo, 'http://' + strsv + '/Prodotti_Vendita/vol.asp?ContrEsist=SI', '',hBar,lungItem);
			}			
			if (codTipo =='DispGar')
			{
				addItem('&nbsp; ' + '<img src="/Prodotti_Vendita/Images/AreaRivenditori/verde.gif"> ' + desTipo, 'http://' + strsv + '/Prodotti_Vendita/vol.asp?ContrEsist=SI', '',hBar,lungItem);
			}
			if (codTipo =='DispNOGar')
			{
				addItem('&nbsp; ' + '<img src="/Prodotti_Vendita/Images/AreaRivenditori/rosso.gif"> ' + desTipo, 'http://' + strsv + '/Prodotti_Vendita/vol.asp?ContrEsist=NO', '',hBar,lungItem);
			}
			if (codTipo =='PrevONLine')
			{
				addItem('&nbsp; ' + '<img src="/Prodotti_Vendita/Images/AreaRivenditori/bianco.gif"> ' + desTipo, 'http://' + strsv + '/Prodotti_Vendita/vol.asp?PrevOnline=SI', '',hBar,lungItem);
			}
			if (codTipo =='PrevONLine_Disab')
			{
				addItem('&nbsp; ' + '<img src="/Prodotti_Vendita/Images/AreaRivenditori/bianco.gif"> ' + desTipo, 'PopIt("","Funzione abiitata solo per i Rivenditori aderenti al progetto eVendita","",350,159);', 'js:',hBar,lungItem);
			}
			/*
			if (codTipo == 'OptionPack'){
				addItem('&nbsp; ' + '<img src="/images/arrowsmall.gif"> ' + desTipo, codTipo, 'sm:',hBar,lungItem);
			}
			*/
			if (codTipo == 'ProntaConsegna'){
				addItem('&nbsp; ' + '<img src="/images/arrowsmall.gif"> ' + desTipo,'http://' + strsv + '/Prodotti_Vendita/Vol_Riv.asp?Categoria=PCNB', '',hBar,lungItem);
			}			
			if (codTipo == 'Home Page'){
				addItem('&nbsp; ' + '<img src="/images/arrowsmall.gif"> ' + desTipo, 'http://' + strsv + '/HomePage.asp', '',hBar,lungItem);
			}
			if (codTipo == 'Area Personale'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/Personale/Personale_Default.asp', '',hBar,lungItem);
			}
			if (codTipo == 'Punti Vendita'){
				addItem(desTipo,'http://' + strsv + '/Contatti/Contatti_Comm.asp', '',hBar,lungItem);
			}
			if (codTipo == 'Assistenza Prodotti'){
				addItem(desTipo,'http://' + strsv + '/Supporto/Servizi_Hardware.asp', '',hBar,lungItem);
			}			
			if (codTipo == 'Servizi'){
				addItem(desTipo, codTipo, 'sm:',hBar,lungItem);
			}	
			if (codTipo == 'Commerciali'){
				addItem(desTipo, codTipo, 'sm:',hBar,lungItem);
			}
			if (codTipo == 'Consumer'){
				addItem(desTipo, codTipo, 'sm:',hBar,lungItem);
			}
			if (codTipo == 'Consumer_Sel'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/GestioneConsumer/Lista_Offerte.asp?in=1','',hBar,40);
			}
			if (codTipo == 'Gestione eVendita'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/Gestione_eVendita.asp', '',hBar,lungItem);
			}
			if (codTipo == 'Notizie'){
				addItem(desTipo,'window.open(\'http://' + strsv + '/Notizie/Notizie.asp\',\'Win\',\'height=500,width=850,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes\');', 'js:',hBar,lungItem);
			}			
			if (codTipo == 'Depliant_Altro'){
				addItem(desTipo,'window.open(\'http://' + strsv + '/Prodotti_Vendita/Depliant_Altro.pdf\',\'Win\',\'height=500,width=850,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes\');', 'js:',hBar,lungItem);
			}
			if (codTipo == 'Loghi'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/Loghi/Download.asp', '',hBar,lungItem);
			}
			if (codTipo == 'Occasioni'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/Occasioni/Occasioni.asp', '',hBar,lungItem);
			}			
			if (codTipo == 'Assistenza'){
				addItem(desTipo,'http://' + strsv + '/Prodotti_Vendita/Assistenza/Assistenza.asp', '',hBar,lungItem);
			}			
		}
		else addItem('&nbsp; ' + '<img src="/images/arrowsmall.gif"> ' + desTipo, codTipo, 'sm:',hBar,lungItem);
	}
}

for (j=0;j<=jsTipoAr.length-2;j++) {	
	strGen=jsTipoAr[j].toString();
	pos=strGen.indexOf("|");
	if (pos!=-1) {
		Tipo=strGen.substr(0,pos);
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie=strGen.substr(pos+1,strGen.length -pos);
	}
	else {
		Tipo=strGen;
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie="";
	}
	if (strTipologie.length>0) {
		x=0;
		direzione=''
		if (j>=9) {
			if (Lingua == 'De') x=0;
			else x=-50;
		}
		if (codTipo=='Componenti' && Lingua == 'It' & UtenteFinale=='NO')  x = -100;
		if (codTipo=='Ricambi' || codTipo=='Software' || codTipo == 'PromoPassword' || codTipo == 'Commerciali' || codTipo == 'Consumer' || codTipo == 'OptionPack' || codTipo=='VoIP') x=0	
		startMenu(codTipo, true, 151, x, 185, subM);
		
		i=1;
		while (strTipologie.length>0) {
			pos=strTipologie.indexOf("#");
			Tipologia=strTipologie.substr(0,pos);
			
			posSep=Tipologia.indexOf("?");
			codTipologia=Tipologia.substr(0,posSep);
			desTipologia=Tipologia.substr(posSep+1,Tipologia.length -posSep-1);
			
			strTipologie=strTipologie.substr(pos+1,strTipologie.length -pos);
			pos2=strTipologie.indexOf("#");
			strCategorie=strTipologie.substr(0,pos2);
			strLink="#";
			
			if ((codTipo=="PC")||(codTipo=="Notebook")||(codTipo=="Server")||(codTipo=="Workstation")||(codTipo=="MediaCenter")){
				strLink="http://" + strsv + "/Prodotti_Vendita/PC_Pronti.asp?Categoria="+codTipologia;
			}
			//parte relativa a flyer e promo spot
			if ((codTipologia=="PCFlyer")&&(codTipo=="PC")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Vol_Riv.asp?Categoria=PC";
				//strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=PC";
				strCategorie="";
			}
			if ((codTipologia=="PCSpot")&&(codTipo=="PC")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_schema_Spot.asp?Categoria=CO_SPOT_PC";
				strCategorie="";
			}
			if ((codTipologia=="NBFlyer")&&(codTipo=="Notebook")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Vol_Riv.asp?Categoria=NB";
				//strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=NB";
				strCategorie="";
			}
			if ((codTipologia=="NBSpot")&&(codTipo=="Notebook")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_schema_Spot.asp?Categoria=CO_SPOT_NB";
				strCategorie="";
			}
			if ((codTipologia=="SVFlyer")&&(codTipo=="Server")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=SV";
				strCategorie="";
			}
			if ((codTipologia=="SVSpot")&&(codTipo=="Server")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_schema_Spot.asp?Categoria=CO_SPOT_SV";
				strCategorie="";
			}
			if ((codTipologia=="MCFlyer")&&(codTipo=="MediaCenter")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Vol_Riv.asp?Categoria=PC";
				//strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=PC";
				strCategorie="";
			}
			if ((codTipologia=="TVFlyer")&&(codTipo=="TV")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=TV";
				strCategorie="";
			}
			if ((codTipologia=="MRFlyer")&&(codTipo=="Monitor")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=TV";
				strCategorie="";
			}
			//-----------------
			/*
			if ((codTipologia.substr(0,6)=="FASCIA")&&((codTipo=="PC")||(codTipo=="Notebook")))
			{	
				valFascia=codTipologia.substr(6,codTipologia.length-6+1);
				tipo=codTipo;
				if (codTipo=="Notebook") tipo="NB";
				strLink="http://" + strsv + "/Prodotti_Vendita/PC_NB_Pronti.asp?Categoria="+tipo+"&Fascia="+valFascia;	
			}
			*/			
			if ((codTipologia=="PromoRiservate")&&(codTipo=="PromoPassword")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/PromoPassword/Griglia_PromoPassword.asp";
			}
			/*
			if ((codTipologia=="AcquistoOption")&&(codTipo=="OptionPack")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Option_Pack/RichiestaSeriale_Option_Pack.asp";
			}
			if ((codTipologia=="GestioneOption")&&(codTipo=="OptionPack")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Option_Pack/Gestione_Option_Pack.asp";
			}			
			if ((codTipologia=="IstrAcqOption")&&(codTipo=="OptionPack") ){
				strLink="http://" + strsv + "/Prodotti_Vendita/Option_Pack/Istruzioni_Option_Pack.asp";
			}
			*/	
			if ((codTipologia=="ArchivioArticoli")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Ricerca/TreeView.asp";
			}						
			if ((codTipologia=="RichiamoCodice")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Riv_StoricoConfigurazioni.asp";
			}			
			if ((codTipologia=="StatoOrdini")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Personale/Personale_Situazione.asp";
			}			
			if ((codTipologia=="StatoRiparazioni")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Personale/Personale_rip_salto.asp";
			}
			if ((codTipologia=="StampaArticoli")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Elenco_Disponibili.asp";
			}			
			/*if ((codTipologia=="ListinoPrezzi")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Listini_Rivenditori/Listini_Scaricabili.asp";
			}*/			
			if ((codTipologia=="DocumentiLinea")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Download/Download.asp";
			}			
			if ((codTipologia=="AdesionePunti")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Personale/Adesione_Rivenditori.asp";
			}
			if ((codTipologia=="Riferimenti")&&(codTipo=="Servizi")){
				strLink="http://" + strsv + "/Prodotti_Vendita/Riferimenti.asp";
			}			
			if ((codTipologia=="InformazioniPersonali")&&(codTipo=="Servizi")) {
				strLink="https://" + strsv + "/Prodotti_Vendita/Personale/Personale_Dati.asp";
			}			
			if ((codTipologia=="Variazione Garanzia")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Variazione_Garanzia/GarVen_Frame.asp";
			}			
			if ((codTipologia=="Chat")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Chat/Chat_Nick.asp";
			}
			if ((codTipologia=="Asta")&&(codTipo=="Servizi")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Asta/Asta_indice.asp";
			}
			if ((codTipologia == 'Gestione Offerte')&&(codTipo=="Commerciali")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Offerte/Lista_Offerte.asp?in=1";
			}
			if ((codTipologia == 'Ordini in Attesa')&&(codTipo=="Commerciali")) {
				strLink="https://" + strsv + "/Prodotti_Vendita/Secure/Situazione_Rivenditori_Attesa.asp";
			}
			if ((codTipologia == 'Selezione Cliente')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/Clienti.asp";
			}			
			if ((codTipologia == 'Offerte')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/Lista_Offerte.asp?in=1&id=menu";
			}
			if ((codTipologia == 'Ordini')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/Personale/Personale_Situazione.asp";
			}			
			if ((codTipologia == 'Venduto')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/Acquistato_Cliente.asp?id=menu";
			}			
			if ((codTipologia == 'AzioniGG')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/AzioniGiorno.asp";
			}
			if ((codTipologia == 'PrezziComp')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/Prezzi_Competitor.asp";
			}						
			if ((codTipologia == 'DispoArti')&&(codTipo=="Consumer")) {
				strLink="http://" + strsv + "/Prodotti_Vendita/GestioneConsumer/Articoli_Disponibilita.asp";
			}								
			if (strCategorie.length>0) {
				nomeTipologia=codTipologia.toString();
				while (nomeTipologia.search(' ')!=-1) {
					temp=nomeTipologia;
					nomeTipologia=temp.replace(' ','_');
				}
				nomeTipologia=nomeTipologia.replace('&','')
				nomeTipologia=nomeTipologia.replace('/','')
				nomeTipologia=nomeTipologia.replace(',','')
				nomeTipologia=nomeTipologia.replace('.','')
				nomeTipologia=nomeTipologia.replace('à','')
				nomeTipologia=nomeTipologia.replace('ù','')
				nomeTipologia=nomeTipologia.replace('ò','')
				
				if (desTipologia.length >=28) {
					addItem('&nbsp; ' + '<img src="/images/onlyarrowsmall.gif"> ' + desTipologia, codTipo+nomeTipologia, 'sm:',subM, 30, 1, direzione, 0);
				}
				else {
					addItem('&nbsp; ' + '<img src="/images/onlyarrowsmall.gif"> ' + desTipologia, codTipo+nomeTipologia, 'sm:',subM, 20, 1, direzione, 0);
				}
			}
			else {
				addItem('&nbsp; ' + '<img src="/images/squaresmall.gif"> ' + desTipologia, strLink, oper);
				oper='';
			}
			strTipologie=strTipologie.substr(pos2+1,strTipologie.length -pos2);
			i++;
		}
	}
}
for (j=0;j<=jsTipoAr.length-2;j++) {	
	strGen=jsTipoAr[j].toString();
	pos=strGen.indexOf("|");
	if (pos!=-1) {
		Tipo=strGen.substr(0,pos);
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie=strGen.substr(pos+1,strGen.length -pos);
	}
	else {
		Tipo=strGen;
		posSep=Tipo.indexOf("?");
		codTipo=Tipo.substr(0,posSep);
		desTipo=strGen.substr(posSep+1,Tipo.length -posSep-1);
		strTipologie="";
	}
	if (strTipologie.length>0)
	{
		y=0;
		direzione='&gt;'
		/*if (j==(jsTipoAr.length-4)) 
		{
			x=-50;
		}
		if (j>=(jsTipoAr.length-3)) 
		{
			x=-60;
			direzione='&lt;';
		}*/
		if (j>=7 && codTipo=='Software Olidata')
		{
			y=-20;
			direzione='&lt;';
		}
		i=1;
		while (strTipologie.length>0) {
		pos=strTipologie.indexOf("#");
		Tipologia=strTipologie.substr(0,pos);
		posSep=Tipologia.indexOf("?");
		codTipologia=Tipologia.substr(0,posSep);
		desTipologia=Tipologia.substr(posSep+1,Tipologia.length -posSep-1);
		strTipologie=strTipologie.substr(pos+1,strTipologie.length -pos);
		pos2=strTipologie.indexOf("#");
		strCategorie=strTipologie.substr(0,pos2);
		if (strCategorie.length>0) {
			x=187;
			nomeTipologia=codTipologia.toString();
			while (nomeTipologia.search(' ')!=-1) {
				temp=nomeTipologia;
				nomeTipologia=temp.replace(' ','_');
			}
			nomeTipologia=nomeTipologia.replace('&','')
			nomeTipologia=nomeTipologia.replace('/','')
			nomeTipologia=nomeTipologia.replace(',','')
			nomeTipologia=nomeTipologia.replace('.','')
			nomeTipologia=nomeTipologia.replace('à','')
			nomeTipologia=nomeTipologia.replace('ù','')
			nomeTipologia=nomeTipologia.replace('ò','')
			//startMenu(codTipo+nomeTipologia, true, x, i*0.5, 175, subM);
			startMenu(codTipo+nomeTipologia, true, 187, y, 185, subM);
			while (pos!=-1)
			{
				pos=strCategorie.indexOf("|");
				codCategoria=strCategorie.substr(0,pos);
				strCategorie=strCategorie.substr(pos+1,strCategorie.length -pos);
				pos=strCategorie.indexOf("|");
				Categoria=strCategorie.substr(0,pos);
				if (Categoria.length>0) 
				{
					strLink="#";
					if ((codTipologia=="AutoconfPC")&&(codTipo=="PC")){
							strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBase.asp?TipoCpu=" + codCategoria;
					}
					if ((codTipologia=="AutoconfSV")&&(codTipo=="Server")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBaseSV.asp?TipSer=N&TipoCpu=" + codCategoria;
					}
					if ((codTipologia=="AutoconfSVISP")&&(codTipo=="Server")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBaseSV.asp?TipSer=ISP&TipoCpu=" + codCategoria;
					}
					if ((codTipo=="Server")&&((codTipologia=="SERVER_ENTRY")||(codTipologia=="SERVER_TORATON_1UR")||(codTipologia=="SERVER_TORATON_2UR")||(codTipologia=="SERVER_TORATON_5UTR")||(codTipologia=="SERVER_TEGEO_1UR")||(codTipologia=="SERVER_TEGEO_2UR")||(codTipologia=="SERVER_TEGEO_5UTR"))&&(codCategoria.substr(codCategoria.length-4,4)=="CONS")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Articoli_Promozione_Schema.asp?Categoria=SV&UB="+codTipologia+"@"+codCategoria;
					}
					if ((codTipo=="Server")&&((codTipologia=="SERVER_ENTRY")||(codTipologia=="SERVER_TORATON_1UR")||(codTipologia=="SERVER_TORATON_2UR")||(codTipologia=="SERVER_TORATON_5UTR")||(codTipologia=="SERVER_TEGEO_1UR")||(codTipologia=="SERVER_TEGEO_2UR")||(codTipologia=="SERVER_TEGEO_5UTR"))&&(codCategoria.substr(codCategoria.length-4,4)=="AUTO")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBaseSV.asp?UB="+codTipologia+"@"+codCategoria;
					}	
					if ((codTipologia=="AutoconfWK")&&(codTipo=="Workstation")){
							strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBaseWK.asp?TipoCpu=" + codCategoria;
					}
					if ((codTipologia=="AutoconfNB")&&(codTipo=="Notebook")){
							strLink="http://" + strsv + "/Prodotti_Vendita/Riv_UnitaBaseNB.asp?TipoCpu=" + codCategoria;
					}
					if ((codTipologia.substr(0,12)=="Autoconf. Pc")&&(codTipo=="PC")){
							strLink="http://" + strsv + "/Prodotti_Vendita/Autoconf_Pc.asp?TipoCpu=" + codCategoria + "&CodProf=" + codTipologia + "&TipoBSU=XX";
					}
					if ((codTipologia.substr(0,12)=="Autoconf. Wk")&&(codTipo=="Workstation")){
							strLink="http://" + strsv + "/Prodotti_Vendita/Autoconf_Workstation.asp?TipoCpu=" + codCategoria + "&CodProf=" + codTipologia + "&TipoBSU=XX";
							
					}					
					if ((codTipologia.substr(2,3)=="_PC")&&(codTipo=="PC")){
							//strLink="http://" + strsv + "/Prodotti_Vendita/Riv_PcPronti.asp?TipoCpu=" + codCategoria;
							strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}
					if ((codTipologia.substr(2,7)=="_SERVER")&&(codTipo=="Server")){
							//strLink="http://" + strsv + "/Prodotti_Vendita/Riv_PcPronti.asp?TipoCpu=" + codCategoria;
							strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}
					if ((codTipologia.substr(2,7)=="_WSERIE")&&(codTipo=="Notebook")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}
					if ((codTipologia.substr(0,18)=="05_SERVER_RACK_ACC")&&(codTipo=="Server")){
						strLink="http://" + strsv + "/Prodotti_Vendita/Articoli.asp?Categoria=AC_SERVER_RACK";
						strCategorie="";
					}					
					if ((codTipologia.substr(2,9)=="_NOTEBOOK")&&(codTipo=="Notebook")){
							//strLink="http://" + strsv + "/Prodotti_Vendita/Riv_NBPronti.asp?TipoCpu=" + codCategoria;
							strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}
					if ((codTipologia.substr(2,12)=="_WORKSTATION")&&(codTipo=="Workstation")){
							//strLink="http://" + strsv + "/Prodotti_Vendita/Riv_NBPronti.asp?TipoCpu=" + codCategoria;
							strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}
					if ((codTipologia.substr(2,4)=="_MCH")&&(codTipo=="MediaCenter")){
							//strLink="http://" + strsv + "/Prodotti_Vendita/Riv_NBPronti.asp?TipoCpu=" + codCategoria;
							strLink="http://" + strsv + "/Prodotti_Vendita/Pc_Pronti.asp?Categoria=" + codCategoria;
					}					
					if ((codTipo=="Notebook")&&(codCategoria=="NB_AJUMPC")){
						strLink="http://" + strsv + "/Prodotti_Vendita/PC_ProntiJumPC.asp";
					}
					if ((codTipo=="Notebook")&&(codCategoria=="NB_AALTRO")){
						strLink="http://" + strsv + "/Prodotti_Vendita/PC_ProntiAltro.asp";
					}					
					if (strLink=="#"){
						strLink="http://" + strsv + "/Prodotti_Vendita/Articoli.asp?Categoria=" + codCategoria; 
					}
					if (Categoria.length >28)
					{
						addItem('&nbsp; ' + '<img src="/images/squaresmall.gif"> ' + Categoria, strLink, '',subM, 30);
					}else
					{
						addItem('&nbsp; ' + '<img src="/images/squaresmall.gif"> ' + Categoria, strLink, '',subM, 20);
					}
				}
				strCategorie=strCategorie.substr(pos+1,strCategorie.length -pos);
			}
		}
		strTipologie=strTipologie.substr(pos2+1,strTipologie.length -pos2);
		i++;
		}
	}
}

}
var popOldOL = window.onload;
window.onload = new Function('if (popOldOL) popOldOL(); updateVars(); pMenu.update()');
window.onresize = new Function('ns4BugCheck(); updateVars(); pMenu.position()');
window.onscroll = new Function('updateVars(); pMenu.position()');
if (isNS4) document.captureEvents(Event.CLICK);
document.onclick = new Function('evt', 'pMenu.click(); ' +'if (isNS4) return document.routeEvent(evt)');
var winWidth, winHeight, scrollYpos, scrollXpos;
var origWinWidth = window.innerWidth;

function updateVars()
{
 winWidth = (isIE ? document.body.clientWidth : window.innerWidth);
 winHeight = (isIE ? document.body.clientHeight : window.innerHeight);
 scrollYpos = (isIE ? document.body.scrollTop : window.pageYOffset);
 scrollXpos = (isIE ? document.body.scrollLeft : window.pageXOffset);
}

function ns4BugCheck()
{
	if (isNS4 && origWinWidth != window.innerWidth) location.reload()
}

if (!isIE)
	setInterval('if (scrollYpos!=pageYOffset || scrollXpos!=pageYOffset) ' + 'window.onscroll()', 50);
