 var ie = (document.all) ? true : false;
 var ns = (document.layers) ? 1 : 0;
 var G_online = location.protocol!="file:";
 var url_app = top.location.href.toString();
 var pos = url_app.indexOf("?");
 var param = "system";
 if (pos==-1){ 
 var G_base = top.location.href.toString(); 
 }
 else{
 param = param.length;
 var cod = url_app.substring(0,pos-1); 
 var G_base = cod+"/"; 
 } 
 
 // per apertura carrelli salvati
 var DataCarrelli;
 var CarrelliSalvati;	
 var CarrelliSalvatiNuovi;
 
 var app = top.location.href.toString();
 var app1 = app.indexOf("?");
 var parametroMotori = app.substring(app1+1,app.length); 
 
 var pos1 = parametroMotori.indexOf(":"); 
 if ((pos1==-1)&&(parametroMotori!="system")){ 
 	document.location.replace(G_base+'indirizzi/'+parametroMotori+'.htm')	
 } 
 else{
	 parametroMenu = parametroMotori.substring(0,pos1);
	 parametroMotori = parametroMotori.substring(pos1+1,parametroMotori.length);
	 
	 var pos2 = parametroMotori.indexOf(":");
	 parametroReparto = parametroMotori.substring(0,pos2); 
	 parametroMotori = parametroMotori.substring(pos2+1,parametroMotori.length);
	 
	 var pos3 = parametroMotori.indexOf(":"); 
	 if (pos3>0){
		 parametroProdotto = parametroMotori.substring(0, pos3); 
		 parametroNew = parametroMotori.substring(pos3+1,parametroMotori.length);
	 }
	 else{
		 parametroProdotto = parametroMotori.substring(0, parametroMotori.length); 
		 parametroNew = ""	
	 }
 } 
 
 
 G_base = G_base.replace(/home.html{0,1}/i,"");
 if (G_base.substring(G_base.length-1)!="/") G_base+="/";
 
 
 var sessione = '';
 var numSessione = 0;
 var G_prodotto = -1;
 
 var pw = '';
 var nm = '';
 
 
 var G_ragioneSociale1 = '' ;
 var G_ragioneSociale2 = '' ;
 var G_codiceUtente = '' ;
 var G_pagamento = '' ;
 var G_indirizzo1 = '' ;
 var G_indirizzo2 = '' ;
 var G_condizionePagamento = '' ;
 var G_confermaOrdini = '' ; 
 
 function show_props(obj, obj_name)
 {
 var result = ""
 for (var i in obj)
 result += obj_name + "." + i + " = " + obj[i] + "\n"
 return result
 }
 function richiamaCGI( Parametro, MioFrame, CGI )
 {
 var todayDate = new Date();
 var link_ref = "" ;
 numSessione = numSessione + 1 ;
 
 var iva = 'E';
 if (top.trovaiva() == 'I')
 iva = 'I' 
 
 if (!CGI)
 link_ref = G_base + "/cgi-bin/col" + Parametro + "&tipoiva=" + iva + "&varprezzi=" + top.var_prezzi + "&sessione=" + sessione + numSessione + "&data=" + todayDate + "&cu=" + G_codiceUtente ;
 else
 link_ref = G_base + "/cgi-bin/" + CGI + Parametro + "&tipoiva=" + iva + "&varprezzi=" + top.var_prezzi + "&sessione=" + sessione + numSessione + "&data=" + todayDate + "&cu=" + G_codiceUtente;
 
 if ( !MioFrame )
 document.location.replace(link_ref);
 else
 MioFrame.location.replace(link_ref);
 }
 function richiamaCGIordini( Parametro, MioFrame )
 {
 

 richiamaCGI( Parametro, MioFrame, 'ordini' )
 }
 function richiamaCGIimpostazioni( Parametro, MioFrame )
 {
 richiamaCGI( Parametro, MioFrame, 'impostazioni' )
 }
 function LoginLogout( MiaSessione )
 {
 sessione = MiaSessione;
 }
 
 
 function Clona(oggetto) {
 if (oggetto == null)
 return null;
 else if (oggetto.constructor) {
 var result = new oggetto.constructor();
 var semplice = true;
 for (i in oggetto) {
 semplice = false;
 result[i]=Clona(oggetto[i]);
 }
 if (semplice)
 return oggetto;
 else
 return result;
 } else
 return oggetto;
 }
 
 
 function SafeAssignment (valore) {
 eval("this.m_oggetto_condiviso"+this.propertylist+"=valore");
 }
 
 function LoadOC(oggetto_condiviso) {
 
 this.m_oggetto_condiviso = oggetto_condiviso;
 
 if (this.m_foult) {
 this.SafeAssignment(this.m_valore_in_attesa);
 this.m_foult = false;
 }
 }
 
 function UnloadOC() {
 this.m_oggetto_condiviso = null;
 }
 
 function SetOC(valore) {
 if (this.m_oggetto_condiviso!=null) {
 this.SafeAssignment(valore);
 } else {
 this.m_foult = true;
 this.m_valore_in_attesa = valore;
 }
 }
 
 function OggettoCondiviso(propertylist) {
 this.m_oggetto_condiviso = null;
 this.m_foult = false;
 this.m_valore_in_attesa = null;
 this.SafeAssignment = SafeAssignment;
 this.Load = LoadOC;
 this.Unload = UnloadOC;
 this.Set = SetOC;
 this.propertylist = propertylist;
 }
 var OggettiCondivisi = new Array();
 
 function DichiaraOggettiCondivisi() {
 for (var i=0; i<DichiaraOggettiCondivisi.arguments.length; i++) {
 var oggetto = DichiaraOggettiCondivisi.arguments[i]; 
 OggettiCondivisi[oggetto.id].Load(oggetto);
 }
 }
 
 
 function AnnullaOggettiCondivisi() {
 for (var i=0; i<AnnullaOggettiCondivisi.arguments.length; i++) {
 var oggetto = AnnullaOggettiCondivisi.arguments[i];
 OggettiCondivisi[oggetto.id].Unload();
 }
 }
 

 var sito_inizializzato = false;
 function InizializzaSito() {
 AdattaDimensioni();
 CambiaScatola(new Scatola); 
 sito_inizializzato = true; 
 }
 function AdattaDimensioni() {
 if (top.ie)
 var sf = top.document.all.tags("IFRAME")["paginamultiframe"];
 else
 var sf = top.document.getElementById("paginamultiframe");
 sf.style.top = 0;
 sf.style.left = 0;
 sf.style.height = document.body.offsetHeight-4;
 sf.style.width = document.body.offsetWidth-4;
 }
 
 
 function Entra(command)
 {
 if (!sito_inizializzato) {
 top.setTimeout("Entra("+command+")",500);
 return;
 }
 eval(command);
 if (ie){
 top.document.all.tags("IFRAME")["paginamultiframe"].style.zIndex = 1;
 top.document.all.tags("IFRAME")["paginamultiframe"].style.visibility = "visible";
 top.paginamultiframe.logo.focus();
 } else {
 var myFrame = document.getElementById("paginamultiframe");
 myFrame.style.zIndex = 1;
 myFrame.style.visibility = "visible";
 
 top.frames["paginamultiframe"].frames["logo"].focus();
 
 }
 }
 
 function Home() {
 top.document.all.tags("IFRAME")["paginamultiframe"].style.zIndex = -1;
 top.document.all.tags("IFRAME")["paginamultiframe"].style.visibility = "hidden";
 
 }
 
 
 function CalcolaOffsetSuBody(idoggetto,proprieta) { 
 var o = idoggetto;
 var offset = 0;
 while (o.offsetParent) {
 offset+=eval("o.offset"+proprieta);
 o = o.offsetParent;
 }
 return offset;
 }
 
 function ScrollaFinoAOggetto(finestra,oggetto) {
 var oggTop = CalcolaOffsetSuBody(oggetto,"Top");
 var oggBottom = oggTop + oggetto.offsetHeight;
 var bodyTop = finestra.document.body.scrollTop;
 var altezza_finestra = finestra.document.body.offsetHeight;
 var bodyBottom = bodyTop + altezza_finestra;
 if (oggTop<bodyTop) {
 finestra.scrollTo(0,oggTop-2);
 } else if (oggBottom>bodyBottom) {
 finestra.scrollTo(0,oggBottom-altezza_finestra);
 }
 }
 
 
var G_default_tip = "";
var G_id_oggetto_tip = null; 
function CaricaTip(P_id_oggetto_tip) { 
 G_id_oggetto_tip = P_id_oggetto_tip;
}
function SetDefaultTip(HTMLString) {
 G_default_tip = HTMLString;
 ShowDefaultTip();
}
function ShowTip(HTMLString) {
 if (G_id_oggetto_tip != null)


 G_id_oggetto_tip.innerHTML = HTMLString;

}
function ShowDefaultTip() {
 if (G_id_oggetto_tip != null)
 G_id_oggetto_tip.innerHTML = G_default_tip;
}
function RegisterTip(p_oggetto, p_tip) {
 comando =
 "function gestore_mouseovertip_" + p_oggetto + "(){" +
 " top.ShowTip(" + p_tip + ".innerHTML);" +
 " event.cancelBubble = true;" +
 "}" +
 p_oggetto + ".onmouseover = gestore_mouseovertip_" + p_oggetto + ";" +
 p_oggetto + ".onmouseout = top.ShowDefaultTip;"; 
 return comando;
}
function RegTip(p_oggetto, p_tip) {
 gestore = new Function("top.ShowTip(" + p_tip +
 ".innerHTML); event.cancelBubble = true;"
 );
 p_oggetto.onmouseover = gestore;
 p_oggetto.onmouseout = top.ShowDefaultTip;
}
var colore = ['#000000','#ff0000','#000000','#7D7058','#9E8E70','#C0AB88','#D8C199','#FFE4B5'];
var num = colore.length-1;
var speed = 50; 
function fadeIn(nomefont){ 
 app = nomefont 
 if(num>=0){ 
 top.frames['paginamultiframe'].frames['help'].document.getElementById('fontid').style.color = colore[num]
 num--;
 setTimeout('fadeIn(app)',speed)
 }
 else{num = colore.length-1;} 
}


function EliminazioneScatolePaginePersonali() {
 InizializzaNavBar();
 for (var i = 1; i < Pila.length; i++) {
 var scatola = Pila[i];
 if (scatola.tipo=="PaginePersonali") {
 if (scatola.scatola_precedente!=-1) {
 Pila[scatola.scatola_precedente].scatola_successiva = -1;
 }
 if (scatola.scatola_successiva!=-1) {
 Pila[scatola.scatola_successiva].scatola_precedente = -1;
 }
 if (scatola.scatola_precedente!=-1 && scatola.scatola_successiva!=-1) {
 Pila[scatola.scatola_precedente].scatola_successiva = scatola.scatola_successiva;
 Pila[scatola.scatola_successiva].scatola_precedente = scatola.scatola_precedente;
 }
 delete scatola;
 } else 
 AggiungiInNavBar(scatola);
 }
}
/*
function EliminazioneScatoleSetup() {
 InizializzaNavBar();
 for (var i = 1; i < Pila.length; i++) {
 var scatola = Pila[i];
 if (scatola.tipo=="Setup") {
 if (scatola.scatola_precedente!=-1) {
 Pila[scatola.scatola_precedente].scatola_successiva = -1;
 }
 if (scatola.scatola_successiva!=-1) {
 Pila[scatola.scatola_successiva].scatola_precedente = -1;
 }
 if (scatola.scatola_precedente!=-1 && scatola.scatola_successiva!=-1) {
 Pila[scatola.scatola_precedente].scatola_successiva = scatola.scatola_successiva;
 Pila[scatola.scatola_successiva].scatola_precedente = scatola.scatola_precedente;
 }
 delete scatola;
 } else 
 AggiungiInNavBar(scatola);
 }
}
*/
var G_nomeutente = false;
function LoginOK(nomeutente) {
 if (G_nomeutente != nomeutente) {
 G_nomeutente = nomeutente;
 EliminazioneScatolePaginePersonali();
 
 var scatola_attiva = ScatolaAttiva();
 if (!scatola_attiva) return;
 if (scatola_attiva.tipo=="PaginePersonali" && !nomeutente) {
 TornaAllaScatolaPrima();
 } else {
 scatola_attiva.AggiornaTornaaX();
 RinfrescaFrames("main");
 }
 /*
 if (scatola_attiva.tipo=="Setup" && !nomeutente) {
 TornaAllaScatolaPrima();
 } else {
 scatola_attiva.AggiornaTornaaX();
 RinfrescaFrames("main");
 }
 */
 }
}
function logout (oggetto_window) {
 if (top.G_online)
 top.richiamaCGI('/5?', oggetto_window);
 else {
 app = top.document.location.search.slice(1);
 if (app=="system")
 my_src="/project/loginsystem.htm"
 else
 my_src="/propria/login.htm"
 oggetto_window.location.replace(my_src);
 }
 
 /* per i nuovi articoli */
 for (i=0;i<top.mioCod.length;i++){
 top.mioCod[i] = 0;
 top.miaDescr[i] = ""; 
 top.miaQta[i] = 0;
 top.mioPr2[i] = 0;
 }
 var app = top.MioCarrello.GeneraHTMLCarrello(top.carrelloCorpo());
 top.OC_tabella_del_carrello.Set(app);
 top.MioCarrello.Rinfresca();
}
function EseguiRicerca(key) {
 var scatola_attiva = ScatolaAttiva();
 if (scatola_attiva.tipo=="Ricerche") {
 scatola_attiva.RicaricaListino(key);
 } else {
 
 /*top.sottomenu_sel = 0;
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_prodotti.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="65,1,125,15" href="javascript:carica(\'menu_I_m.htm\')">'+ 
 '</map>'*/
 
 CambiaScatola(new Ricerche(key)); 
 }
 
}
function PrimaPaginaScatola_onload(oggetto_window) 
{
 
 var sa = ScatolaAttiva();
 if (sa) sa.CambiaTitoloScatola(oggetto_window);
}
function AttivaBottone(oggetto_window,id_bottone, disattivo) {
 if (oggetto_window[id_bottone]){
 if (disattivo) {
 oggetto_window[id_bottone].style.visibility = "hidden";
 if(oggetto_window[id_bottone+"_dis"])
 oggetto_window[id_bottone+"_dis"].style.visibility = "visible";
 } else {
 oggetto_window[id_bottone].style.visibility = "visible";
 if(oggetto_window[id_bottone+"_dis"])
 oggetto_window[id_bottone+"_dis"].style.visibility = "hidden";
 }
 }
}
function trovaiva() {
 if (loggato)
 return top.tipo_iva_sinfo
 else
 return top.tipo_iva
}
function infoscroll(seed,looped,testo) {
 if (!testo)
 var msg = " Sito prodotto da: SiNFO S.r.L. "; 
 var putout = " ";
 var c = 1;
 if (looped > 1) {
 window.status=" Sito prodotto da: SiNFO S.r.L. ";
 } else 
 if (seed > 100) {
 seed--;
 var cmd="infoscroll(" + seed + "," + looped + ")";
 timerTwo=window.setTimeout(cmd,100);
 } else 
 if (seed <= 100 && seed > 0) {
 for (c=0 ; c < seed ; c++) {
 putout+=" ";
 }
 
 putout+=msg.substring(0,100-seed); 
 seed--;
 var cmd="infoscroll(" + seed + "," + looped + ")";
 window.status=putout;
 timerTwo=window.setTimeout(cmd,100);
 } else 
 if (seed <= 0) {
 if (-seed < msg.length) {
 putout+=msg.substring(-seed,msg.length);
 seed--;
 var cmd="infoscroll(" + seed + "," + looped + ")";
 window.status=putout;
 timerTwo=window.setTimeout(cmd,100); 
 } else {
 window.status=" ";
 looped += 1;
 var cmd = "infoscroll(100," + looped + ")";
 timerTwo=window.setTimeout(cmd,75); 
 }
 }
} 
var popup;
function open_popup(){
 
 
 
 if (top.cod_ident == 0){
 var lk = '/project/eventi/start_popup.htm?' + sessione + numSessione
 popup = window.open(lk,'','width=300,height=420,top=0,left=0');
 popup.focus();
 }
 
 
 
 else{
 var lk = '/propria/eventi/start_popup.htm?' + sessione + numSessione
 popup = window.open(lk,'','width=300,height=420,top=0,left=0');
 popup.focus();
 }
}
function EntraInPromozione(menu,reparto,prodotto) {
 top.CambiaScatola(new top.Negozio(menu,reparto,prodotto));
}
 
 
 var pos_frame = new Array();
 pos_frame["main"] = new Array();
 pos_frame["main"]["Height"] = ["logo","title"];
 pos_frame["main"]["Width"] = ["menu"];
 pos_frame["intestazione"] = new Array();
 pos_frame["intestazione"]["Height"] = ["logo","title"];
 pos_frame["intestazione"]["Width"] = ["menu"];
 pos_frame["title"] = new Array();
 pos_frame["title"]["Height"] = ["logo"];
 pos_frame["title"]["Width"] = [];
 pos_frame["tabcard"] = new Array();
 pos_frame["tabcard"]["Height"] = ["logo","title",["main",["intestazione","listino"]]];
 pos_frame["tabcard"]["Width"] = ["menu"];
 pos_frame["sommario"] = new Array();
 pos_frame["sommario"]["Height"] = ["logo","title",["main",["intestazione","listino","swap"]]];
 pos_frame["sommario"]["Width"] = ["menu"];
 
 function SommaFrame(parent, listaframe, proprieta) {
 var offset = 0;
 for (var f in listaframe) {
 if (listaframe[f][1]) {
 offset += SommaFrame(parent.frames[listaframe[f][0]], listaframe[f][1], proprieta);
 } else {
 p = "offset"+proprieta;
 offset += parent.frames[listaframe[f]].document.body[p];
 }
 } 
 return offset;
 }
 function CalcolaPosizioneFrame(nomeframe,proprieta) { 
 return SommaFrame(top.frames.paginamultiframe, pos_frame[nomeframe][proprieta], proprieta);
 }
 function Move(pos, align, t, l, w, h)
 {
 if (pos == "d" || pos == "u")
 {
 this.pos.top = t + ((pos=="d")?h:-this.height);
 if (align == "l" || align == "r")
 this.pos.left = l + ((align=="l")?0:w-this.width);
 else
 return;
 }
 else
 if (pos == "r" || pos == "l")
 {
 this.pos.left = l + ((pos=="r")?w:-this.width);
 if (align == "t" || align == "b")
 this.pos.top = t + ((align=="t")?0:h-this.height);
 else
 return;
 }
 else
 if (pos == "ax") { 
 this.pos.left = l;
 if (align == "t" || align == "b")
 this.pos.top = t + ((align=="t")?0:h-this.height);
 else
 return;
 }
 else
 if (pos == "ay") { 
 this.pos.top = t;
 if (align == "l" || align == "r")
 this.pos.left = l + ((align=="l")?0:w-this.width);
 else
 return;
 }
 else
 if (pos == "a") { 
 this.pos.left = l;
 this.pos.top = t;
 }
 else
 return;
 }
 var pupozzi_visibili = new Array();
 var id_bottone_pupozzo_appena_visualizzato = null;
 
 function Open(oggetto_event, nomeframe, pos, align, biasTop, biasLeft) {
 
 var frametop = 0, frameleft = 0;
 if (nomeframe!="") { 
 frametop = top.CalcolaPosizioneFrame(nomeframe,"Height");
 frameleft = top.CalcolaPosizioneFrame(nomeframe,"Width");
 }
 
 if (pos=="a" || pos=="ax") 
 l = biasLeft?biasLeft:0;
 else
 l = top.CalcolaOffsetSuBody(oggetto_event.srcElement,"Left") + frameleft + (biasLeft?biasLeft:0) - 12;
 
 if (pos=="a" || pos=="ay") 
 t = biasTop?biasTop:0;
 else
 t = top.CalcolaOffsetSuBody(oggetto_event.srcElement,"Top") + frametop + (biasTop?biasTop:0) + 2;
 
 w = oggetto_event.srcElement.offsetWidth;
 
 h = oggetto_event.srcElement.offsetHeight;
 
 
 this.Move(pos,align,t,l,w,h);
 this.Show(0, oggetto_event.srcElement.id);
 oggetto_event.cancelBubble = true;
 }
 
 function Cascade(oggetto_event, pupozzo_chiamante, pos, align, biasTop, biasLeft)
 {
 var frametop = parseInt(pupozzo_chiamante.pos.top);
 var frameleft = parseInt(pupozzo_chiamante.pos.left);
 if (pos=="R") { 
 pos = "ax";
 l = frameleft+parseInt(pupozzo_chiamante.pos.width);
 }
 else
 if (pos=="L") { 
 pos = "ay";
 l = frameleft-parseInt(this.pos.width);
 }
 else 
 l = top.CalcolaOffsetSuBody(oggetto_event.srcElement,"Left") + frameleft + (biasLeft?biasLeft:0);
 
 t = top.CalcolaOffsetSuBody(oggetto_event.srcElement,"Top") + frametop + (biasTop?biasTop:0);
 
 w = oggetto_event.srcElement.offsetWidth;
 
 h = oggetto_event.srcElement.offsetHeight;
 this.Move(pos,align,t,l,w,h);
 this.Show(pupozzo_chiamante.livello + 1, oggetto_event.srcElement.id);
 oggetto_event.cancelBubble = true;
 }
 function AccendiSpegni(id) {
 if (id_bottone_pupozzo_appena_visualizzato==id) {
 id_bottone_pupozzo_appena_visualizzato = null;
 return false;
 } else {
 id_bottone_pupozzo_appena_visualizzato = id;
 return true;
 }
 }
 function Show(livello, id) {
 if (!livello) livello = 0;
 
 NascondiPupozzi(livello);
 this.pos.visibility = "visible";
 this.visibile = true;
 this.oggetto_window.focus();
 this.livello = livello;
 pupozzi_visibili[livello] = this;
 id_bottone_pupozzo_appena_visualizzato = id;
 }
 function Hide() {
 this.pos.visibility = "hidden";
 this.visibile = false;
 top.paginamultiframe.logo.focus();
 }
 function Resize(x, y) {
 this.pos.width = x;
 this.pos.height = y;
 }
 
 function GestoreOnClickBody(livello) { 
 NascondiPupozzi(livello);
 }
 
 function NascondiPupozzi(livello)
 {
 if (!livello)
 livello = 0;
 for (var l = pupozzi_visibili.length-1; l >= livello; l--)
 pupozzi_visibili[l].Hide();
 pupozzi_visibili.length = livello;
 
 }
 
 function Pupozzo(oggetto_tag_iframe, oggetto_window) {
 this.pos = oggetto_tag_iframe.style;
 this.oggetto_window = oggetto_window;
 this.height = oggetto_tag_iframe.offsetHeight;
 this.width = oggetto_tag_iframe.offsetWidth;
 this.Move = Move;
 this.Show = Show;
 this.Hide = Hide;
 this.Open = Open;
 this.Cascade = Cascade;
 this.Resize = Resize;
 this.visibile = false;
 this.livello = 0;
 }
 
 
 var G_titolo_scatola = OggettiCondivisi["titolo_scatola"] = new OggettoCondiviso(".innerHTML");
 
 var G_torna_a_X = OggettiCondivisi["torna_a_X"] = new OggettoCondiviso(".innerHTML");
 
 var G_tabella_pupozzo_navigazione_scatola = OggettiCondivisi["tabella_pupozzo_navigazione_scatola"] = new OggettoCondiviso(".innerHTML");
 
 var G_tabella_pupozzo_navigazione = OggettiCondivisi["tabella_pupozzo_navigazione"] = new OggettoCondiviso(".innerHTML");
 
 var pupozzo_navigazione = null;
 var pupozzi_navigazione_scatola = new Array();
 
 var altezza_riga = 17;
 var larghezza_carattere = 7;
 var min_larghezza_pupozzo = 90;
 
 function AggiornaPupozzoNavigazioneScatola(tipo) {
 var aggiornato = false;
 var altezza_pupozzo = 1;
 var larghezza_pupozzo = min_larghezza_pupozzo;
 var htmlstring = "<TABLE WIDTH=100% height=100% ALIGN=left BORDER=0 CELLSPACING=1 CELLPADDING=1 class=linee>";
 for (var titolo in NavBar[tipo]) {
 aggiornato = true;
 altezza_pupozzo += altezza_riga;
 larghezza_pupozzo = Math.max(larghezza_pupozzo, titolo.length*larghezza_carattere);
 htmlstring += "<TR><TD ALIGN=left> " +
 " <b><A href=\"javascript:void(0)\" target=vuoto onMousedown=\"top.SceltaScatolaDaNavBar(top.NavBar['" + tipo + "']['" + titolo + "'])\" class=menu>" + titolo +
 "</A></b></TD></TR> ";
 }
 htmlstring += "</TABLE>";
 G_tabella_pupozzo_navigazione_scatola.Set(htmlstring);
 if (!pupozzi_navigazione_scatola[tipo]) 
 pupozzi_navigazione_scatola[tipo] = new Pupozzo(document.all.tags("IFRAME")["idpupozzo_navigazione_scatola"],idpupozzo_navigazione_scatola.window);
 pupozzi_navigazione_scatola[tipo].Resize(larghezza_pupozzo, altezza_pupozzo);
 return aggiornato;
 }
 
 function BottoneBarraNavigazioneNegozio_onclick(oggetto_event) {
 if (AggiornaPupozzoNavigazioneScatola(oggetto_event.srcElement.id) )
 pupozzi_navigazione_scatola[oggetto_event.srcElement.id].Open(oggetto_event, "title","d","l",1);
 else
 CambiaScatola(eval(scatole_sempre_presenti[oggetto_event.srcElement.id]));
 oggetto_event.returnValue = false; 
 }
 
 
 function AggiornaPupozzoNavigazione() {
 var aggiornato = false;
 var altezza_pupozzo = 0; 
 var larghezza_pupozzo = min_larghezza_pupozzo; 
 var htmlstring = "<TABLE WIDTH=100% height=100% ALIGN=left BORDER=0 CELLSPACING=1 CELLPADDING=1 class=linee>"; 
 for (var tipo in NavBar) {
 aggiornato = true;
 altezza_pupozzo += altezza_riga;
 
 var nomescatola = NavBar[tipo], htmlstring_freccetta = "";
 
 for (var n in NavBar[tipo]) {
 nomescatola = NavBar[tipo][n].nome; 
 htmlstring_freccetta = "<TD ALIGN=right>" +
 "<img src=\"../images/bg.gif\" border=\"0\"" +
 ">" +
 "</TD>"; 
 break;
 }
 larghezza_pupozzo = Math.max(larghezza_pupozzo, nomescatola.length*larghezza_carattere);
 htmlstring += "<TR><TD ALIGN=left>" +
 "<TABLE WIDTH=100% height=100% ALIGN=left BORDER=0 CELLSPACING=0 CELLPADDING=0 class=scritte>" +
 "<TR>" +
 "<TD ALIGN=left width=100% >" +
 "<b><a href=\"javascript:void(0)\" target=vuoto class=menu> " +
 "<span id=\"" + tipo + "\" onclick=\"javascript:top.BottonePupozzoNavigazione_onclick(event)\" onmouseover=\"javascript:top.BottonePupozzoNavigazione_onmouseover(event)\">" + 
 nomescatola +
 "</span>" +
 "</a></b>" +
 "</TD>" +
 htmlstring_freccetta +
 "</TR>" +
 "</TABLE></TD></TR>";
 }
 htmlstring += "</TABLE>";
 G_tabella_pupozzo_navigazione.Set(htmlstring);
 if (pupozzo_navigazione==null)
 pupozzo_navigazione = new Pupozzo(top.document.all.tags("IFRAME")["idpupozzo_navigazione"],idpupozzo_navigazione.window);
 pupozzo_navigazione.Resize(larghezza_pupozzo + 5, altezza_pupozzo);
 return aggiornato;
 }
 
 function BottoneBarraNavigazione_onclick(oggetto_event) {
 if (AggiornaPupozzoNavigazione(oggetto_event.srcElement.id) )
 pupozzo_navigazione.Open(oggetto_event, "title","d","l",1);
 oggetto_event.returnValue = false; 
 }
 
 function BottonePupozzoNavigazione_onclick(oggetto_event) {
 NascondiPupozzi();
 CambiaScatola(eval(scatole_sempre_presenti[oggetto_event.srcElement.id]));
 }
 
 function BottonePupozzoNavigazione_onmouseover(oggetto_event) {
 if (AggiornaPupozzoNavigazioneScatola(oggetto_event.srcElement.id) ) {
 pupozzi_navigazione_scatola[oggetto_event.srcElement.id].Cascade(oggetto_event, pupozzo_navigazione, "R","t", -2);
 }
 oggetto_event.returnValue = false; 
 }
var G_showroom_da_aprire;
function CercaMarca(marca) {
 
 var tabella_marche;
 if ( !(tabella_marche = frames["paginamultiframe"].frames["main"].frames["listino"].elenco_marche) )
 return false; 
 for (var i=0; i<tabella_marche.length; i++)
 if ( tabella_marche[i][0] == marca ) {
 G_showroom_da_aprire = [tabella_marche[i][1], tabella_marche[i][2]];
 return true;
 }
 return false;
}
function bottone_collegati_onclick(oggetto_window, oggetto_event) {
 var sa = ScatolaAttiva();
 if (!sa) return false;
  
 if (MioListino){

	 if (MioListino.RigheListino && MioListino.RigheListino.length>0 && G_ArtSelezionato != -1) {
		 AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_collegati");
		 AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_centriass"); 
		 if (sa.tipo!="Showroom" && CercaMarca(MioListino.RigheListino[G_ArtSelezionato][m_Marca])) { 
			 AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_showroom");
		 }
		 else { 
			AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_showroom", true);
		 }
	 } 
 
 }
 
 else {
 	AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_collegati", true);
	AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_centriass", true);
	AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_showroom", true);
 } 
 
 if (top.sottomenu_sel != 1) AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_showroom");
 else AttivaBottone(pupozzo_collegati.oggetto_window,"id_bottone_showroom", true); 
 
 pupozzo_collegati.Open(oggetto_event, oggetto_window.name,"u","r",-2,12); 
 return false;
}

function bottone_utilita_onclick(oggetto_window, oggetto_event) {
 
 if (top.loggato){
 	 app = top.document.location.search.slice(1); 
 	 AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_apricarrello"); 
	 if (MioCarrello.totale != 0) { 	 
	 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_salvacarrello");
		AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_svuotacarrello");		
		AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo");
	 	if (app=="system"){
		 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_insertarticolo");
		 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo_clienti");
		}
	 }
	 else{
	 	var NumNuoviArticoliInCarrello = 0;
	 	for (i=0;i<top.mioCod.length;i++){  
			 if (top.miaQta[i]!=0){
				NumNuoviArticoliInCarrello++;
			 }
		 }
	 	if (NumNuoviArticoliInCarrello==0){
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_salvacarrello", true);
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_svuotacarrello", true);		
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo", true);
			if (app=="system"){
				AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_insertarticolo");
				AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo_clienti", true);
			}
		}
		else{
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_salvacarrello");
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_svuotacarrello");		
			AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo", true);
			if (app=="system"){
				AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_insertarticolo");
				AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo_clienti");
			}		
		}
	 }	
 } 
 else {
	 AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_insertarticolo", true);
	 AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_salvacarrello", true);
	 AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_apricarrello", true);
	 AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo_clienti", true);
	 if (MioCarrello.totale != 0) { 
	 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_svuotacarrello");		
	 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo");
	 }
	 else {
	 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_svuotacarrello", true);		
	 	AttivaBottone(pupozzo_utilita.oggetto_window,"id_bottone_preventivo", true);
	 }
 }
 
 var aggiungi = 0;
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)) {
	top.document.getElementById('idpupozzo_utilita').style.height = 120;
	pupozzo_utilita.Open(oggetto_event, oggetto_window.name,"u","l",-21,12);
 }
 else{
 	top.document.getElementById('idpupozzo_utilita').style.height=100
	pupozzo_utilita.Open(oggetto_event, oggetto_window.name,"u","l",-1,12);
 }
 
  
 
 return false;
}

function bottone_utilita_2_onclick(oggetto_window, oggetto_event) {
 
 pupozzo_utilita2.Open(oggetto_event, oggetto_window.name,"u","l",-2,12);
 return false;
}

function SelectCollegati() {
 NascondiPupozzi(); 
 var key = "key=" + MioListino.RigheListino[G_ArtSelezionato][m_Codice];
 var scatola_attiva = ScatolaAttiva();
 
 if (scatola_attiva.tipo=="Collegati") {
 scatola_attiva.RicaricaListino(key);
 } else { 
 CambiaScatola(new Collegati(key));
 }
 return false;
}

function SelectShowroom() {
 NascondiPupozzi();
 var scatola_attiva = ScatolaAttiva();
 if (scatola_attiva.tipo!="Showroom")   
 
 top.sottomenu_sel = 1;  
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_marche.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="5,1,65,15" href="javascript:carica(\'menu_I_p.htm\')"> '+
 '</map>'
 top.frames['paginamultiframe'].frames['menu'].document.location.href = "menu/menu_I_m.htm";
 top.G_id_voce = G_showroom_da_aprire[0]
 sottomenu = top.G_showroom_da_aprire[0] 
 
 G_vocemenuattiva = G_showroom_da_aprire[0]; 
 Visualizza(menu,-altezzaradice+margine_sopra_menu); 
 
 return false;
}


function SelectCentri() {
 NascondiPupozzi();
 var pg = G_showroom_da_aprire[1];
 pgs=pg.substring(0,pg.lastIndexOf('='));
 
 if (pgs != 'static') {
 pg=pg.substring(16,pg.lastIndexOf(''));
 } else {
 pg=pg.substring(16,pg.lastIndexOf('')+1);
 }
 
 pag='/'+ pg +'_ass.html' ;
 
 
 jj=window.open('/project/assistenza.htm', pg , 'scrollbars=no,resizable=yes,menubar=yes,status=yes,toolbar=no, width=640,height=480');
 jj.document.close();
 return false;
} 
 

var fuori = -250;
var margine_sinistro_menu = 5;
var margine_sopra_menu = 5;
var altezzaradice;
var altezza_elemento_menu = 19; 
var G_vocemenuattiva = ""; 
var left_linea_evidenziatrice = 2;
var larghezza_scrollbar = 19;
var riga_evidenziatrice;
var vocimenu;
var menu;
var menu_document;
var altezza_sfondo;
var G_oggetto_window_menu;
var infondo;
function CaricaImmaginiMenu () {
 img_chiuso = new Image();
 img_chiuso.src = "/images/piu.gif";
 img_aperto = new Image();
 img_aperto.src = "/images/meno.gif";
 img_foglia = new Image();
 img_foglia.src = "/images/niente.gif";
}
function InizializzaMenu(oggetto_window) {
 G_oggetto_window_menu = oggetto_window;
 altezza_sfondo = oggetto_window.altezza_sfondo;
 menu_document = oggetto_window.document;
 menu = oggetto_window.menu;
 vocimenu = oggetto_window.vocimenu; 
 riga_evidenziatrice = oggetto_window.riga_evidenziatrice;
 
 menu = vocimenu[top.CreaMenu()];
 altezzaradice = menu.altezza;
 AdattaRigaEvidenziatrice();
 ApriMenu();
}
function AdattaRigaEvidenziatrice() {
 riga_evidenziatrice.style.height = altezza_elemento_menu;
 riga_evidenziatrice.style.width = menu_document.body.offsetWidth-larghezza_scrollbar-left_linea_evidenziatrice;
} 
function IngSott() {
 var altezza = 0; 
 for (var i in this.figli) 
 altezza += vocimenu[this.figli[i]].ingombro();
 return altezza;
}
function Ingombro() {
 var altezza = this.altezza;
 if (this.aperto)
 altezza += this.ingsott();
 return altezza;
}
function SetImg() { 
 if (this.padre) { 
 
 if (this.figli.length) { 
 if (this.aperto) { 
 if (this.div.all["IMG_ac"].src!=img_aperto.src){ this.div.all["IMG_ac"].src = "/images/meno.gif" }
 } else { 
 if (this.div.all["IMG_ac"].src!=img_chiuso.src){ this.div.all["IMG_ac"].src = "/images/piu.gif" }
 }
 } 
 
 
 }
}
function ImpostaRigaEvidenziatrice() { 
 
 if (G_vocemenuattiva == this.id) { 
 this.style.backgroundColor = top.menu_sfondo_articolo_sel; 
 riga_evidenziatrice.style.top = this.pos.top;
 riga_evidenziatrice.style.left = parseInt(this.pos.left)>0?left_linea_evidenziatrice:fuori;
 riga_evidenziatrice.style.height = this.altezza; 
 } else 
 this.style.backgroundColor = top.menu_sfondo_pagina; 
}
function Visualizza(menu,y,chiuso) {
 idto = null;
 var posiz = y; 
 if (chiuso) {
 menu.pos.top = fuori; 
 menu.pos.left = fuori;
 menu.style.visibility = "hidden";
 } else { 
 infondo = menu.pos.top = posiz; 
 menu.pos.left = 10*(menu.liv-1)+margine_sinistro_menu;
 menu.style.visibility = "visible";
 }
 menu.SetImg();
 menu.ImpostaRigaEvidenziatrice();
 posiz += menu.altezza; 
 for (var i in menu.figli) {
 Visualizza(vocimenu[menu.figli[i]],posiz,chiuso||!menu.aperto);
 posiz += vocimenu[menu.figli[i]].ingombro();
 }
 if (!menu.padre) { 
 altezza_sfondo.style.height = posiz;
 }
}
function MenuItem(div,liv,padre) {
 this.pos = top.ie?div.style:div;
 this.liv = liv;
 this.style = div.style;
 this.div = div;
 this.id = div.id;
 this.padre = padre;
 this.altezza = top.ie?div.offsetHeight:div.document.height;
 this.aperto = false;
 this.figli = new Array();
 this.ingsott = IngSott;
 this.ingombro = Ingombro;
 this.SetImg = SetImg;
 this.ImpostaRigaEvidenziatrice = ImpostaRigaEvidenziatrice;
}
function ApriMenu(oggetto_location) { 
 if (G_id_voce != "")
 voce_da_aprire = G_id_voce;
 else 
 voce_da_aprire = menu_document.location.search.slice(1);
 if (voce_da_aprire != "") { 
 G_vocemenuattiva = voce_da_aprire; 
 num = voce_da_aprire.slice(1).split('x');
 prof = num.length;
 if (vocimenu["x"+num[0]]) {
 menucorrente = vocimenu["x"+num[0]];
 menucorrente.aperto = true;
 var i;
 for (i=1; i<prof; i++) 
 if (vocimenu[menucorrente.figli[num[i]]]) {
 menucorrente = vocimenu[menucorrente.figli[num[i]]];
 menucorrente.aperto = true;
 } else 
 break;
 } else {
 
 }
 } else { 
 
 menu.aperto = true;
 
 if(menu.figli.lenght>0)
 G_vocemenuattiva = menu.figli[0]; 
 }
 Visualizza(menu,-altezzaradice+margine_sopra_menu);
 G_oggetto_window_menu.scrollTo(0,infondo);
 
 
 if ( ((G_vocemenuattiva.length>5)&&(top.controllo_click_menu==1)) || ((G_vocemenuattiva.length>5)&&(top.ScatolaAttiva().tipo=="Ricerche")) ){
 app = G_vocemenuattiva
 app1 = app.lastIndexOf("x")
 app2 = app.substring(0,app1)
 ScrollaFinoAOggetto(G_oggetto_window_menu, G_oggetto_window_menu[app2]);
 }
 else{
 ScrollaFinoAOggetto(G_oggetto_window_menu, G_oggetto_window_menu[G_vocemenuattiva]); 
 }
 
}
function CreaMenu() {
 if (top.ie) 
 alddivs = menu_document.all.tags("DIV"); 
 else 
 if (top.ns)
 alddivs = menu_document.document.layers;
 else 
 alddivs = menu_document.getElementsByTagName("DIV");
 
 
 allmenuitems = new Array();
 for (var i=0; i<alddivs.length; i++) { 
 nome = alddivs[i].id;
 if (nome!="riga_evidenziatrice") {
 allmenuitems[allmenuitems.length] = alddivs[i];
 }
 }
 
 var radice;
 for (var i=0; i<allmenuitems.length; i++) { 
 nome = allmenuitems[i].id;
 if (i==0)
 radice = nome;
 num = nome.slice(1).split('x');
 liv = num.length-1;
 if (liv==0) {
 vocimenu[nome] = new MenuItem(allmenuitems[i],liv);
 } else {
 re = /,/g;
 padre = "x"+num.slice(0,liv).toString().replace(re,"x");
 if (vocimenu[padre]) {
 vocimenu[padre].figli[num[liv]]=nome;
 if (top.ns) {
 allmenuitems[i].document.captureEvents(Event.MOUSEDOWN);
 allmenuitems[i].captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);
 allmenuitems[i].document.onmousedown=new Function("menuitem_onclick("+_ap+allmenuitems[i].id+_ap+")");
 allmenuitems[i].onMouseOver=new Function("menuitem_onmouseover("+_ap+allmenuitems[i].id+_ap+")");
 allmenuitems[i].onmouseout=new Function("menuitem_onmouseout("+_ap+allmenuitems[i].id+_ap+")");
 }
 vocimenu[nome] = new MenuItem(allmenuitems[i],liv,padre);
 }
 }
 }
 
 return radice;
}
function menuimg_onclick(id,parametro) {
 if (vocimenu[id].figli.length==0)
 return;
 if ( vocimenu[id].aperto ) {
 vocimenu[id].aperto = false;
 } else {
 vocimenu[id].aperto = true;
 }
 Visualizza(menu,-altezzaradice+margine_sopra_menu);
}
var sottomenu;
var sottomenu_length;
var sottomenu_arr;
var controllo_click_menu = 0;

function menuitem_onclick(id,parametro) {
 if (top.sottomenu_sel==0)
 top.sottomenu_sel_att = 0;
 else
 top.sottomenu_sel_att = 1; 
 
 conta=0;
 for (i=0;i<id.length;i++){
 app = id.substr(i,1) 
 if (app=="x"){conta++}
 } 
 if ((vocimenu[id].figli.length==0)||(top.ScatolaAttiva().tipo=="PaginePersonali")) {
 
 top.ScatolaAttiva().vocemenu_onclick(id,parametro);
 
 G_vocemenuattiva = id; 
 Visualizza(menu,-altezzaradice+margine_sopra_menu); 
 } 
 else{ 
	 sottomenu = id; 
	 sottomenu_length = vocimenu[id].figli.length; 
	 
	 if (top.ScatolaAttiva().tipo!="PaginePersonali"){
		 top.frames["paginamultiframe"].frames["main"].frames["listino"].document.location.replace("/project/sottomenu.htm")  
		 G_vocemenuattiva = id; 
		 Visualizza(menu,-altezzaradice+margine_sopra_menu); 
	  
		if (top.sottomenu_sel==0){
			 top.frames["paginamultiframe"].frames["main"].frames["offerte"].location.replace("/project/offerte/negozio_" + parametro + ".html")
		 }
		 else{
			 top.frames["paginamultiframe"].frames["main"].frames["offerte"].location.replace("/project/offerte/showroom_" + parametro + ".html")
		 }
	 }
	 	 
 }
}
function menuitem_onmouseover(id) {
}
function menuitem_onmouseout(id) {
}
if (top.ie){
modelloradicemenu = "<div id=\"#voce#\" class=\"scritte\" style=\"POSITION: absolute\" ></div>";
modellovocemenu =
 "<div id=\"#voce#\" style=\"POSITION: absolute; height: " + altezza_elemento_menu + "px; width: 168px;\">" +
 "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\" class=\"scritte\"><TR ALIGN=\"LEFT\"><TD WIDTH=15 VALIGN=\"TOP\">" +
 "<IMG id=IMG_ac alt=\"apri o chiudi\" src=\"#app_immagine#\" width=\"9\" height=\"9\" "+ 
 "onclick=\"return top.menuimg_onclick('#voce#')\" "+ 
 "ondblclick=\"return top.menuimg_onclick('#voce#')\">" +
 "</TD><TD ALIGN=\"LEFT\">" +
 " <A HREF=\"/project/vuoto.htm\" target=\"vuoto\" onMousedown=\"top.menuitem_onclick('#voce#','#link#')\"><font color=\"" +top.menu_scritte+ "\">#descrizione#</font></A> " +
 "</TD></TR></TABLE>" +
 "</div>";
}
else{ 
modelloradicemenu = "<div id=\"#voce#\" class=\"scritte\" style=\"POSITION:absolute;\"></div>";
modellovocemenu =
 "<div id=\"#voce#\" style=\"POSITION:absolute; height:19px; width:168px; background-color:#ffffff\">" +
 "<TABLE WIDTH=\"168\" HEIGHT=\"19\" class=\"scritte\" bgcolor=\"#ffffff\"><TR ALIGN=\"LEFT\"><TD WIDTH=15 VALIGN=\"TOP\">" +
 "<IMG id=IMG_ac alt=\"apri o chiudi\" src=\"#app_immagine#\" width=\"9\" height=\"9\" "+ 
 "onclick=\"return top.menuimg_onclick('#voce#')\" "+ 
 "ondblclick=\"return top.menuimg_onclick('#voce#')\">" +
 "</TD><TD ALIGN=\"LEFT\">" +
 " <A HREF=\"/project/vuoto.htm\" target=\"vuoto\" onMousedown=\"top.menuitem_onclick('#voce#','#link#')\"><font color=\"" +top.menu_scritte+ "\">#descrizione#</font></A> " +
 "</TD></TR></TABLE>" +
 "</div>";
}
function HTMLVoceMenu(voce,descrizione,link,app_immagine) { 
 result = modellovocemenu;
 result = result.replace(/#voce#/g,voce);
 result = result.replace(/#descrizione#/,descrizione);
 result = result.replace(/#link#/,link);
 result = result.replace(/#app_immagine#/,app_immagine); 
 return result;
}
function GeneraHTMLMenu(oggetto_document,tabellavocimenu) { 
 
 oggetto_document.write(modelloradicemenu.replace(/#voce#/,tabellavocimenu[0][0]));
 
 for (i=1; i<tabellavocimenu.length; i++) {
 voce = tabellavocimenu[i][0];
 descrizione = tabellavocimenu[i][1];
 link = tabellavocimenu[i][2]; 
 
 
 if (i<tabellavocimenu.length-1) { 
 if (tabellavocimenu[i][0].length+1<tabellavocimenu[i+1][0].length){ 
 app_immagine = "/images/piu.gif" 
 }
 else{ 
 app_immagine = "/images/niente.gif" 
 }
 } 
 oggetto_document.write(HTMLVoceMenu(voce,descrizione,link,app_immagine));
 }
}
 
 
 
 
 function OnAcquista()
 {
 alert("OnAcquista!!!");
 top.MioSommario.OnAcquista();
 }
 function Prova()
 {
 alert("Prova");
 }
 
 function LinkSelezionato(p_Url, p_Parameters)
 {
 l_Url = p_Url + "?" + "SessID=" + top.G_SessID + "&" + p_Parameters;
 
 alert(l_Url);
 }
 
 function restore() 
 { 
 
 if (document.layers)
 {
 top.MioListino.Rinfresca();
 top.MioCarrello.Rinfresca();
 top.MioSommario.Rinfresca();
 top.MioLogin.Rinfresca();
 }
 } 
 function NuovaCategoria(p_Parameters)
 {
 l_BaseUrl = "listino.asp"; 
 l_Url = l_BaseUrl + "?" + "SessID=" + top.G_SessID + "&" + p_Parameters;
 alert(l_Url);
 
 }
 function Carrello()
 {
 
 this.MaxRows = 10;
 this.RigheCarrello = new Array();
 this.FirstFreeIndex = 0;
 this.G_totale = 0;
 
 
 this.Aggiungi = AggiungiRiga;
 this.ModificaQuantita = ModificaQuantita;
 this.Rinfresca = RinfrescaCarrello;
 this.GeneraHTMLCarrello = GeneraHTMLCarrello;
 this.Init = InitCarrello;
 this.AggiungiArticolo = AggiungiArticoloAlCarrello;
 this.RimuoviArticolo = RimuoviArticoloDalCarrello;
 this.CalcolaTotali = CalcolaTotali;
 } 
 
 
 
 
 
 function CambiaTestoTooltip(p_Test)
 {
 this.m_Testo = p_Test;
 
 var HTMLString = "<Font face='ARIAL' size='0,3'><P>"+this.m_Testo+"</P></Font>";
 
 if (document.all)
 {
 
 top.frames["paginamultiframe"].frames["help"].document.all.tags("DIV")[0].innerHTML = HTMLString;
 }
 else
 if (document.layers)
 {
 
 top.frames["paginamultiframe"].frames["help"].document.layers["tooltipnn"].document.open();
 top.frames["paginamultiframe"].frames["help"].document.layers["tooltipnn"].document.write(HTMLString);
 top.frames["paginamultiframe"].frames["help"].document.layers["tooltipnn"].document.close();
 }
 else
 {
 
 alert("cambia testo tooltip <= ie 4.0, nn 4.0");
 
 } 
 
 }
 
 function InitSommario()
 {
 this.m_Totale = 0;
 }
 function Sommario()
 {
 this.m_Totale = 0;
 this.Rinfresca = RinfrescaSommario;
 this.AggiornaTotale = AggiornaTotale;
 this.Init = InitSommario;
 }
 
 
 
 function InitLogin()
 {
 }
 function RinfrescaLogin()
 {
 top.frames["paginamultiframe"].frames["login"].document.write("<FORM>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TABLE ALIGN=CENTER BORDER=0 CELLSPACING=0 CELLPADDING=0>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<Font face='ARIAL' size='0,3'>Username: </Font>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 l_Str = "<INPUT type=text name='username' size=5>";
 top.frames["paginamultiframe"].frames["login"].document.write(l_Str);
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<Font face='ARIAL' size='0,3'>Password: </Font>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 l_Str = "<INPUT type=password name='password' size=5>";
 top.frames["paginamultiframe"].frames["login"].document.write(l_Str);
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<INPUT TYPE=BUTTON VALUE=\"Login\" onclick=\"top.MioLogin.OnLogin()\" onmouseover=\"top.MioTooltip.CambiaTesto('Entra nel sito Grandi offerte ti attendono')\" onmouseout=\"top.MioTooltip.CambiaTesto('Tooltip')\" >"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("<INPUT TYPE=BUTTON VALUE=\"New\" onclick=\"top.MioLogin.OnLogin()\" onmouseover=\"top.MioTooltip.CambiaTesto('Registrati come nuovo utente Avrai grandi vantaggi')\" onmouseout=\"top.MioTooltip.CambiaTesto('Tooltip')\" >"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TD>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TR>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</TABLE>"); 
 top.frames["paginamultiframe"].frames["login"].document.write("</FORM>"); 
 }
 
 function ClickOnLogin()
 {
 alert("ClickOnLogin");
 
 top.loggato=true;
 top.Rinfresca();
 }
 
 function ClickOnNewUser()
 {
 alert("ClickOnNewUser");
 }
 function Login()
 {
 this.Init = InitLogin;
 this.Rinfresca = RinfrescaLogin;
 this.OnLogin = ClickOnLogin;
 this.OnNewUser = ClickOnNewUser;
 }
 

 
 
 var G_SessID = "AAA-FGX-100-CUCU7";
/*
 var MioListino = new Listino;
 MioListino.Init();
*/
 var MioCarrello = new Carrello;
 var MioSommario = new Sommario;
 
 var MioLogin = new Login;
 

 timeoutcambiascheda = null; 
 ritardo_caricamento_scheda = 500; 
 G_ArtSelezionato = -1; 
 G_RigaSelezionata = -1; 
 G_scheda_caricata = -1; 
 G_codice_scheda_caricata = -1; 
 function ScrollPaginaGiu() {
 var finestra = top.frames["paginamultiframe"].frames["main"].frames["listino"];
 var altezza_finestra = finestra.document.body.offsetHeight;
 
 var da_scrollare = altezza_finestra;
 var nuova_riga = G_RigaSelezionata;
 var scrollata = 0;
 while (scrollata < da_scrollare && nuova_riga<SubsetListino.length) {
 idoggetto = finestra["art"+SubsetListino[nuova_riga]];
 if (!idoggetto) 
 break;
 scrollata += idoggetto.offsetHeight;
 nuova_riga++;
 }
 CambiamentoSelezione(nuova_riga-1, true);
 }
 function ScrollPaginaSu() {
 var finestra = top.frames["paginamultiframe"].frames["main"].frames["listino"];
 var altezza_finestra = finestra.document.body.offsetHeight;
 
 var da_scrollare = altezza_finestra;
 var nuova_riga = G_RigaSelezionata;
 var scrollata = 0;
 while (scrollata < da_scrollare && nuova_riga>=0) {
 idoggetto = finestra["art"+SubsetListino[nuova_riga]];
 if (!idoggetto) 
 break;
 scrollata += idoggetto.offsetHeight;
 nuova_riga--;
 }
 CambiamentoSelezione(nuova_riga+1, true);
 }
 
 
 
 var G_listino_presente = false;
 var G_barra_negozio_presente = true; 
 function GestoreFrecce(oggetto_event) {
 var key = oggetto_event.keyCode;
 switch (key) {
 case 38: 
 if (G_listino_presente) {
 if (G_RigaSelezionata>0) {
 CambiamentoSelezione(--G_RigaSelezionata, true);
 }
 oggetto_event.returnValue = false;
 }
 break;
 case 40: 
 if (G_listino_presente) {
 if (G_RigaSelezionata<SubsetListino.length-1) {
 CambiamentoSelezione(++G_RigaSelezionata, true);
 }
 oggetto_event.returnValue = false;
 }
 break;
 case 33: 
 if (G_listino_presente) {
 ScrollPaginaSu();
 oggetto_event.returnValue = false;
 }
 break;
 case 34: 
 if (G_listino_presente) {
 ScrollPaginaGiu();
 oggetto_event.returnValue = false;
 }
 break;
 }
 }
 
 function ColoraArticoloSelezionato(attivo) {
 var finestra = top.frames["paginamultiframe"].frames["main"].frames["listino"];
 var idoggetto = finestra["art"+G_ArtSelezionato];
 if (!idoggetto) 
 return;
 if (attivo) { 
 finestra["img0art"+G_ArtSelezionato].src= top.list_img_02; 
 finestra["td0art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_img_sel;
 finestra["td1art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_sel; 
 finestra["td2art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_sel;
 finestra["td3art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_sel;
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 finestra["td4art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_sel;
 finestra["td5art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_sel;
 }
 
 ScrollaFinoAOggetto(finestra,idoggetto);
 } else { 
 finestra["img0art"+G_ArtSelezionato].src=img_carrello.src;
 finestra["td0art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_img;
 finestra["td1art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo; 
 finestra["td2art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_prezzo;
 finestra["td3art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_disp;
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 finestra["td4art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_prezzo_cons;
 finestra["td5art"+G_ArtSelezionato].style.backgroundColor=top.list_sfondo_articolo_prezzo_cons2;
 }
 
 }
 }
 
 
 function CambiamentoSelezione(nuovariga, ritardato, oggetto_window) {
 ColoraArticoloSelezionato(false, oggetto_window); 
 G_RigaSelezionata = nuovariga;
 G_ArtSelezionato = SubsetListino[G_RigaSelezionata];
 ColoraArticoloSelezionato(true, oggetto_window); 
 if (!ritardato) 
 CaricaSchedaSintetica();
 else { 
 if (timeoutcambiascheda) 
 clearTimeout(timeoutcambiascheda);
 else 
 InvalidaSchedaSintetica();
 timeoutcambiascheda = setTimeout("timeoutcambiascheda=null;CaricaSchedaSintetica()",ritardo_caricamento_scheda);
 }
 }
 
 
 var G_TabSelezionata = "Scheda";
 var G_finestra_scheda_prodotto_sintetica = null; 
 var G_URL_scheda_caricata = ""; 
 var G_scheda_da_aggiornare = false; 
 
 
 
 function CaricaSchedaSintetica() {
 if (G_TabSelezionata != "Scheda" && G_ArtSelezionato!=G_scheda_caricata) {
 G_scheda_da_aggiornare = true;
 return;
 }
 
 
 G_base= G_base 
 var URL_scheda_da_caricare = G_base + "dettagli/dettagli_" + top.MioListino.RigheListino[G_ArtSelezionato][m_Codice] + ".htm"; 
 
 G_URL_scheda_caricata = URL_scheda_da_caricare;
 
 if (G_finestra_scheda_prodotto_sintetica != null) {
 InvalidaSchedaSintetica(URL_scheda_da_caricare);
 }
 
 }
 
 var G_scheda_in_caricamento = null;
 
 function InvalidaSchedaSintetica(scheda_in_caricamento) {
 if (G_finestra_scheda_prodotto_sintetica != null) {
 if (scheda_in_caricamento)
 G_scheda_in_caricamento = scheda_in_caricamento;
 else
 G_scheda_in_caricamento = null;
 
 G_finestra_scheda_prodotto_sintetica.location.replace(G_base + "/dettagli/scheda_vuota.htm");
 
 }
 }
 
 function GestoreOnLoadSchedaVuota(oggetto_window) {
 if (G_scheda_in_caricamento)
 oggetto_window.location.replace(G_scheda_in_caricamento);
 }
 
 function CaricaDatiSchedaProdottoSintetica(oggetto_window) {
 
 
 }
 
 function VisualizzaTabSelezionata() {
 
 var thetabcard = top.frames["paginamultiframe"].frames["main"].frames["tabcard"];
 thetabcard.navigazione_negozio_carrello.style.visibility = (G_TabSelezionata=="Carrello")?"visible":"hidden";
 thetabcard.navigazione_negozio_dettagli_prodotto.style.visibility = (G_TabSelezionata=="Scheda")?"visible":"hidden";
 
 
 var thetwoiframes = top.frames["paginamultiframe"].frames["main"].frames["swap"].document.all.tags("IFRAME");
 thetwoiframes["schedaprodotto"].style.visibility = (G_TabSelezionata=="Scheda")?"visible":"hidden";
 thetwoiframes["carrello"].style.visibility = (G_TabSelezionata=="Carrello")?"visible":"hidden";
 
 if (G_TabSelezionata == "Scheda" && G_scheda_da_aggiornare) {
 G_scheda_da_aggiornare = false;
 CaricaSchedaSintetica();
 }
 }
 
 function AggiungiAlCarrello(p_i) {
 
 if (G_TabSelezionata == "Scheda") {
 G_TabSelezionata = "Carrello";
 VisualizzaTabSelezionata();
 }
 
 top.MioCarrello.AggiungiArticolo(p_i);
 }
 function SelezionataTabCarrello() {
 G_TabSelezionata = "Carrello";
 VisualizzaTabSelezionata();
 }
 function SelezionataTabScheda() {
 G_TabSelezionata = "Scheda"; 
 VisualizzaTabSelezionata();
 }
 
 
 function ImpostaRigaSelezionata(oggetto_window) {
 if (G_ArtSelezionato == -1 && SubsetListino.length>0) { 
 G_RigaSelezionata = 0;
 CambiamentoSelezione(G_RigaSelezionata, false, oggetto_window);
 } else if (SubsetListino.length>0){
 
 
 var trovato = false;
 for (var i = 0; i<SubsetListino.length; i++) {
 if (SubsetListino[i]==G_ArtSelezionato) {
 G_RigaSelezionata = i;
 trovato = true;
 break;
 }
 }
 if (!trovato) {
 G_RigaSelezionata = 0;
 }
 CambiamentoSelezione(G_RigaSelezionata);
 } else { 
 G_RigaSelezionata = -1;
 G_ArtSelezionato = -1;
 }
 }
 
 function AdattaDimensioniFinestraSwap(oggetto_window) {
 var sp = oggetto_window.document.all.tags("IFRAME")["schedaprodotto"];
 var c = oggetto_window.document.all.tags("IFRAME")["carrello"];
 sp.style.top = 0;
 sp.style.left = 0;
 sp.style.height = oggetto_window.document.body.offsetHeight;
 sp.style.width = oggetto_window.document.body.offsetWidth;
 c.style.top = 0;
 c.style.left = 0;
 c.style.height = oggetto_window.document.body.offsetHeight;
 c.style.width = oggetto_window.document.body.offsetWidth;
 }
 
 function CaricaFinestraSwapCarrelloDettagli(oggetto_window) {
 AdattaDimensioniFinestraSwap(oggetto_window);
 VisualizzaTabSelezionata();
 
 G_finestra_scheda_prodotto_sintetica = oggetto_window.schedaprodotto;
 
 if (G_URL_scheda_caricata!="") {
 G_finestra_scheda_prodotto_sintetica.location.replace(G_URL_scheda_caricata);
 }
 }
 
 
 function RimuoviFinestraSchedaProdottoSintetica() {
 G_finestra_scheda_prodotto_sintetica = null;
 }
 
 
 SubsetListino = [];
 Colonne = new Array();
 
 Colonne["p"] = [5, "G_filtraprezzomin", "G_filtraprezzomax"]; 
 Colonne["m"] = [1, "G_filtramarca", "G_filtramarca"]; 
 numero_colonne = 2;
 snfl = "top.frames[\"paginamultiframe\"].frames[\"main\"].frames[\"listino\"]."; 
 nome_ord = snfl+"ord";
 nome_ord_P = snfl+"ord_P"; 
 nome_ord_p = snfl+"ord_p"; 
 nome_ord_M = snfl+"ord_M"; 
 nome_ord_m = snfl+"ord_m"; 
 nome_ord_M_P = snfl+"ord_M_P"; 
 nome_ord_m_p = snfl+"ord_m_p"; 
 nome_ord_P_M = snfl+"ord_P_M"; 
 nome_ord_p_m = snfl+"ord_p_m";
 nome_ord_m_P = snfl+"ord_m_P";
 nome_ord_M_p = snfl+"ord_M_p";
 nome_ord_P_m = snfl+"ord_P_m";
 nome_ord_p_M = snfl+"ord_p_M";
 
 var G_ordinamento_attivo = ""; 
 
 var G_filtramarca = ""; 
 var G_filtraprezzomin = "";
 var G_filtraprezzomax = "";
 
 
 var G_filtramarca_selectedindex; 
 var G_filtraprezzomin_selectedindex; 
 var G_filtraprezzomax_selectedindex; 
 
 var tabella_nomi_globali_indici_selezionati = new Array();
 tabella_nomi_globali_indici_selezionati["filtramarca"]="G_filtramarca_selectedindex";
 tabella_nomi_globali_indici_selezionati["filtraprezzomin"]="G_filtraprezzomin_selectedindex";
 tabella_nomi_globali_indici_selezionati["filtraprezzomax"]="G_filtraprezzomax_selectedindex";
 
 var tabella_caricamento_filtri = new Array();
 var tabella_opzioni_filtri = new Array();
 
 
 function CaricaOpzioniFiltro(nomefiltro) {
 var controllo = tabella_caricamento_filtri[nomefiltro];
 var n = controllo.options.length;
 for (i=0; i<n; i++)
 controllo.options.remove(0);
 vettore_valori = tabella_opzioni_filtri[nomefiltro][0]; 
 vettore_testo = tabella_opzioni_filtri[nomefiltro][1]; 
 for (o in vettore_valori) {
 var oOption = controllo.document.createElement("OPTION");
 oOption.text=vettore_testo[o];
 oOption.value=vettore_valori[o];
 controllo.options.add(oOption);
 }
 
 controllo.selectedIndex =eval(tabella_nomi_globali_indici_selezionati[nomefiltro]);
 }
 
 function DichiaraControlliFiltraggio() {
 for (var i = 0; i<DichiaraControlliFiltraggio.arguments.length; i++) {
 var controllo = DichiaraControlliFiltraggio.arguments[i];
 var nomefiltro = controllo.id;
 tabella_caricamento_filtri[nomefiltro] = controllo;
 if (tabella_opzioni_filtri[nomefiltro]) 
 CaricaOpzioniFiltro(nomefiltro);
 }
 }
 
 function CaricaOpzioniFiltri(vettori_valori_filtri) {
 for (var nomefiltro in vettori_valori_filtri) {
 var vettore_valori_filtro = vettori_valori_filtri[nomefiltro];
 tabella_opzioni_filtri[nomefiltro] = vettore_valori_filtro;
 if (tabella_caricamento_filtri[nomefiltro]) 
 CaricaOpzioniFiltro(nomefiltro);
 }
 }
 
 function AggiungiOrdinamentoFiltro(colonna,crescente) { 
 var A = G_ordinamento_attivo.split("_").slice(1);
 var B = new Array();
 for (var i in Colonne) 
 B[i]=[0,true];
 for (var a in A) {
 var o = A[a].toLowerCase();
 B[o] = [a+1,A[a]!=o];
 }
 B[colonna][0]=numero_colonne;
 B[colonna][1]=crescente;
 var C = new Array();
 var j = 0;
 for (var b in B) 
 if (B[b][0] > 0) 
 C[j++]= (B[b][0]).toString() + "_" + b;
 C.sort();
 G_ordinamento_attivo = "";
 for (var c in C) {
 var D = C[c].split("_");
 colonna = B[D[1]][1]?(D[1].toUpperCase()):(D[1].toLowerCase());
 G_ordinamento_attivo += "_" + colonna;
 }
 MioListino.Rinfresca();
 }
 
 function ImpostaFiltroMarca(controllo) {
 G_filtramarca_selectedindex = controllo.selectedIndex;
 var valore = controllo.options(G_filtramarca_selectedindex).value;
 G_filtramarca = valore=="tutte"?"":valore;
 MioListino.Rinfresca();
 }
 function ImpostaFiltroPrezzoMin(controllo) { 
 G_filtraprezzomin_selectedindex = controllo.selectedIndex;
 var valore = controllo.options(G_filtraprezzomin_selectedindex).value;
 G_filtraprezzomin = valore==-1?"":valore;
 MioListino.Rinfresca();
 }
 function ImpostaFiltroPrezzoMax(controllo) {
 G_filtraprezzomax_selectedindex = controllo.selectedIndex;
 var valore = controllo.options(G_filtraprezzomax_selectedindex).value;
 G_filtraprezzomax = valore==-1?"":valore;
 MioListino.Rinfresca();
 }
 
 function ApplicaOrdinamentiFiltri() {
 SubsetListino = new Array();
 var ordinamento = eval(eval("nome_ord"+G_ordinamento_attivo)); 
 var n = ordinamento.length; 
 for (var i=0; i<n; i++) {
 filtrato = false; 
 if (this.RigheListino[ordinamento[i]]) { 
 for (o in Colonne) {
 var valore = this.RigheListino[ordinamento[i]][Colonne[o][0]];
 var min = eval(Colonne[o][1]);
 var max = eval(Colonne[o][2]); 
 if ( (min!="" && valore < min) || (max!="" && valore > max) ) 
 filtrato = true; 
 } 
 }
 
 if (!filtrato) {
 SubsetListino[SubsetListino.length] = ordinamento[i];
 }
 } 
 }
 
 
 function iva_inc_escl(){
 if (top.trovaiva()=="I"){
 return "inclusa";
 }
 else{
 return "esclusa";
 } 
 }
 
 
 var codice;
 var marca;
 var prodotto;
 var descr;
 var prezzo;
 var off_num = new Array();
 var off_pr = new Array(); 
 var arrivi;
 function PromoProdotto( cod ) 
 {
 off_num = new Array();
 off_pr = new Array();
 i = 0;
 app = "top.frames['paginamultiframe'].frames['main'].frames['listino'].tabella_listino";
 
 for (i==0;i<eval(app + ".length");i++){ 
 
 if (eval(app + "[i][0]") == cod){ 
 codice = eval(app + "[i][0]"); 
 marca = eval(app + "[i][1]"); 
 prodotto = eval(app + "[i][2]");
 descr = eval(app + "[i][3]"); 
 
 j=0;x=0; 
 for (j==0;j<eval(app + "[i][4].length");j=j+2){
 off_num[x] = eval(app + "[i][4][j]"); 
 off_pr[x] = eval(app + "[i][4][j+1]"); 
 x = x + 1; 
 } 
 
 prezzo = eval(app + "[i][5]");
 arrivi = eval(app + "[i][7]"); 
 break;
 } 
 }
 
 
 TopPosition = ((screen.height-350)/2)-50; 
 LeftPosition = (screen.width-400)/2; 
 var newWindow = open('/project/promo.htm','newWindow','width=400,height=350,top='+TopPosition+',left='+LeftPosition);
 newWindow.focus(); 
 }
 
 
 function SkedaProdotto( codice )
 {
 numSessione++;
 TopPosition = ((screen.height-300)/2)-50; 
 LeftPosition = (screen.width-400)/2;
 var link = "/cgi-bin/col/4?key="+codice+"&sessione="+top.sessione+top.numSessione;
 var newWindow=window.open(link,'newWindow','location=no,width=400,height=300,top='+TopPosition+',left='+LeftPosition);
 newWindow.focus();
 }
 function CaricaImmaginiListino () {
 img_carrello = new Image();
 img_carrello.src = top.list_img_01; 
 img_carrello_sel = new Image();
 img_carrello_sel.src = top.list_img_02; 
 }
 
 
 listinoInizio = 
 "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> " +
 "<tr> " +
 "<td width=\"2\"><img src=\"/images/0.gif\" width=\"0\" height=\"0\"></td> " +
 "<td>" +
 "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> " +
 "<tr> " +
 "<td bgcolor=\"#000000\" valign=\"top\"> " +
 "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\" class=\"scritte\"> ";
 listinoCorpo =
 "<tr id=\"art##{indice}##\" " +
 "onclick=\"top.CambiamentoSelezione(##{riga}##)\" " +
 "OnMouseOver=\"top.ShowTip('" +
 "Rendi attivo questo articolo e utilizza gli strumenti')\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " +
 "> " +
 "<td id=\"td0art##{indice}##\" width=\"20\" bgcolor=\"" +top.list_sfondo_img+ "\"" +
 "OnMouseOver=\"top.ShowTip('Inserisci nel carrello'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " +
 "onclick=\"top.AggiungiAlCarrello(##{indice}##);" +
 "> " +
 "<img id=\"img0art##{indice}##\" src=\" " +top.list_img_01+ " \" width=\"19\" height=\"14\" " +
 "> " +
 "</td> " +
 "<td id=\"td1art##{indice}##\" width=\"58%\" bgcolor=\"#FFFFFF\">##{codice}##<a href=\"##{link}##\">##{articolo}##</a> ##{descrizione}##</td> " +
 "<td id=\"td2art##{indice}##\" width=\"15%\" bgcolor=\"" +top.list_sfondo_articolo_prezzo+ "\">" +
 "<span align=\"center\">##{prezzolire}##</span> " +
 "</td> "+
 "<td id=\"td3art##{indice}##\" width=\"10%\" bgcolor=\"ffffff\">" +
 "<span align=\"center\">##{prezzoeuro}##</span> " +
 "</td> " +
 
 "<td id=\"td3art##{indice}##\" width=\"10%\" bgcolor=\"ffffff\">" +
 "<span align=\"center\">##{prezzoeuro}##</span> " +
 "</td> " +
 "<td id=\"td3art##{indice}##\" width=\"10%\" bgcolor=\"ffffff\">" +
 "<span align=\"center\">##{prezzoeuro}##</span> " +
 "</td> " +
 
 "</tr> ";
 listinoFine = "</table></td></tr></table></td></tr></table>";
/* function CreaElementoTabella(riga,indice,codice,articolo,descrizione,prezzolire,prezzoeuro) {
 result = listinoCorpo;
 result = result.replace(/##{riga}##/,riga);
 result = result.replace(/##{indice}##/g,indice);
 result = result.replace(/##{codice}##/,codice);
 result = result.replace(/##{articolo}##/,articolo);
 result = result.replace(/##{descrizione}##/,descrizione);
 result = result.replace(/##{prezzolire}##/,prezzolire);
 result = result.replace(/##{prezzoeuro}##/,prezzoeuro);
 return result;
 }
*/
 
 /************** funzione che scorpora dal prezzo consigliato la percentuale di ricarico ****************/
 function scorp(pr){
 app = eval(top.var_prezzi)
 app = app+100
 pr = Math.round( ((pr*100)/app)*100 )/100 
 if (top.var_prezzi!="0"){
 if (top.var_prezzi.indexOf("-")!=-1){
 pr = top.dr_format(pr) + " " +top.var_prezzi+ "%"
 }
 else{
 pr = top.dr_format(pr) + " + " +top.var_prezzi+ "%"
 } 
 }
 else{ 
 pr = top.dr_format(pr)
 }
 return pr 
 }
 
 
 function CreaElementoTabella(riga,indice,codice,marca,articolo,descrizione,prezzoeuro,disponibilita,prezzocons) {
 
 if (MioListino.RigheListino[riga][4].length!=0){
 	var prezzox="<font color=\"#ff9900\">*</font>&nbsp;€&nbsp;" + top.dr_format(prezzoeuro);
	var in_promozione = ". Clicca per l'offerta"
 }
 else{
 	var prezzox = "&nbsp;€&nbsp;" + top.dr_format(prezzoeuro);
	var in_promozione = ""
 }

/* per disponibilita/in arrivo */
 var app = disponibilita.toString();
 var app1 = app.indexOf("/");
 var disp = app.substring(0,app1-1); 
 var arr = app.substring(app1+2,app.length); 
 if (arr!="0"){in_arrivo = ". Clicca per sapere quando arriva"}
 else{in_arrivo = ""}
  
 
 var prezzoconsx = "&nbsp;€&nbsp;" + top.dr_format(prezzocons)
 var percx = top.dr_format( Math.round( (((prezzocons-prezzoeuro)*100)/prezzoeuro)*100 )/100 )
 
 var result =
 "<tr id=\"art"+indice+"\" bgcolor=\"#FFFFFF\" onclick=\"top.CambiamentoSelezione("+riga+")\" " +
 "OnMouseOver=\"top.ShowTip('" +
 "Rendi attivo questo articolo e utilizza gli strumenti')\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " +
 "> " +
 "<td style=\"border: " +top.list_bordo_carrello+ " 1px solid\" id=\"td0art"+indice+"\" width=\"20\" bgcolor=\"" +top.list_sfondo_img+ "\"" +
 "OnMouseOver=\"top.ShowTip('Inserisci nel carrello'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " +
 "onclick=\"top.AggiungiAlCarrello("+indice+")\" " +
 "ondblclick=\"top.AggiungiAlCarrello("+indice+")\" " +
 "> " +
 "<img id=\"img0art"+indice+"\" src=\" " +top.list_img_01+ " \" width=\"19\" height=\"14\" alt=\"Aggiungi al carrello\" " +
 "> " +
 "</td> " +
 "<td id=\"td1art"+indice+"\" bgcolor=\"#FFFFFF\"><font color=\"" +top.list_scritte+ "\">"+codice+" <b><a>"+marca+ " " +articolo+"</a></b> "+descrizione+"</font></td> " +
 "<td id=\"td2art"+indice+"\" width=\"70\" bgcolor=\"" +top.list_sfondo_articolo_prezzo+ "\" align=\"right\" " +
 "OnMouseOver=\"top.ShowTip('<strong>Prezzi iva " +iva_inc_escl()+ ".</strong> L´eventuale presenza del carattere (*) indica l´esistenza di un´<strong>offerta per quantità</strong>: clicca per maggiori informazioni.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " + 
 "> " +
 "<a href=\"javascript:top.PromoProdotto("+codice+")\" title=\"Prezzo iva "+iva_inc_escl()+ in_promozione +"\"><font color=\"" +top.list_scritte_prezzo+ "\">" +prezzox+ "&nbsp;</font></a>" +
 "</td> "+
 "<td id=\"td3art"+indice+"\" width=\"50\" bgcolor=\"ffffff\" align=\"center\" " +
 "OnMouseOver=\"top.ShowTip('Colonna delle disponibilità: il 1° campo riporta la <strong>disponibilità attuale</strong>, il 2° i <strong>prodotti in arrivo</strong> ancora disponibili. Clicca per ulteriori informazioni.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\"> " +
 "<a href=\"javascript:top.SkedaProdotto("+codice+")\" title=\"Disponibilità:"+disp+" / In arrivo:"+arr+ in_arrivo +"\"><font color=\"" +top.list_scritte_disp+ "\">"+disponibilita+"</font></a>" +
 "</td> " 
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 result = result +
 "<td id=\"td4art"+indice+"\" width=\"70\" bgcolor=\"" +top.list_sfondo_articolo_prezzo_cons+ "\" align=\"right\" " +
 "OnMouseOver=\"top.ShowTip('<strong>Prezzi iva " +iva_inc_escl()+ ".</strong> Prezzo di vendita al pubblico: prezzo consigliato € " +scorp(prezzocons)+ ".'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " + 
 "title=\"Prezzo di vendita al pubblico\"> " +
 "<font color=\"" +top.list_scritte_prezzo_cons+ "\">" +prezzoconsx+ "&nbsp;</font>" +
 "</td> "+
 "<td id=\"td5art"+indice+"\" width=\"40\" bgcolor=\"" +top.list_sfondo_articolo_prezzo_cons2+ "\" align=\"right\" " +
 "OnMouseOver=\"top.ShowTip('Percentuale di ricarico: <strong>" +percx+ "%</strong>'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " + 
 "title=\"Percentuale di ricarico\"> " +
 "<font color=\"" +top.list_scritte_prezzo_cons+ "\">" +percx+ "</font>" +
 "</td> "
 }
 
 result = result +
 "</tr> ";
 
 return result;
 }
 
 var min_righe_per_step = 15;
 var tempo_tra_step_genlist = 100;
 
 var righe_per_step = 0; 
 var G_genlist_step = 0; 
 var timeout_genlist = null; 
 
 function AnnullaGenerazioneListino() {
 top.clearTimeout(timeout_genlist);
 }
 function StepGenerazioneListino()
 { 
 genlist_from = G_genlist_step * righe_per_step;
 genlist_to = Math.min(genlist_from + righe_per_step, SubsetListino.length);
 
 HTMLString = listinoInizio;
 for (var j = genlist_from; j < genlist_to; j++) 
 { 
 i = SubsetListino[j];
 
 HTMLString += CreaElementoTabella(
 j,
 i,
 MioListino.RigheListino[i][m_Codice],
 MioListino.RigheListino[i][m_Marca],
 MioListino.RigheListino[i][m_Nome], 
 MioListino.RigheListino[i][m_Descrizione], 
 MioListino.RigheListino[i][m_PrezzoEuro], 
 MioListino.RigheListino[i][m_Disponibilita],
 MioListino.RigheListino[i][m_PrezzoCons]
 );
 
 } 
 
 HTMLString += listinoFine; 
 
 genlist_from = genlist_to;
 
 
 var oggetto_div = MioListino.divs["div_listino_"+G_genlist_step];
 G_genlist_step++;
 oggetto_div.innerHTML = HTMLString;
 oggetto_div.style.position = "relative";
 oggetto_div.style.top = 1-G_genlist_step;
 if (genlist_from<SubsetListino.length)
 timeout_genlist = top.setTimeout("StepGenerazioneListino()", tempo_tra_step_genlist);
 }
 function RinfrescaListino(oggetto_window) 
 {
 AnnullaGenerazioneListino();
 
 
 this.aof();
 
 
 for (var d = 0; d < this.divs.length; d++) {
 this.divs[d].innerHTML="";
 this.divs[d].style.height = 0;
 this.divs[d].style.position = "absolute";
 this.divs[d].style.top = 0;
 }
 
 righe_per_step = Math.max(min_righe_per_step, Math.ceil(this.RigheListino.length/this.divs.length));
 G_genlist_step = 0;
 
 StepGenerazioneListino();
 
 ImpostaRigaSelezionata(oggetto_window);
 }
 function NuovoListino(oggetto_window) 
 {
 
 
 var sa = ScatolaAttiva();
 if (sa) sa.CambiaTitoloScatola(oggetto_window);
 
 CaricaOpzioniFiltri(oggetto_window.vettori_valori_filtri);
 if ( G_prodotto != -1 ) {
 temp_listino = oggetto_window.tabella_listino;
 for ( var i in temp_listino )
 {
 temp_codice = temp_listino[i][0];
 if ( G_prodotto == temp_codice )
 {
 G_ArtSelezionato = i ;
 break;
 }
 }
 G_prodotto = -1;
 }
 MioListino = new Listino(oggetto_window);
 MioListino.Rinfresca(oggetto_window);
 
 G_listino_presente = true;
 AttivazioneBottoniBarraNegozio(); 
 
 oggetto_window.focus();
 }
 function NienteListino() 
 {
 AnnullaGenerazioneListino();
 G_listino_presente = false;
 }
 function InitListino() 
 {
 this.FirstFreeIndex = 0;
 }
 function Listino(oggetto_window)
 {
 
 this.divs = oggetto_window.document.all.tags("DIV");
 this.RigheListino = oggetto_window.tabella_listino;
 this.FirstFreeIndex = 0;
 
 
 this.Rinfresca = RinfrescaListino;
 this.Init = InitListino;
 
 this.aof = ApplicaOrdinamentiFiltri;
 } 
 var MioListino = null;
 var m_Codice = 0;
 var m_Marca = 1;
 var m_Nome = 2;
 var m_Descrizione = 3;
 var m_Prezzo = 4;
 var m_PrezzoEuro = 5;
 
 
 var m_Disponibilita = 6;
 var m_PrezzoCons = 7;
 
 
 
function totaleArticoloCarrello(index){
 i=index; 
 var prezzototale = top.MioCarrello.RigheCarrello[i].m_DatiProdotto[5] * top.MioCarrello.RigheCarrello[i].m_Quant;
 for (k=0;k<top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4].length;k=k+2){
 
 if (top.MioCarrello.RigheCarrello[i].m_Quant >= top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4][k]){
 var prezzototale = top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4][k+1] * top.MioCarrello.RigheCarrello[i].m_Quant; 
 } 
 }
 prezzototale = Math.round(prezzototale*100)/100;  
 return prezzototale; 
 }
 
 
 
 function totaleArticoloCarrelloCons(index){
 i=index; 
 
 var prezzototaleCons = top.MioCarrello.RigheCarrello[i].m_DatiProdotto[7] * top.MioCarrello.RigheCarrello[i].m_Quant; 
 prezzototaleCons = Math.round(prezzototaleCons*100)/100; 
 return prezzototaleCons; 
 }
 
 
 
 function esisteOfferta(index){
 i=index;
 var offerta=''; 
 for (k=0;k<top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4].length;k=k+2){
 
 if (top.MioCarrello.RigheCarrello[i].m_Quant >= top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4][k]){
 var offerta = '(Prodotto in offerta)'; 
 } 
 } 
 
 return offerta; 
 }
 
 
 var codice2;
 var marca2;
 var prodotto2;
 var descrizione2;
 var prezzo2;
 var prezzo2unitario;
 var prezzoC;
 var qtaC;
 var off_num2 = new Array();
 var off_pr2 = new Array(); 
 
 function PromoProdotto2(cod2,mrc2,art2,descr2,pr2,prcons,prqta2,lk,qta){
 
 lnk = lk; 
 off_num2 = new Array();
 off_pr2 = new Array();
 
 marca2 = mrc2; 
 codice2 = cod2; 
 prodotto2 = art2;
 descrizione2 = descr2; 
 
 j=0;x=0; 
 for (j==0;j<prqta2.length;j=j+2){
 off_num2[x] = prqta2[j]; 
 off_pr2[x] = prqta2[j+1]; 
 x = x + 1; 
 } 
 
 prezzo2 = pr2; 
 prezzo2unitario = pr2;
 
 for (i=0;i<top.MioCarrello.RigheCarrello.length;i++){
 if (top.MioCarrello.RigheCarrello[i].m_Cod==codice2){
 for (k=0;k<top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4].length;k=k+2){
 
 if (top.MioCarrello.RigheCarrello[i].m_Quant >= top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4][k]){
 prezzo2 = top.MioCarrello.RigheCarrello[i].m_DatiProdotto[4][k+1]; 
 } 
 } 
 } 
 }
 prezzo2 = Number(prezzo2);
 
 
 prezzoC = prcons; 
 qtaC = qta;
 
 TopPosition = ((screen.height-400)/2)-50; 
 LeftPosition = (screen.width-350)/2; 
 var newWindow = open(lnk,'newWindow','width=400,height=350,top='+TopPosition+',left='+LeftPosition);
 newWindow.focus(); 
 
 } 
 
 
 function check (cod,descr){ 
 lk = "/dettagli/sk2win.htm?" + cod + "-" + descr;
 TopPosition = ((screen.height-450)/2)-50; 
 LeftPosition = (screen.width-645)/2; 
 newWindow = open(lk,'newWindow','width=645,height=450,toolbar=yes,scrollbars,resizable=yes,status=yes,top='+TopPosition+'left='+LeftPosition);
 newWindow.focus(); 
 }
 
 
 perc_ricarico=0;
 function perc(p,c){ 
 var pi = eval(p)
 var ci = eval(c)
 perc_ricarico = ((ci-pi)*100)/pi
 
 } 
 
 
 carrelloInizio =
 "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" name=\"tablediv\" id=\"tablediv\"> " +
 "<tr> " +
 "<td width=\"2\"><img src=\"/images/0.gif\" width=\"2\" height=\"1\"></td> " +
 "<td> " +
 "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"scritte\"> ";
 
 function carrelloCorpo() {
 
 var htmlstring =
 "<tr> "+
 
 "<td width=\"9%\" bgcolor=\"ffffff\" " +
 "OnMouseOver=\"top.ShowTip('Clicca per visualizzare la scheda dettagliata del prodotto.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div align=\"center\">" +
 "<a href=\"javascript:top.check('#codice#','#descrizione#')\" title=\"Clicca per la scheda dettagliata\">#codice#</a></div>" +
 
 "</td> "
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){ 
 htmlstring = htmlstring +
 "<td width=\"45%\" bgcolor=\"ebebeb\" " + 
 "OnMouseOver=\"top.ShowTip('Clicca per visualizzare la scheda dettagliata del prodotto.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 
 "<div align=\"left\">" +
 "<a href=\"javascript:top.check('#codice#','#descrizione#')\" title=\"Clicca per la scheda dettagliata\"><strong>#marca#" + " " + "#articolo#</strong>" + " " + "#descrizione#</a></div>" + 
 "</td> "
 }
 else{
 htmlstring = htmlstring +
 "<td width=\"60%\" bgcolor=\"ebebeb\" " + 
 "OnMouseOver=\"top.ShowTip('Clicca per visualizzare la scheda dettagliata del prodotto.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 
 "<div align=\"left\">" +
 "<a href=\"javascript:top.check('#codice#','#descrizione#')\" title=\"Clicca per la scheda dettagliata\"><strong>#marca#" + " " + "#articolo#</strong>" + " " + "#descrizione#</a></div>" + 
 "</td> "
 }
 htmlstring = htmlstring +
 "<td width=\"10%\" bgcolor=\"#FFFFFF\" title=\"Modifica la quantità\"> " + 
 "<div align=\"center\" > " + 
 "<input id=q#codice# type=\"text\" value=#quantita# name=\"quantita\" " + 
 "onkeyup=\"return top.MioCarrello.ModificaQuantita(#riga#, event.srcElement, 'q#codice#', 'p#codice#', 'w#codice#')\" " + 
 "onblur=\"return top.MioCarrello.ModificaQuantita(#riga#, event.srcElement, 'q#codice#', 'p#codice#', 'w#codice#', true)\" " + 
 " class=\"numart\" size=\"2\" maxlength=\"3\">" + 
 "</div> " +
 "</td> " +
 

 "<td width=\"15%\" bgcolor=\"ebebeb\" " +
 "OnMouseOver=\"top.ShowTip('<strong>Prezzi iva " +top.iva_inc_escl()+ ".</strong> L´eventuale presenza del carattere (*) indica l´esistenza di un´<strong>offerta per quantità</strong>: clicca per maggiori informazioni.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div id=p#codice# align=\"center\">" +
 "<a href=\"javascript:top.PromoProdotto2('#codice#','#marca#','#articolo#','#descrizione#','#prUnitario#','',[#prezzoQta#],'/project/promo2.htm','#quantita#')\" title=\"Prezzo iva "+top.iva_inc_escl()+"#offerta#\">#asterisco#&nbsp;€&nbsp;#prezzototale#</a></div>" +
 "</td>"
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){ 
 htmlstring = htmlstring +
 "<td width=\"15%\" bgcolor=\"ebebeb\" " +
 "OnMouseOver=\"top.perc('#prezzototale#','#prezzototaleCons#');top.ShowTip('<strong>Prezzi iva " +top.iva_inc_escl()+ ".</strong> Prezzo di vendita al pubblico consigliato. Clicca per modificare.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div id=w#codice# align=\"center\">" +
 "<a href=\"javascript:top.PromoProdotto2('#codice#','#marca#','#articolo#','#descrizione#','#prUnitario#','#prezzototaleCons#',[#prezzoQta#],'/project/promo_cons.htm','#quantita#')\" title=\"Clicca per modificare\">€&nbsp;#prezzototaleCons#</a></div>" +
 "</td>"
 }
 else{ 
 htmlstring = htmlstring +
 "<td width=\"1%\" bgcolor=\"ffffff\" " + 
 "<div id=w#codice#>" +
 "</td>"
 }
 
 
 
 htmlstring = htmlstring +
 "<td width=\"83\" align=\"center\" " +
 "OnMouseOver=\"top.ShowTip('Clicca per rimuovere il prodotto dal carrello.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" " +
 "> " +
 "<div align=\"center\"> " + 
 " <a href=javascript:void(0)><img src=\"/images/carrello_rimuovi2.gif\" hspace=1 onload=\"JJ_killscroll()\" width=\"20\" height=\"15\" alt=\"Rimuovi il prodotto\" border=\"0\" " +
 "onclick=\"top.MioCarrello.RimuoviArticolo(#riga#);\" " +
 "></a>" +
 "</div> " +
 "</td> " +
 "</tr> ";
 
 return htmlstring;
 }
 
 
 function carrelloCorpo2() {
 var htmlstring =
 "<tr> "+
 
 "<td width=\"9%\" bgcolor=\"#ffffff\" > " + 
 "<div align=\"center\"><a href=\"#\">#codice#</a></div> " +
 "</td> " + 
 
 "<td width=\"45%\" bgcolor=\"ebebeb\"> " + 
 "<div align=\"left\"><a href=\"#\">#articolo#</a> #descrizione#<INPUT type=\"hidden\" name=#descrizioneProg# value=\"#Alldescrizione#\"><INPUT type=\"hidden\" name=#prezzoProg# value=#prezzo#><INPUT type=\"hidden\" name=#codiceProg# value=#codice#></div> " +
 "</td> " +
 "<td width=\"10%\" bgcolor=\"#FFFFFF\"> " + 
 "<div align=\"center\">#quantita#<input type=\"hidden\" name=#quantitaProg# id=\"quantita\" value=#quantita#></div> " +
 "</td> " +
 "<td width=\"15%\" bgcolor=\"ebebeb\"> " +
 "<div align=\"center\">€&nbsp;#prezzototale#</div>" +
 "</td> " 
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 htmlstring = htmlstring +
 "<td width=\"15%\" bgcolor=\"ebebeb\"> " +
 "<div align=\"center\">€&nbsp;#prezzototaleCons#</div>" +
 "</td> " 
 }
 
 
 htmlstring = htmlstring +
 "</tr> ";
 
 return htmlstring;
 }
 
 carrelloFine = "</table></td></tr></table>";
 function CreaElementoCarrello(pattern,riga,numart,codice,marca,articolo,descrizione,quantita,prezzototale,prezzototaleCons,prezzoQta,prUnitario) {
 result = pattern;
 result = result.replace(/#Alldescrizione#/g, articolo + descrizione );
 result = result.replace(/#prezzo#/g, prezzototale );
 result = result.replace(/#prezzoProg#/g,"prezzo" + numart );
 result = result.replace(/#riga#/g,riga );
 result = result.replace(/#codiceProg#/g,"codice" + numart );
 
 result = result.replace(/#marca#/g,marca );
 
 result = result.replace(/#codice#/g,codice );
 result = result.replace(/#articolo#/g,articolo);
 result = result.replace(/#descrizione#/g, descrizione );
 result = result.replace(/#descrizioneProg#/g,"descrizione" + numart );
 result = result.replace(/#quantitaProg#/g,"quantita" + numart );
 result = result.replace(/#quantita#/g,quantita);
 
 if (prezzoQta.length>0){
 result = result.replace(/#asterisco#/g,'<font color="#FF9900">*</font>');
 result = result.replace(/#offerta#/g,'. Clicca per offerta');
 }
 else{
 result = result.replace(/#asterisco#/g,''); 
 result = result.replace(/#offerta#/g,'');
 }
 
 result = result.replace(/#prezzototale#/g,prezzototale);
 result = result.replace(/#prezzototaleCons#/g,prezzototaleCons);
 result = result.replace(/#prezzoQta#/g,prezzoQta);
 result = result.replace(/#prUnitario#/g,prUnitario); 
 
 return result;
 }
 function svuotacarrello()
 {
 for (var i in MioCarrello.RigheCarrello)
 {
 MioCarrello.RimuoviArticolo(i);
 }
 }
 function GeneraHTMLspeseSconti(Carrello) {
 var HTMLString = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" name=\"tabledivs\" id=\"tabledivs\"> " +
 "<tr> " +
 "<td width=\"2\"><img src=\"/images/0.gif\" width=\"2\" height=\"1\"></td> " +
 "<td> " +
 "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"scritte\"> ";
 
 var indice_add = 0;
 for (var i in Carrello.RigheCarrello)
 if (Carrello.RigheCarrello[i].m_Cod != -1)
 indice_add++;
 
 /********* modificato per addizionali ***********/
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 var totaleAddizionali = 0
 }
 else{ 
 var totaleAddizionali = 0 
 for (i=0;i<top.addizionali_ordini.length;i++){ 
 indice_add++;
 HTMLString += "<tr><td width=\"9%\" bgcolor=\"#ffffff\"><div align=\"center\">&nbsp;</div></td> " + 
 "<td width=\"45%\" bgcolor=\"ebebeb\"> " + 
 "<div align=\"left\">" + top.addizionali_ordini[i] +
 "<INPUT type=\"hidden\" name=\"descrizione" + indice_add + "\" value=\""+ top.addizionali_ordini[i] +"\">" +
 "<INPUT type=\"hidden\" name=\"prezzo" + indice_add + "\" value=\"" + top.importo_addizionali_ordini[i] + "\">" +
 "<INPUT type=\"hidden\" name=\"codice" + indice_add + "\" value=\"*\"></div> " +
 "</td> " +
 "<td width=\"10%\" bgcolor=\"#FFFFFF\"> " + 
 "<div align=\"center\">&nbsp;<input type=\"hidden\" name=\"quantita" + indice_add + "\" value=\"1\" ></div> " +
 "</td> "
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 HTMLString = HTMLString +
 "<td width=\"15%\" bgcolor=\"ebebeb\"> " +
 "<div align=\"center\"></div>" +
 "</td> " 
 }
 
 
 HTMLString = HTMLString +
 "<td width=\"15%\" bgcolor=\"ebebeb\"> " +
 "<div align=\"center\">€&nbsp;" + top.importo_addizionali_ordini[i] + "</div>" +
 "</td> " +
 "</tr> ";
 } 
 }
 
 HTMLString += carrelloFine;
 
 return HTMLString; 
 }
 function GeneraTabellaOrdine(tabella_ordini) {
 tabella_ordini.innerHTML = MioCarrello.GeneraHTMLCarrello(carrelloCorpo2());
 tabella_ordini.innerHTML = tabella_ordini.innerHTML + GeneraHTMLspeseSconti(MioCarrello); 
 }
 /*******************************************************************************************/
 /*******************************************************************************************/ 
 
 function GeneraHTMLnuovoArticolo(Carrello) {
 var HTMLString = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" name=\"tabledivs\" id=\"tabledivs\"> " +
 "<tr> " +
 "<td width=\"2\"><img src=\"/images/0.gif\" width=\"2\" height=\"1\"></td> " +
 "<td> " +
 "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"scritte\"> ";
 
 var indice_add = 0;
 for (var i in Carrello.RigheCarrello)
 if (Carrello.RigheCarrello[i].m_Cod != -1)
 indice_add++;
 
 
 for (i=0;i<top.mioCod.length;i++){ 
 
 if (top.miaQta[i]!=0){
 indice_add++;
 HTMLString += "<tr>" +
 "<td width=\"9%\" bgcolor=\"#ffffff\"><div align=\"center\" " +
 "OnMouseOver=\"top.ShowTip('Codice del nuovo articolo. Clicca per modificare.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<a href=\"javascript:void(0)\" onclick=\"top.modificaNuovoArticolo(" +i+ ")\" title=\"Clicca per modificare\">" +
 top.mioCod[i]+ 
 "</a>" + 
 "</div></td> " + 
 "<td width=\"45%\" bgcolor=\"ebebeb\" " + 
 "OnMouseOver=\"top.ShowTip('Descrizione del nuovo articolo. Clicca per modificare.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div align=\"left\">" +
 "<a href=\"javascript:void(0)\" onclick=\"top.modificaNuovoArticolo(" +i+ ")\" title=\"Clicca per modificare\">" +
 top.miaDescr[i]+
 "</a>" + 
 "<INPUT type=\"hidden\" name=\"descrizione" + indice_add + "\" value=\""+ top.miaDescr[i] +"\">" +
 "<INPUT type=\"hidden\" name=\"prezzo" + indice_add + "\" value=\"" + top.mioPr2[i] + "\">" +
 "<INPUT type=\"hidden\" name=\"codice" + indice_add + "\" value=\"" +top.mioCod[i] + "\"></div> " +
 "</td> " +
 "<td width=\"10%\" bgcolor=\"#FFFFFF\"> " + 
 "<div align=\"center\"><input type=\"text\" name=\"quantita" + indice_add + "\" value=\" " +top.miaQta[i]+ " \" class=\"numart\" size=\"2\" maxlength=\"3\" readonly></div> " +
 "</td> "
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 HTMLString = HTMLString +
 "<td width=\"15%\" bgcolor=\"ebebeb\"> " +
 "<div align=\"center\"></div>" +
 "</td> " 
 }
 
 app2 = Math.round(top.mioPr2[i]*100)/100
 HTMLString = HTMLString +
 "<td width=\"15%\" bgcolor=\"ebebeb\" " +
 "OnMouseOver=\"top.ShowTip('<strong>Prezzi iva " +top.iva_inc_escl()+ ".</strong> Clicca per modificare.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div align=\"center\">" +
 "<a href=\"javascript:void(0)\" onclick=\"top.modificaNuovoArticolo(" +i+ ")\" title=\"Clicca per modificare\">" +
 "€&nbsp;" + dr_format(app2*top.miaQta[i]) + 
 "</a>" +
 "</div>" +
 "</td> " 
 
 HTMLString = HTMLString +
 "<td width=\"83\" align=\"center\" " +
 "OnMouseOver=\"top.ShowTip('Clicca per rimuovere il prodotto dal carrello.'); event.cancelBubble=true\" " +
 "onmouseout=\"top.ShowDefaultTip()\" >" + 
 "<div align=\"center\">" +
 "<a href=\"javascript:void(0)\" onclick=\"top.rimuoviNuovoArticolo(" +i+ ")\">" +
 "<img src=\"/images/carrello_rimuovi2.gif\" hspace=1 width=\"20\" height=\"15\" border=0  alt=\"Rimuovi il prodotto\">" +
 "</a>" +
 "</div>" +
 "</td>" +
 "</tr>"
 } 
 } 
 HTMLString += carrelloFine;
 
 return HTMLString; 
 }
 
 
 function rimuoviNuovoArticolo(i){
 mioCod[i]=0;
 miaDescr[i]="";
 miaQta[i]=0;
 mioPr2[i]=0;
 var app = MioCarrello.GeneraHTMLCarrello(carrelloCorpo());
 var app1 = GeneraHTMLnuovoArticolo(MioCarrello);
 var app2 = app + app1;
 OC_tabella_del_carrello.Set(app2);
 MioCarrello.Rinfresca();
 
 
 
 } 
 
 var indModificaArticolo;
 function modificaNuovoArticolo(i){
 indModificaArticolo = i
 
 TopPosition = ((screen.height-400)/2)-50; 
 LeftPosition = (screen.width-350)/2;
 var newWindow = open('/project/modifica_art.htm','newWindow','width=400,height=350,top='+TopPosition+',left='+LeftPosition);
 newWindow.focus(); 
 
 
 
 }
 
 
 
 var mioCod = new Array();
 var miaDescr = new Array();
 var miaQta = new Array();
 var mioPr2 = new Array();
 var mioIndice = 0;
 
 function GeneraNuovoArticolo(tabella_del_carrello,cod, marca, nome, descr, qta, pr1, pr2, indice){
 
 
 mioIndice = indice; 
 mioCod[mioIndice] = cod;
 miaDescr[mioIndice] = descr; 
 miaQta[mioIndice] = qta;
 mioPr2[mioIndice] = pr2; 
 
 var app = MioCarrello.GeneraHTMLCarrello(carrelloCorpo());
 var app1 = GeneraHTMLnuovoArticolo(MioCarrello);
 var app2 = app + app1;
 OC_tabella_del_carrello.Set(app2);
 MioCarrello.Rinfresca(); 
 
 mioIndice++;
 
 
 } 
 /*******************************************************************************************/
 /*******************************************************************************************/
 function GeneraHTMLCarrello(pattern) {
 
 NumArticoliInCarrello = 0;
 var HTMLString = carrelloInizio;
 
 for (var i in this.RigheCarrello) {
 if (this.RigheCarrello[i].m_Cod != -1) { 
 NumArticoliInCarrello++; 
 HTMLString += CreaElementoCarrello(pattern
 ,i
 ,NumArticoliInCarrello
 ,this.RigheCarrello[i].m_Cod
 ,this.RigheCarrello[i].m_DatiProdotto[m_Marca]
 ,this.RigheCarrello[i].m_DatiProdotto[m_Nome]
 ,this.RigheCarrello[i].m_DatiProdotto[m_Descrizione]
 ,this.RigheCarrello[i].m_Quant
 ,this.RigheCarrello[i].m_Prezz
 ,this.RigheCarrello[i].m_PrezzCons
 ,this.RigheCarrello[i].m_DatiProdotto[4]
 ,this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro])
 }
 
 }
 HTMLString += carrelloFine;
 
 var NumNuoviArticoliInCarrello = 0
 for (i=0;i<top.mioCod.length;i++){  
	 if (top.miaQta[i]!=0){
	 	NumNuoviArticoliInCarrello++;
	 }
 }		
 if ( (NumArticoliInCarrello==0) && (NumNuoviArticoliInCarrello==0) ) {
	 HTMLString = "<div id=Layer1 style=\"position:absolute; left:0px; top:0px; width:100%;height:100%; z-index:1; background-color: #ffffff; layer-background-color: #e5e5e5; border: 1px none #000000;\"><table width=100% height=100% border=0 align=center cellpadding=0 cellspacing=0><tr><td valign=middle><div align=center><img src=\"" +top.carrello_vuoto+ "\"></div></td></tr></table></div>";
 }
 
 return HTMLString; 
 }
 
 
 
 var OC_tabella_del_carrello = OggettiCondivisi["tabella_del_carrello"] = new OggettoCondiviso(".innerHTML");
 
 function RinfrescaCarrello() 
 { 
 this.CalcolaTotali();
 
 var app = MioCarrello.GeneraHTMLCarrello(carrelloCorpo())
 var app1 = GeneraHTMLnuovoArticolo(MioCarrello)
 var app2 = app + app1
 if (top.mioPr2!=0){
 OC_tabella_del_carrello.Set(app2);
 }
 else{
 OC_tabella_del_carrello.Set(app);
 } 
 
 
 
 MioSommario.Rinfresca();
 }
 
 var OC_campo_del_totale = OggettiCondivisi["campo_del_totale"] = new OggettoCondiviso(".innerHTML");
 var OC_campo_del_totale2 = OggettiCondivisi["campo_del_totale2"] = new OggettoCondiviso(".innerHTML");
 var OC_campo_del_totale_cons = OggettiCondivisi["campo_del_totale_cons"] = new OggettoCondiviso(".innerHTML");
 function InitCarrello() 
 {
 this.RigheCarrello = new Array();
 this.totale = 0;
 }
 
 var DatiDaRiportareInCarrello = [m_Nome, m_Descrizione, m_PrezzoEuro , m_Prezzo , m_PrezzoCons, m_Marca];
 
 function ArticoloCarrello(p_Cod, p_Prezz, p_DatiProdotto, p_qta)
 {
 this.m_Cod=p_Cod;
 this.m_Quant = p_qta
 this.m_Prezz=p_Prezz;
 this.m_DatiProdotto=p_DatiProdotto;
 
 
 }
 
 
 function AggiungiRiga(p_RigaListino) 
 {
 var Cod = MioListino.RigheListino[p_RigaListino][m_Codice];
 
 var prezzounitario = MioListino.RigheListino[p_RigaListino][m_PrezzoEuro];
 
 var prezzounitarioCons = MioListino.RigheListino[p_RigaListino][m_PrezzoCons]; 
 
 
 var GiaInCarrello = false;
 
 for (var i in this.RigheCarrello) 
 {
 if (this.RigheCarrello[i].m_Cod == Cod )
 {
 this.RigheCarrello[i].m_Quant++;
 
 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] = prezzounitario;
 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoCons] = MioCarrello.RigheCarrello[i].m_DatiProdotto[7]; 
 
 GiaInCarrello = true;
 break;
 }
 
 }
 
 
 
 if (!GiaInCarrello)
 {
 var dati_prodotto = new Array();
 for (var j in DatiDaRiportareInCarrello ) {
 var campo = DatiDaRiportareInCarrello[j];
 dati_prodotto[campo]=MioListino.RigheListino[p_RigaListino][campo]; 
 }
 
 this.RigheCarrello[this.RigheCarrello.length] = new ArticoloCarrello(Cod, prezzounitario, dati_prodotto, 1);
 
 this.FirstFreeIndex++;
 } 
 
 }
 function AggiungiArticoloAlCarrello(i) 
 { 
 this.Aggiungi(i); 
 this.Rinfresca(); 
 }
 function RimuoviArticoloDalCarrello( i )
 {
 this.RigheCarrello[i].m_Cod = -1;
 this.Rinfresca();
 }
 
 function _vdx(valore) {
 var min = 1, max = 999;
 if (valore < min)
 return min;
 else if (valore>max)
 return max;
 else
 return valore;
 } 
 
 
 function ModificaQuantita(i, el_src, id_quant, id_prezzo, id_prezzo_cons, lostfocus)
 { 
 
 if (lostfocus){
/* if (this.RigheCarrello[i].m_Quant==0) {
 this.RigheCarrello[i].m_Cod = -1;
 this.Rinfresca();
 return false;
 } else
*/
 this.RigheCarrello[i].m_Quant = el_src.value = _vdx(this.RigheCarrello[i].m_Quant); 
 } else {
 if (el_src.id == "+") {
 this.RigheCarrello[i].m_Quant = G_oggetto_window_carrello[id_quant].value = _vdx(++this.RigheCarrello[i].m_Quant);
 } else if (el_src.id == "-") {
 this.RigheCarrello[i].m_Quant = G_oggetto_window_carrello[id_quant].value = _vdx(--this.RigheCarrello[i].m_Quant);
/* if (this.RigheCarrello[i].m_Quant==0) {
 this.RigheCarrello[i].m_Cod = -1;
 this.Rinfresca();
 return false;
 }
*/
 } else {
 var quant = top.parseInt(el_src.value);
 this.RigheCarrello[i].m_Quant = isNaN(quant)?0:quant;
 }
 }
 
 
 this.CalcolaTotali();
 
 
 if (this.RigheCarrello[i].m_DatiProdotto[m_Prezzo].length>0){ 
 G_oggetto_window_carrello[id_prezzo].innerHTML = "<a href=\"javascript:top.PromoProdotto2('" + 
 this.RigheCarrello[i].m_Cod +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Marca]+
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Nome]+
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Descrizione] +
 "','"+ 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] + 
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoCons] +
 "',["+
 this.RigheCarrello[i].m_DatiProdotto[4] +
 "],'/project/promo2.htm','')\">" +
 "<font color=\"#FF9900\">*&nbsp;</font>" + "€&nbsp;" + this.RigheCarrello[i].m_Prezz + "</a>";
 }
 else{
 G_oggetto_window_carrello[id_prezzo].innerHTML = "<a href=\"javascript:top.PromoProdotto2('" + 
 this.RigheCarrello[i].m_Cod +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Marca]+
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Nome] +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Descrizione] +
 "','"+ 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoCons] +
 "',["+
 this.RigheCarrello[i].m_DatiProdotto[4] +
 "],'/project/promo2.htm','')\">" +
 "€&nbsp;" + this.RigheCarrello[i].m_Prezz + "</a>";
 }
 
 
 app = top.document.location.search.slice(1); 
 if ((app=="system") && (top.loggato)){
 
 G_oggetto_window_carrello[id_prezzo_cons].innerHTML = "<a href=\"javascript:top.PromoProdotto2('" + 
 this.RigheCarrello[i].m_Cod +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Marca]+
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Nome]+
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Descrizione] +
 "','"+ 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] + 
 "','"+
 JJ_formatnumber(this.RigheCarrello[i].m_DatiProdotto[m_PrezzoCons]*this.RigheCarrello[i].m_Quant) +
 "',["+
 this.RigheCarrello[i].m_DatiProdotto[4] +
 "],'/project/promo_cons.htm','" +this.RigheCarrello[i].m_Quant+ "')\">" +
 "€&nbsp;" + this.RigheCarrello[i].m_PrezzCons + "</a>";
 /*}
 else{
 G_oggetto_window_carrello[id_prezzo_cons].innerHTML = "<a href=\"javascript:top.PromoProdotto2('" + 
 this.RigheCarrello[i].m_Cod +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Nome] +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_Descrizione] +
 "','"+ 
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] +
 "','"+
 this.RigheCarrello[i].m_DatiProdotto[m_PrezzoCons]*this.RigheCarrello[i].m_Quant +
 "',["+
 this.RigheCarrello[i].m_DatiProdotto[4] +
 "],'/project/promo_cons.htm','" +this.RigheCarrello[i].m_Quant+ "')\">" +
 "€&nbsp;" + JJ_formatnumber(this.RigheCarrello[i].m_PrezzCons);
 }*/
 }
 
 
 
 
 MioSommario.Rinfresca(); 
 return false;
 }
 
 
 function CalcolaTotali()
 {
 var totale = 0;
 var totalecons = 0;
 
 for (i in this.RigheCarrello) 
 if (this.RigheCarrello[i].m_Cod != -1) { 
 
 
 
 /* var prezzototale = this.RigheCarrello[i].m_DatiProdotto[m_PrezzoEuro] * this.RigheCarrello[i].m_Quant; 
 for (k=0;k<this.RigheCarrello[i].m_DatiProdotto[m_Prezzo].length;k=k+2){
 if (this.RigheCarrello[i].m_Quant >= this.RigheCarrello[i].m_DatiProdotto[m_Prezzo][k]){
 var prezzototale = this.RigheCarrello[i].m_DatiProdotto[m_Prezzo][k+1] * this.RigheCarrello[i].m_Quant; 
 } 
 }
 */
 
 prezzototale = top.totaleArticoloCarrello(i);
 prezzototaleCons = top.totaleArticoloCarrelloCons(i);
 
 
 
 this.RigheCarrello[i].m_Prezz = dr_format(prezzototale); 
 this.RigheCarrello[i].m_PrezzCons = dr_format(prezzototaleCons); 
 totale+= prezzototale 
 totalecons+= prezzototaleCons 
 } 
 totale = Math.round(totale*100)/100;
 if (totale<1){this.totale = 0;}
 else{this.totale = totale;}
 
 
 
 var totNuoviArt = 0; 
 for (i=0;i<top.mioCod.length;i++){
 app= Math.round(top.mioPr2[i]*100)/100 
 totNuoviArt = totNuoviArt + (app*top.miaQta[i])
 } 
 
 if (top.mioCod.length!=0){
 totalecons = totalecons+totNuoviArt
 }
 
 totalecons = Math.round(totalecons*100)/100;
 if (totalecons<1){this.totalecons = 0;}
 else{this.totalecons = totalecons;} 
 }
 var G_oggetto_window_carrello = null;
 function GestoreOnloadCarrello(oggetto_window) {
 G_oggetto_window_carrello = oggetto_window;
 DichiaraOggettiCondivisi(G_oggetto_window_carrello.tabella_del_carrello);
 MioCarrello.Rinfresca();
 }
 function GestoreOnUnloadCarrello() {
 AnnullaOggettiCondivisi(G_oggetto_window_carrello.tabella_del_carrello)
 G_oggetto_window_carrello = null;
 }
 
 
 function add_decimal(num){
 num = num.toString();
 if (num.indexOf(".") == -1){
 num = num + ".00"
 }
 if (num.indexOf(".") == (num.length -2)){
 num = num + "0"
 }
 num = num.replace(".",","); 
 return num; 
 }
 
 function JJ_formatnumber(num){ 
 num = num.toString().replace(".",",");
 var s = num.indexOf(",");
 if(s==-1){s=num.length}
 for(var i=s-3;i>0;i-=3){num=num.substr(0,i)+"."+num.substr(i,num.length)}
 return num;
 }
 
 
 function dr_format(num){
 num = num.toString();
 if (num.indexOf(".") == -1){
 num = num + ".00"
 }
 if (num.indexOf(".") == (num.length -2)){
 num = num + "0"
 }
 num = num.toString().replace(".",",");
 var s = num.indexOf(",");
 if(s==-1){s=num.length}
 for(var i=s-3;i>0;i-=3){num=num.substr(0,i)+"."+num.substr(i,num.length)}
 return num;
 }
 
 function AggiornaTotale() 
 {
 
 OC_campo_del_totale.Set( dr_format(MioCarrello.totale));
 OC_campo_del_totale2.Set( MioCarrello.totale);
 OC_campo_del_totale_cons.Set( dr_format(MioCarrello.totalecons));
 }
 function RinfrescaSommario()
 {
 this.AggiornaTotale();
 AttivazioneBottoneSommario();
 } 
 
 var G_oggetto_window_sommario = null;
 function GestoreOnloadSommario(oggetto_window) {
 G_oggetto_window_sommario = oggetto_window;
 DichiaraOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale);
 DichiaraOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale2);
 DichiaraOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale_cons);
 AttivazioneBottoneSommario();
 }
 function GestoreOnUnloadSommario() {
 AnnullaOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale)
 AnnullaOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale2)
 AnnullaOggettiCondivisi(G_oggetto_window_sommario.campo_del_totale_cons)
 G_oggetto_window_sommario = null;
 }
 function AttivazioneBottoneSommario() {
	 if (!G_oggetto_window_sommario) return;
	 AttivaBottone(G_oggetto_window_sommario,"bottone_utilita_1"); 	 
	 if (MioCarrello.totale == 0) {
		 AttivaBottone(G_oggetto_window_sommario,"bottone_ordina", true); 
	 } 
	 else {
		 AttivaBottone(G_oggetto_window_sommario,"bottone_ordina"); 		
	 } 
 }
 
 
 var sottomenu_sel = 0;
 var sottomenu_sel_att = 0;
 
 
 function CaricaFrameListino(oggetto_window, nomefile_listino) { 
 var scatola_attiva = ScatolaAttiva();
 if (!scatola_attiva) return; 
 
 //es. nomefile_listino = "static=showroom/acer
 if (nomefile_listino && nomefile_listino != "") { 
	 if (top.sottomenu_sel==1){
		 var static_page = nomefile_listino.split("=");
		 if (!top.G_online)
		 oggetto_window.frames["listino"].location.replace(top.G_base + nomefile_listino + ".html");
		 else 
			//*****************************************//
			if (static_page[0]=="static") 
			//{				
				//app = static_page[1].split("/")
				//if (app[0]=="showroom"){										
					//menuitem_onclick(top.parametroMenu,app[1])	
				//	oggetto_window.frames["listino"].location.replace(top.G_base + static_page[1] + ".html");				
				//}				
				//else {
					oggetto_window.frames["listino"].location.replace(top.G_base + static_page[1] + ".html");				
			//	}		
			//}	
			//******************************************//
			else 
				if (scatola_attiva.tipo=="Ricerche"){
					top.richiamaCGI("/2?" + nomefile_listino, oggetto_window.frames["listino"] );
				}
				else{ 
					if (scatola_attiva.tipo=="Collegati"){
						top.richiamaCGI("/3?" + nomefile_listino, oggetto_window.frames["listino"] );
					}
					else{						
						top.richiamaCGI("/6?" + nomefile_listino, oggetto_window.frames["listino"] );
					}
				}
	 }
	 else{	 
		if (scatola_attiva.tipo=="Ricerche"){
		 top.richiamaCGI("/2?" + nomefile_listino, oggetto_window.frames["listino"] );
		}
		else{ 
			if (scatola_attiva.tipo=="Collegati"){				
				top.richiamaCGI("/3?" + nomefile_listino, oggetto_window.frames["listino"] );
			}
			else{				
				top.richiamaCGI("/0?rep=" + nomefile_listino, oggetto_window.frames["listino"] );
			}
		}
	 }
 
 }
 else { 
 if (!top.G_online || scatola_attiva.pagina_iniziale_statica)
 oggetto_window.frames["listino"].location.replace(scatola_attiva.NomePaginaIniziale());
 else
 richiamaCGI( "/7?scatola=" + scatola_attiva.tipo, oggetto_window.frames["listino"] );
 
 }
 
 if (scatola_attiva.tipo == "Negozio") {
 	 if (top.sottomenu_sel==1){ 
	 	var static_page = nomefile_listino.split("=");		
		if (static_page[0]=="static") {
			 static_page = static_page[1].split("/");			 
			 oggetto_window.frames["offerte"].location.replace("/project/offerte/showroom_"
			 + static_page[1] + ".html") ;
		}
		else {
		 static_page = static_page[1].split("&");		 
		 oggetto_window.frames["offerte"].location.replace("/project/offerte/showroom_"
		 + static_page[0] + ".html") ;
		} 		
 	}
 	else{
	 	oggetto_window.frames["offerte"].location.replace("/project/offerte/negozio_" + nomefile_listino + ".html") ;
 	}
 }
 else { 
 	if ( scatola_attiva.tipo == "Showroom" ) { 
	 	if (top.sottomenu_sel==1){ 
		 	var static_page = nomefile_listino.split("=");			
			if (static_page[0]=="static") {
		 		static_page = static_page[1].split("/");
		 		oggetto_window.frames["offerte"].location.replace("/project/offerte/showroom_"
		 		+ static_page[1] + ".html") ;
	 		}
 			else {
				static_page = static_page[1].split("&");
			 	oggetto_window.frames["offerte"].location.replace("/project/offerte/showroom_"
				 + static_page[0] + ".html") ;
			 } 
	 	}
	 	else{
		 	oggetto_window.frames["offerte"].location.replace("/project/offerte/negozio_" + nomefile_listino + ".html") ;
	 	}
    } 
 	else { 
		oggetto_window.frames["offerte"].location.replace("/project/offerte/negozio_.html");
 	}
 }
}

var G_oggetto_window_barra_negozio = null;
function GestoreOnloadBarraNegozio(oggetto_window) {
 G_oggetto_window_barra_negozio = oggetto_window;
 AttivazioneBottoniBarraNegozio();
}
function GestoreOnUnloadBarraNegozio() {
 G_oggetto_window_barra_negozio = null;
}
function AttivazioneBottoniBarraNegozio() {
 if (!G_oggetto_window_barra_negozio) return;
 var oggetto_window = G_oggetto_window_barra_negozio;
 var sa = ScatolaAttiva();
 if (!sa) return false;
 if (MioListino && MioListino.RigheListino && MioListino.RigheListino.length>1) {
 AttivaBottone(oggetto_window,"bottone_filtra_prezzo");
 AttivaBottone(oggetto_window,"bottone_prezzi_decrescenti");
 AttivaBottone(oggetto_window,"bottone_prezzi_crescenti");
 if (sa.tipo!="Showroom") {
 AttivaBottone(oggetto_window,"bottone_filtra_marca");
 AttivaBottone(oggetto_window,"bottone_marche_decrescenti");
 AttivaBottone(oggetto_window,"bottone_marche_crescenti");
 } else {
 AttivaBottone(oggetto_window,"bottone_filtra_marca", true);
 AttivaBottone(oggetto_window,"bottone_marche_decrescenti", true);
 AttivaBottone(oggetto_window,"bottone_marche_crescenti", true);
 }
 } else {
 AttivaBottone(oggetto_window,"bottone_filtra_prezzo", true);
 AttivaBottone(oggetto_window,"bottone_prezzi_decrescenti", true);
 AttivaBottone(oggetto_window,"bottone_prezzi_crescenti", true);
 AttivaBottone(oggetto_window,"bottone_filtra_marca", true);
 AttivaBottone(oggetto_window,"bottone_marche_decrescenti", true);
 AttivaBottone(oggetto_window,"bottone_marche_crescenti", true);
 }
}
 
 
loggato = false;
function EseguiListaInizializzazioni() { 
 for (var v in this.lista) {
 eval(this.lista[v])
 }
}
function CreaListaAssegnamenti(identificatori, valori) { 
 this.lista = new Array();
 for (v in identificatori) {
 var delim = identificatori[v][1];
 this.lista[v] = identificatori[v][0]+ "=" + delim + valori[v] + delim;
 }
}
function Init(lista_inizializzaioni) {
 this.lista = lista_inizializzaioni;
 this.Esegui = EseguiListaInizializzazioni;
 this.CreaListaAssegnamenti = CreaListaAssegnamenti;
}

function Carica() { 
 var reload = true;
 if (G_scatola_attiva!=null) {
 loc_presente = G_scatola_attiva.frames[this.frame]; 
 reload = false;
 
 if (this.filename != loc_presente.filename) 
 reload = true;
 
 if (this.numerostati != loc_presente.numerostati) 
 reload = true;
 for (i in this.stati) {
 if ( this.stati[i] != loc_presente.stati[i] ) 
 reload = true;
 if ( this.stati[i] != eval(i) ) {
 this.stati[i] = eval(i); 
 reload = true;
 }
 }
 
 if (!reload) {
 for (i in this.parametri) {
 if ( this.parametri[i] != loc_presente.parametri[i] ) {
 reload = true;
 break;
 }
 }
 }
 }
 if ( reload ) {
 Pila[Pila.length-1].frames[this.frame] = this;
 frames["paginamultiframe"].frames[this.frame].location.replace(this.URL());
 }
}

var URL_globale;
function Ricarica(filename) {

 var reload = false;

 reload = true;

 for (i in this.stati) {
 	if ( this.stati[i] != eval(i) ) {
		 this.stati[i] = eval(i);
	 	reload = true;
	 }
 }

 var n = Ricarica.arguments.length-1;
 if (this.parametri.length != n ) {
 reload = true;
 this.parametri = new Array(n);
 }
 for (var i=1,j=0; j<n; i++,j++) {
 if ( this.parametri[j] != Ricarica.arguments[i] ) {
 this.parametri[j] = Ricarica.arguments[i];
 reload = true;
 }
 }

 if (Ricarica.arguments[Ricarica.arguments.length-1]=="sessione=")
 this.aggiungi_sessione = true;
 else
 this.aggiungi_sessione = false;

 if ( reload ) {

 	this.InizPreRicarica();

	 if (top.ScatolaAttiva().tipo!="PaginePersonali"){
	 	URL_globale = this.URL();
		frames["paginamultiframe"].frames[this.frame].location.replace(this.URL());
	 }
	 else{
		var url = filename
		var separatore = "?";
		for (i in this.parametri) {
			 url += separatore + this.parametri[i];
			 separatore = "&";
		}
		if (this.aggiungi_sessione)
			 url += sessione+ ++numSessione + "&data=" + Date() + "&cu=" + G_codiceUtente;

		URL_globale = url
	 	frames["paginamultiframe"].frames[this.frame].location.replace("/project/vuota_personali.htm");
	 }

 }
}

function URL() {
 var url = G_base + this.filename;
 var separatore = "?";
 for (i in this.parametri) {
 url += separatore + this.parametri[i];
 separatore = "&";
 }
 if (this.aggiungi_sessione)
 url += sessione+ ++numSessione + "&data=" + Date();
 return url;
}

function Loc(frame, filename, dipendenze) { 
 this.frame = frame;
 this.filename = filename;
 this.stati = [];
 this.numerostati = 0;
 for (var i in dipendenze) {
 this.stati[dipendenze[i]] = eval(dipendenze[i]);
 this.numerostati++;
 }
 this.parametri = [];
 for (var i=3,j=0; i<Loc.arguments.length; i++)
 this.parametri[j++] = Loc.arguments[i];
 if (Loc.arguments[Loc.arguments.length-1]=="sessione=")
 this.aggiungi_sessione = true;
 else
 this.aggiungi_sessione = false;
 this.inizializzazioni_pre_ricarica = new Init([]);
 this.InizPreRicarica = new Function("this.inizializzazioni_pre_ricarica.Esegui()");
 this.carica = Carica;
 this.Ricarica = Ricarica;
 this.aggiungi_sessione = false;
 this.URL = URL;
}
function CaricaFrameFisso() { 
 frames["paginamultiframe"].frames[this.frame].location.replace(this.URL()); 
}
function LocFissa(frame, filename) {
 this.b = Loc;
 this.b(frame,filename);
 this.carica = CaricaFrameFisso;
}
var NavBar = false;
var scatole_sempre_presenti = new Array();
scatole_sempre_presenti["Negozio"] = "new top.Negozio('x0','')";
scatole_sempre_presenti["Showroom"] = "new top.Showroom('x0x0','static=showroom/acer')";
var scatola_pagine_personali_se_presente = "new top.PaginePersonali('x0x0','/personali/paginepersonali_home.htm')";
function InizializzaNavBar() {
 NavBar = new Array();
 if (G_nomeutente){
 scatole_sempre_presenti["PaginePersonali"] = scatola_pagine_personali_se_presente;
 
 } else {
 if (scatole_sempre_presenti["PaginePersonali"])
 delete scatole_sempre_presenti["PaginePersonali"];
 
 
 }
 
 for (var s in scatole_sempre_presenti) NavBar[s] = eval(scatole_sempre_presenti[s]).nome;
}
function AggiungiInNavBar(scatola) {
 var is_array = false;
 for (var x in NavBar[scatola.tipo]) {
 is_array = true;
 break;
 }
 if (!is_array)
 NavBar[scatola.tipo] = new Array();
 if (NavBar[scatola.tipo][scatola.titolo])
 delete NavBar[scatola.tipo][scatola.titolo];
 NavBar[scatola.tipo][scatola.titolo]=Clona(scatola);
}
function SceltaScatolaDaNavBar(scatola) {
 NascondiPupozzi();
 CambiaScatola(Clona(scatola));
}
var Pila = new Array();
var frames_fissi_caricati = false; 
var G_scatola_attiva = null;
function ScatolaAttiva() {
 return G_scatola_attiva;
}
function CaricaScatola(scatola) {
 scatola.Inizializza();
 if (!frames_fissi_caricati) {
 frames_fissi_caricati = true;
 for (var i in scatola.frames_fissi) {
 scatola.frames_fissi[i].carica();
 }
 }
 for (var i in scatola.frames) {
 scatola.frames[i].carica();
 }
 
 scatola.ImpostaTipScatola();
 
 scatola.VisualizzaTitoloScatola();
 
 scatola.AggiornaTornaaX();
 
 G_scatola_attiva = scatola;
 
 
 
 if ((top.sottomenu_sel==1)&&(top.ScatolaAttiva().tipo!="PaginePersonali")&&(top.ScatolaAttiva().tipo!="Collegati")&&(top.ScatolaAttiva().tipo!="")){
 top.frames['paginamultiframe'].frames['menu'].document.location.replace('/project/menu/menu_I_m.htm')
 }
 if (G_scatola_attiva.tipo=="Ricerche"){
 top.G_id_voce = "x0"
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_prodotti.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="65,1,125,15" href="javascript:carica(\'menu_I_m.htm\')">'+
 '</map>'
 top.frames['paginamultiframe'].frames['menu'].document.location.href = "menu/menu_I_p.htm"
 }
 if (G_scatola_attiva.tipo=="PaginePersonali"){
 top.frames["paginamultiframe"].colonna_sx.rows = "50,0,*,120"
 }
}
function Rinfresca() {
 CaricaScatola(G_scatola_attiva);
}
function RinfrescaFrames() {
 scatola = G_scatola_attiva;
 if (RinfrescaFrames.arguments.length>0) 
 for (var i=0; i < RinfrescaFrames.arguments.length; i++) 
 scatola.frames[RinfrescaFrames.arguments[i]].carica();
 else
 for (var i in scatola.frames) 
 scatola.frames[i].carica(); 
}
function CambiaScatola(scatola) { 
 if (!NavBar) InizializzaNavBar();
 if (G_scatola_attiva!=null && G_scatola_attiva.tipo!="Inizio") { 
 G_scatola_attiva.SalvaAmbiente();
 AggiungiInNavBar(G_scatola_attiva); 
 scatola.scatola_precedente = Pila.length-1; 
 G_scatola_attiva.scatola_successiva = Pila.length;
 }
 Pila[Pila.length] = scatola;
 scatola.scatola_successiva = -1;
 CaricaScatola(scatola);
 
}
function TornaAllaScatolaPrima() { 
 if (G_scatola_attiva.scatola_precedente!=-1) { 
 var scatolaprima = Pila[G_scatola_attiva.scatola_precedente];
 
 
 
 if (scatolaprima.tipo == "Negozio"){
 top.frames["paginamultiframe"].colonna_sx.rows = "50,20,*,120"
 
 if (top.sottomenu_sel_att==1){
 top.sottomenu_sel = 1 
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_marche.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="5,1,65,15" href="javascript:carica(\'menu_I_p.htm\')"> '+
 '</map>' 
 }
 else{
 top.sottomenu_sel = 0 
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_prodotti.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="65,1,125,15" href="javascript:carica(\'menu_I_m.htm\')">'+
 '</map>'
 } 
 }
 else{
 if (scatolaprima.tipo == "Ricerche"){
 top.sottomenu_sel = 0
 top.sottomenu_sel_att = 0 
 top.frames['paginamultiframe'].frames['menu_new'].document.getElementById('imm').innerHTML = '<img usemap="#bottoni" src="/propria/menu_prodotti.gif" width="190" height="16" border="0">'+ 
 '<map name="bottoni">'+
 '<area shape="rect" coords="65,1,125,15" href="javascript:carica(\'menu_I_m.htm\')">'+
 '</map>' 
 }
 else{
 if (scatolaprima.tipo == "Azienda"){top.frames["paginamultiframe"].colonna_sx.rows = "0,0,*,120"}
 else{top.frames["paginamultiframe"].colonna_sx.rows = "50,0,*,120"}
 }
 }
 
 /*elemento selezionato nella barra in alto
 var menu = top.menu_fissi + top.voci_menu.length;
 if (scatolaprima.tipo == "Negozio"){mm='m0';top.voce_menu_sel=mm}
 else{
 if (scatolaprima.tipo == "Showroom"){mm='m1';top.voce_menu_sel=mm}
 else{
 if (scatolaprima.tipo == "PaginePersonali"){mm='m2';top.voce_menu_sel=mm}
 else{
 if (scatolaprima.tipo == "Documentazione"){mm='m3';top.voce_menu_sel=mm}
 else{
 if (scatolaprima.tipo == "Azienda"){mm='m4';top.voce_menu_sel=mm}
 else{mm = 'm' + scatolaprima.m;top.voce_menu_sel=mm}
 }
 } 
 }
 }*/ 
 
 /*colorazione elementi nella barra in alto 
 for (i=0;i<menu;i++){ 
 if (("m"+i)==mm){
 top.frames["paginamultiframe"].frames["menubar"].document.getElementById("m"+i).style.background = top.barra_lk_sfondo_click
 top.frames["paginamultiframe"].frames["menubar"].document.getElementById("t"+i).style.color = top.barra_lk_click
 }
 else{
 top.frames["paginamultiframe"].frames["menubar"].document.getElementById("m"+i).style.background = top.barra_lk_sfondo
 top.frames["paginamultiframe"].frames["menubar"].document.getElementById("t"+i).style.color = top.barra_lk 
 }
 }*/ 
 
 
 
 
 CaricaScatola(scatolaprima);
 Pila.length--;
 
 }
}
function AggiornaFrame() {
 var n = AggiornaFrame.arguments.length;
 if (n%2==1) 
 n=(n-1)/2;
 else
 n/=2;
 for (var i = 0; i < n; i++) {
 loc = AggiornaFrame.arguments[i*2+1];
 loc.carica();
 }
}
function SalvaAmbiente() { 
 var ambiente_salvato = new Array();
 for (v in this.ambiente_da_salvare) {
 ambiente_salvato[v] = eval(this.ambiente_da_salvare[v][0]);
 }
 
 this.inizializzazioni.CreaListaAssegnamenti(this.ambiente_da_salvare, ambiente_salvato);
}
function ImpostaTipScatola() { 
 if (this.tip)
 SetDefaultTip(this.tip.innerHTML);
}
function AggiornaTornaaX() { 
 var htmlstring = "";
 if (this.scatola_precedente!=-1) { 
 var scatola_precedente = Pila[this.scatola_precedente]; 
 htmlstring = "<A href=\"javascript:top.TornaAllaScatolaPrima()\"><FONT color=" + top.barra_scritte2 + ">Torna a " +
 scatola_precedente.titolo + "</FONT></A>";
 } else {
 
 
 }
 G_torna_a_X.Set(htmlstring);
}
function VisualizzaTitoloScatola() { 
 if (this.tipo.toLowerCase()!="inizio"){
 G_titolo_scatola.Set( "<div align=left valign=bottom><img src=/propria/tema/log_"+this.tipo.toLowerCase()+".gif width=21 height=18 align=absmiddle>&nbsp;<font color='" +top.barra_scritte+ "'>"+ this.nome + ": " + this.titolo + "</font></div>");
 }
 
}
function CambiaTitoloScatola(oggetto_window) { 
 var titolo_pagina_main; 
 
 
 if (oggetto_window.nome_pagina)
 titolo_pagina_main = oggetto_window.nome_pagina;
 else 
 titolo_pagina_main = oggetto_window.document.title; 
 
 
 //if ((top.sottomenu_sel==0)||(top.ScatolaAttiva().tipo=="PaginePersonali")||(top.ScatolaAttiva().tipo=="Collegati")){
 if ((top.parametroReparto!="")||(top.ScatolaAttiva().tipo=="PaginePersonali")||(top.ScatolaAttiva().tipo=="Collegati")||(top.ScatolaAttiva().tipo=="Ricerche")){
 this.titolo = titolo_pagina_main;
 this.VisualizzaTitoloScatola();
 }
 else{ 
 this.titolo = oggetto_window.tabella_listino[0][1];
 this.VisualizzaTitoloScatola();
 }
 
}
function DefaultMenuItemOnClick(id,parametro) {

 G_id_voce = id; 
 var html_link = parametro.split(".");
 var static_page = parametro.split("="); 
 
 if (html_link.length != 0 && (html_link[html_link.length-1].toLowerCase()=="html" || html_link[html_link.length-1].toLowerCase()=="htm") ){
 	this.frames["main"].Ricarica(parametro);
 }
 else {
 	if (static_page.length == 2 && static_page[0]=="static") {
 		this.frames["main"].Ricarica(static_page[1] + ".html");
	}
	else {
	 this.frames["main"].Ricarica("cgi-bin/col"+this.parametroCGI,parametro,"sessione=");
	}
 }
}
 
function NomePaginaIniziale() { 
 return "paginainiziale_" + this.tipo.toLowerCase() + ".html";
}
function Scatola() {
 this.tipo = "Inizio";
 this.nome = "Inizio";
 this.titolo = "";
 this.frames_fissi = [];
 this.frames_fissi["logo"] = new LocFissa("logo","/project/logo.htm");
 this.frames_fissi["banner"] = new LocFissa("banner","/project/banner_vuoto.htm");
 this.frames_fissi["help"] = new LocFissa("help","/project/help.htm");
 this.frames_fissi["ricerca"] = new LocFissa("ricerca","/project/ricerca.htm");
 this.frames_fissi["title"] = new LocFissa("title","/project/barra_navigazione.htm");
 
 
 this.frames_fissi["menu_new"] = new LocFissa("menu_new","/project/menu/menu_new.htm");
 this.frames = [];
 app = top.document.location.search.slice(1);
 if (app=="system"){
 my_src="/project/loginsystem.htm" 
 }
 else{
 my_src="/propria/login.htm"
 }
 
 this.frames["login"] = new Loc("login",my_src);
 this.frames["menu"] = new Loc("menu","/project/nomeframe.htm");
 this.frames["main"] = new Loc("main","/project/nomeframe.htm");
 
 
 
 this.inizializzazioni = new Init([]);
 this.Inizializza = new Function("this.inizializzazioni.Esegui()");
 this.ambiente_da_salvare = []; 
 this.SalvaAmbiente = SalvaAmbiente;
 this.scatola_precedente = -1; 
 this.scatola_successiva = -1; 
 this.CambiaTitoloScatola = CambiaTitoloScatola;
 this.VisualizzaTitoloScatola = VisualizzaTitoloScatola;
 this.AggiornaTornaaX = AggiornaTornaaX;
 this.ImpostaTipScatola = ImpostaTipScatola;
 this.vocemenu_onclick = DefaultMenuItemOnClick;
 this.NomePaginaIniziale = NomePaginaIniziale;
}
function GestoreBodyOnload(oggetto_window) {
 
 var sa = ScatolaAttiva();
 if (sa)
 sa.CambiaTitoloScatola(oggetto_window);
}
function SchedaProdotto() {
 this.b = Scatola; this.b();
 this.tipo = "Scheda Prodotto";
 this.nome = "Scheda Prodotto";
 this.tip = tipscatola_SchedaProdotto;
}
SchedaProdotto.prototype = new Scatola;
function RicaricaLocNegozio(file_listino) {
 this.Ricarica(this.filename,file_listino);
}
function LocNegozio(file_listino) {
 this.b = Loc;
 this.b("main","/project/negozio.htm",
 [ 
 "G_nomeutente"
 ,"G_ArtSelezionato"
 ,"G_ordinamento_attivo"
 ,"G_filtramarca","G_filtraprezzomin","G_filtraprezzomax"
 ]
 ,file_listino);
 this.RicaricaLocNegozio = RicaricaLocNegozio;
 
 this.inizializzazioni_pre_ricarica = new Init([
 "G_ordinamento_attivo = \"\"", 
 "G_ArtSelezionato = -1", 
 "G_filtramarca = \"\"",
 "G_filtraprezzomin = \"\"",
 "G_filtraprezzomax = \"\"",
 "G_filtramarca_selectedindex = 0",
 "G_filtraprezzomin_selectedindex = 0",
 "G_filtraprezzomax_selectedindex = 0"
 ]);
}
 G_id_voce = "";
function CambiaListino(id_voce, file_listino) {
 
 G_id_voce = id_voce;
 var scatola_attiva = ScatolaAttiva();
 
 if ((scatola_attiva.tipo != "Negozio") && (scatola_attiva.tipo != "Showroom") && (scatola_attiva.tipo != "Ricerche")) {
 alert("CambiaListino: errore di tipo, è richiesta una scatola negozio o showroom");
 return;
 }
 scatola_attiva.RicaricaListino(file_listino);
}
function Negozio(vocemenu, url_listino, prodotto)
 {
 this.b = Scatola;
 this.b();
 this.tipo = "Negozio";
 this.nome = "Negozio"; 

 this.frames["menu"] = new Loc("menu","/project/menu/menu_I_p.htm",["G_id_voce"],vocemenu);
  
 this.frames["main"] = new LocNegozio(url_listino,prodotto);
 this.parametroCGI = "/0?rep=";
 
 
 
 this.RicaricaListino = new Function("file_listino","this.frames[\"main\"].RicaricaLocNegozio(file_listino)");
 if ( !prodotto )
 G_prodotto = -1;
 else
 G_prodotto = prodotto;
 this.inizializzazioni = new Init([
 "G_ArtSelezionato = -1",
 "G_id_voce = \"\"",
 "G_URL_scheda_caricata = \"\"",
 "G_ordinamento_attivo = \"\"",
 "G_filtramarca = \"\"",
 "G_filtraprezzomin = \"\"",
 "G_filtraprezzomax = \"\"",
 "G_filtramarca_selectedindex = 0",
 "G_filtraprezzomin_selectedindex = 0",
 "G_filtraprezzomax_selectedindex = 0"
 ]);
 this.ambiente_da_salvare = [
 ["G_ArtSelezionato",""],
 ["G_RigaSelezionata",""],
 ["G_ordinamento_attivo","\""],
 ["G_id_voce","\""],
 ["G_filtramarca","\""],
 ["G_filtraprezzomin","\""],
 ["G_filtraprezzomax","\""],
 ["G_filtramarca_selectedindex",""],
 ["G_filtraprezzomin_selectedindex",""],
 ["G_filtraprezzomax_selectedindex",""]
 ];
 if (ie)
 this.tip = tipscatola_Negozio;
 else
 this.tip = top.document.getElementById("tipscatola_Negozio");
 this.vocemenu_onclick = CambiaListino;
}
Negozio.prototype = new Scatola;
function Showroom(vocemenu, url_listino, prodotto) {
 this.b = Negozio; this.b(vocemenu, url_listino, prodotto);
 this.tipo = "Showroom";
 this.nome = "Showroom";
 this.frames["menu"] = new Loc("menu","/project/menu/menu_I_m.htm",["G_id_voce"],vocemenu);
 this.parametroCGI = "/6?";
 if (ie)
 this.tip = tipscatola_ShowRoom;
 else
 this.tip = top.document.getElementById("tipscatola_ShowRoom");
 this.pagina_iniziale_statica = true;
}
function CambiaListinoRicerche(id_voce, file_listino) {
 
 G_id_voce = id_voce;
 
 
 
 CambiaScatola(new Negozio(id_voce, file_listino));
}
function Ricerche(stringa_da_cercare) {
 this.b = Negozio; this.b("x0", stringa_da_cercare);
 this.tipo = "Ricerche";
 this.nome = "Ricerche";
 this.parametroCGI = "/2?";
 this.tip = tipscatola_Ricerche;
 this.vocemenu_onclick = CambiaListinoRicerche;
}
function Collegati(codice_prodotto) {
 this.b = Negozio; this.b("x0", codice_prodotto);
 this.tipo = "Collegati";
 this.nome = "Collegati";
 this.parametroCGI = "/3?";
 this.tip = tipscatola_Ricerche;
 this.vocemenu_onclick = CambiaListinoRicerche;
}
function Documentazione(vocemenu, pagina) {
 this.b = Scatola; this.b();
 this.tipo = "Documentazione";
 this.nome = "Guida al sito";
 
 
 this.frames["menu"] = new Loc("menu","/project/menu/menu_documentazione.htm",["G_id_voce"],vocemenu);
 this.frames["main"] = new Loc("main", (!pagina||pagina=="")?this.NomePaginaIniziale():pagina, []);
 
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.tip = tipscatola_Documentazione;
}
function PaginePersonali(vocemenu, pagina) {
 if (!G_nomeutente){
 alert("Scatola PP -> utente non loggato");
 }
 this.b = Scatola; this.b();
 this.tipo = "PaginePersonali";
 this.nome = "Pagine Personali di " + G_nomeutente;
 this.frames["menu"] = new Loc("menu","/project/menu/menu_pagine_personali.htm",["G_id_voce"],vocemenu); 
 this.frames["main"] = new Loc("main", (!pagina||pagina=="")?this.NomePaginaIniziale():pagina, []);
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.parametroCGI = "/8";
 this.tip = tipscatola_PaginePersonali;
}
function Azienda(vocemenu, pagina, m) {
 this.b = Scatola; this.b();
 this.tipo = "Azienda";
 this.nome = "Informazioni";
 this.m = m
 
 this.frames["menu"] = new Loc("menu","/project/menu/menu_azienda.htm",["G_id_voce"],vocemenu);
 this.frames["main"] = new Loc("main", (!pagina||pagina=="")?this.NomePaginaIniziale():pagina, []);
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.parametroCGI = "/11111"; 
 this.tip = tipscatola_Azienda;
}
function Opzioni_Ricerca(vocemenu, pagina) {
 this.b = Scatola; this.b();
 this.tipo = "Opzioni_Ricerca";
 this.nome = "Opzioni di Ricerca";
 
 
 this.frames["menu"] = new Loc("menu","/project/menu/menu_opzioni_ricerca.htm",["G_id_voce"],vocemenu);
 
 
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.tip = tipscatola_Opzioni_Ricerca;
}
function NuovaScatola(vocemenu, pagina, m) {
 this.b = Scatola; this.b();
 this.tipo = "NuovaScatola";
 this.nome = "Sei in";
 this.m = m
 
 this.frames["menu"] = new Loc("menu","/project/menu/menu_nuova_scatola.htm",["G_id_voce"],vocemenu);
 this.frames["main"] = new Loc("main", (!pagina||pagina=="")?this.NomePaginaIniziale():pagina, []);
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.parametroCGI = "/33333"; 
 this.tip = tipscatola_NuovaScatola;
}
/*
function PagineSetup(vocemenu, pagina) {
 if (!G_nomeutente){
 alert("Scatola PP -> utente non loggato");
 }
 this.b = Scatola; this.b();
 this.tipo = "setup";
 this.nome = "Setup del sito";
 this.frames["menu"] = new Loc("menu","/project/menu/menu_pagine_setup.htm",["G_id_voce"],vocemenu);
 this.frames["main"] = new Loc("main", (!pagina||pagina=="")?this.NomePaginaIniziale():pagina, []);
 this.inizializzazioni = new Init([
 "G_id_voce = \"\""
 ]);
 this.ambiente_da_salvare = [
 ["G_id_voce","\""]
 ];
 this.CGI = "impostazioni";
 this.parametroCGI = "/1";
 this.tip = tipscatola_setup;
}
*/
/*
function InformazioniScatolaAttiva() {
 return "Scatola attuale: " + Pila[Pila.length-1].tipo +
 " - Lunghezza della pila:" + Pila.length;
}
function InformazioniLoc(loc) {
 res = " - Parametri: ";
 for (i in loc.parametri)
 res = res + i + " = " + loc.parametri[i] + "; ";
 return res;
}
function ScriviStato() {
 pippo = loggato?"loggato":"non loggato";
 return "Stato = " + pippo;
}
*/
