function newLang(lingua_){
	
	SVopenWin_web('include_App/varie/switch_lingua_manuale.asp?lingua='+lingua_,420,300,false,false);
	
	
	
}

function inserisci_prod(){
var stamp = ""
var stamp2 = ""
	for(j=0;j<5;j++){
		//alert(document.getElementById("giocattoli_"+j))
		if(document.getElementById("giocattoli_"+j)){
							
			//document.getElementById("testo_lib_"+(j+1)).innerHTML = ""
			
			var contletto = document.getElementById("giocattoli_"+j).innerHTML
			
			contletto = contletto.toUpperCase()
			
			start_tit = contletto.indexOf("<TITOLO>")
			end_tit = contletto.indexOf("</TITOLO>")
			titolo = contletto.substring(start_tit+8,end_tit)
			
			if(titolo.length > 26){
				
				titolo = titolo.substr(0,26)+".."
				
				
			}
			
			//document.getElementById("lib_tit"+(j+1)).innerHTML = titolo
/*
			start_aut = contletto.indexOf("<AUTORE>")
			end_aut = contletto.indexOf("</AUTORE>")
			autore = contletto.substring(start_aut+8,end_aut)
			
			if(autore.length > 28){
			
				autore = autore.substr(0,28)+".."
			
			
			}
			
			document.getElementById("lib_aut"+(j+1)).innerHTML = autore*/

			start_edi = contletto.indexOf("<EDITOR>")
			end_edi = contletto.indexOf("</EDITOR>")
			editore = contletto.substring(start_edi+8,end_edi)
			
			//document.getElementById("lib_ced"+(j+1)).innerHTML = editore

			start_pre= contletto.indexOf("<PREZZO>")
			end_pre = contletto.indexOf("</PREZZO>")
			prezzo = contletto.substring(start_pre+8,end_pre)
						
			start_bpre = contletto.indexOf("<BARREDPRICE>")
			end_bpre = contletto.indexOf("</BARREDPRICE>")
			bprezzo = contletto.substring(start_bpre+13,end_bpre)
			
			if(bprezzo == ""){
				
				var prezzilist = '&euro; '+prezzo
				
			}else{
				
				var prezzilist = '<font style="text-decoration:line-through;">&euro; '+bprezzo+'</font> -  &euro; '+prezzo
			}
						
			//document.getElementById("lib_pre"+(j+1)).innerHTML = prezzilist
			
			start_imgm = contletto.indexOf("<IMG_M>")
			end_imgm = contletto.indexOf("</IMG_M>")
			imgm = contletto.substring(start_imgm+7,end_imgm)
			
			var toy = "toy"+(j+1)
						
			//document.getElementById("hidlib"+(j+1)).innerHTML = "giocattoli_"+j
			
			//document.getElementById("img_lib_"+(j+1)).innerHTML = '<img alt="." id="piclib'+(j+1)+'" title="'+imgm+'" src="prodotti/giocattoli/M/'+imgm+'.jpg"/>'
			
			stamp += '<div class="offerta"><div onclick="dettagliprod(\''+toy+'\')" class="lente"></div><div class="titleprod">'+titolo+'</div><div class="marcaprod">'+editore+'</div><div class="prezzoprod">'+prezzilist+'</div><div class="imgprod"><img id="pictoy'+(j+1)+'" title="'+imgm+'" src="prodotti/giocattoli/m/'+imgm+'.jpg" alt="." /></div></div>'
			
			
			
		}
		
		document.getElementById("cont_prod_static_toy").innerHTML = stamp+"<div class='clear'></div>"
	
	}
	
	for(h=0;h<5;h++){
		
		if(document.getElementById("regalo_"+h)){
			//alert()
			//document.getElementById("testo_lib_"+(j+1)).innerHTML = ""
			
			var contletto = document.getElementById("regalo_"+h).innerHTML
			
			contletto = contletto.toUpperCase()
			
			start_tit = contletto.indexOf("<TITOLO>")
			end_tit = contletto.indexOf("</TITOLO>")
			titolo = contletto.substring(start_tit+8,end_tit)
			
			if(titolo.length > 26){
				
				titolo = titolo.substr(0,26)+".."
				
				
			}
			
			//document.getElementById("edi_tit"+(h+1)).innerHTML = titolo
/*
			start_aut = contletto.indexOf("<AUTORE>")
			end_aut = contletto.indexOf("</AUTORE>")
			autore = contletto.substring(start_aut+8,end_aut)
			
			if(autore.length > 28){
			
				autore = autore.substr(0,28)+".."
			
			
			}
			
			document.getElementById("edi_aut"+(h+1)).innerHTML = autore*/

			start_edi = contletto.indexOf("<EDITOR>")
			end_edi = contletto.indexOf("</EDITOR>")
			editore = contletto.substring(start_edi+8,end_edi)
			
			//document.getElementById("edi_ced"+(h+1)).innerHTML = editore

			start_pre= contletto.indexOf("<PREZZO>")
			end_pre = contletto.indexOf("</PREZZO>")
			prezzo = contletto.substring(start_pre+8,end_pre)
						
			start_bpre = contletto.indexOf("<BARREDPRICE>")
			end_bpre = contletto.indexOf("</BARREDPRICE>")
			bprezzo = contletto.substring(start_bpre+13,end_bpre)
			
			if(bprezzo == ""){
				
				var prezzilist = '&euro; '+prezzo
				
			}else{
				
				var prezzilist = '<font>&euro; '+bprezzo+'</font> -  &euro; '+prezzo
			}
			
			
			//document.getElementById("edi_pre"+(h+1)).innerHTML = prezzilist
			
			start_imgm = contletto.indexOf("<IMG_M>")
			end_imgm = contletto.indexOf("</IMG_M>")
			imgm = contletto.substring(start_imgm+7,end_imgm)		
			
			var gift = "gift"+(h+1)
			
			//document.getElementById("hidedi"+(h+1)).innerHTML = "regalo_"+h
			
			//document.getElementById("img_edi_"+(h+1)).innerHTML = '<img id="picedi'+(h+1)+'" title="'+imgm+'" src="prodotti/regalo/M/'+imgm+'.jpg"/>'
			
			stamp2 += '<div class="offerta"><div onclick="dettagliprod(\''+gift+'\')" class="lente"></div><div class="titleprod">'+titolo+'</div><div class="marcaprod">'+editore+'</div><div class="prezzoprod">'+prezzilist+'</div><div class="imgprod"><img id="picgift'+(h+1)+'" title="'+imgm+'" src="prodotti/regalo/M/'+imgm+'.jpg" alt="." /></div></div>'
			
			
				
		}
		
		document.getElementById("cont_prod_static_gift").innerHTML = stamp2+"<div class='clear'></div>"
	}
		
}


function dettagliprod(type){
	
	var identifier = ""
	var pass = false
	
	if(type.indexOf("toy")>-1){
		

			identifier = document.getElementById("pic"+type).title
			
			identifier = identifier.toLowerCase()
			
			identifier = identifier.replace("_m","")
			
			url = "prodotti/giocattoli/"+identifier+"/PAGINA.html"
			
			pass = true
		
		
		
	}else{
		
			identifier = document.getElementById("pic"+type).title
			
			identifier = identifier.toLowerCase()
			
			identifier = identifier.replace("_m","")
			
			url = "prodotti/regalo/"+identifier+"/PAGINA.html"
			
			pass = true

		
	}
	
	
	if(pass){
		
		SVopenWin_web('include_App/administrator/popupbook.asp?url='+url,650,600,false,true);
		
		
	}
	
}

function elenco_compl(tipoprod){
	
	SVopenWin_web('include_App/administrator/elencobook.asp?tipo='+tipoprod,500,300,false,true);
		
}

function eventi(){
	
	SVopenWin_web('include_App/administrator/elencoeventi.asp',500,500,false,true);	
	
}

var toptencycle
var randomchartpos = 1
var ferr = false	
var fade10 = 0
var fade20 = 0



function chartfill(){
	
	if(randomchartpos >10){randomchartpos = 1}
	
	var contletto = document.getElementById("poschart"+randomchartpos).innerHTML
	
	var start_tit = contletto.toUpperCase().indexOf("<TITOLO>")
	var end_tit = contletto.toUpperCase().indexOf("</TITOLO>")
	var titolo = contletto.toUpperCase().substring(start_tit+8,end_tit)
	
	if(titolo.length >=30){titolo = titolo.substr(0,27);titolo=titolo+"..."}
	
	var start_aut = contletto.toUpperCase().indexOf("<AUTORE>")
	var end_aut = contletto.toUpperCase().indexOf("</AUTORE>")
	var autore = contletto.toUpperCase().substring(start_aut+8,end_aut)
	
	var start_imgm = contletto.toUpperCase().indexOf("<IMG_M>")
	var end_imgm = contletto.toUpperCase().indexOf("</IMG_M>")
	var imgm = contletto.toUpperCase().substring(start_imgm+7,end_imgm)	
	
	document.getElementById("numeroimg").className = 'numero'+randomchartpos 
	document.getElementById("prodimgchart").src = 'VS_CLASSIFICA/IMG/'+imgm+'.jpg'
	document.getElementById("testonumero").innerHTML = '<h3>'+titolo+'</h3><h4>'+autore.toLowerCase()+'</h4>'
	
	randomchartpos++
	chartswitch()
	
	
	
	
	
	

}

function chartswitch(){
if(ferr){
		
	//alert(fade1)
	fade10-=0.05
	fade20-=5
	//alert(fade1+"//////"+fade2)

	document.getElementById("numeroimg").style.opacity = fade10;
	document.getElementById("numeroimg").style.filter="alpha(opacity="+fade20+")";
	
	document.getElementById("imgprodchart").style.opacity = fade10;
	document.getElementById("imgprodchart").style.filter="alpha(opacity="+fade20+")";
	
	document.getElementById("testonumero").style.opacity = fade10;
	document.getElementById("testonumero").style.filter="alpha(opacity="+fade20+")";

	if(fade20 >= 1){
		window.clearTimeout(ga)
		window.clearTimeout(hf)
		var hf = window.setTimeout("chartswitch()",60)
			
	}else{
			
			
			ferr = false;
			fade10 = 0;
			fade20=0;
			
			chartfill();
			window.clearTimeout(hf)
	}

}else if(!ferr){	
	
	fade10+=0.05
	fade20+=5
	
	
	document.getElementById("numeroimg").style.opacity = fade10;
	document.getElementById("numeroimg").style.filter="alpha(opacity="+fade20+")";
	
	document.getElementById("imgprodchart").style.opacity = fade10;
	document.getElementById("imgprodchart").style.filter="alpha(opacity="+fade20+")";
	
	document.getElementById("testonumero").style.opacity = fade10;
	document.getElementById("testonumero").style.filter="alpha(opacity="+fade20+")";
	
	if(fade20 < 100){ 
		window.clearTimeout(ga)
		window.clearTimeout(hf)
		var hf = window.setTimeout("chartswitch()",60)
		
	}else{
		window.clearTimeout(hf)
		document.getElementById("numeroimg").style.opacity = "";
		document.getElementById("numeroimg").style.filter = "";
		
		document.getElementById("imgprodchart").style.opacity = "";
		document.getElementById("imgprodchart").style.filter = "";
		
		document.getElementById("testonumero").style.opacity = ""
		document.getElementById("testonumero").style.filter = "";
		ferr=true;
		fade10=1;
		fade20=100;
		var ga = window.setTimeout("chartswitch()",3500);
		
	}
	
}
			
		
}








var randomlibhistory 
var randomlibhistory2
var idnow
var randomprodlib

function closebook(id){

	idnow = id
	
	if(id.indexOf("lib")>-1){
		
		idbislib = id.replace("lib","")
		
		if(id.indexOf("1")>-1){
			id_altroprodLib = document.getElementById("hidlib2").innerHTML
			id_altroprodLib = id_altroprodLib.replace("giocattoli_","")

		}else{
			id_altroprodLib = document.getElementById("hidlib1").innerHTML
			id_altroprodLib = id_altroprodLib.replace("giocattoli_","")

		}
		
		if(!document.getElementById("hid"+(id))){return false}
		
		randomlibhistory = 	document.getElementById("hid"+(id)).innerHTML
		
		randomlibhistory = randomlibhistory.replace("giocattoli_","")
			
		randomprodlib = Math.floor(Math.random()*ntotlib)
		
		if(randomprodlib != randomlibhistory && randomprodlib != id_altroprodLib){
				
			fadebook(randomprodlib,id)
				
		}else{
			if(!document.getElementById("hidlib3")){return false}
			closebook(id)
				
		}
		
	}
	
	
	if(id.indexOf("edi")>-1){
				
		idbisedi = id.replace("edi","")
		
		if(id.indexOf("1")>-1){
			id_altroprodEdi = document.getElementById("hidedi2").innerHTML
			id_altroprodEdi = id_altroprodEdi.replace("regalo_","")
		
		}else{
			id_altroprodEdi = document.getElementById("hidedi1").innerHTML
			id_altroprodEdi = id_altroprodEdi.replace("regalo_","")
		
		}
		
		if(!document.getElementById("hid"+(id))){return false}
		
		randomedihistory = 	document.getElementById("hid"+(id)).innerHTML
		
		randomedihistory = randomedihistory.replace("regalo_","")
		
		//alert(randomlibhistory)
			
		randomprodedi = Math.floor(Math.random()*ntotedi)
		
		if(randomprodedi != randomedihistory && randomprodedi != id_altroprodEdi){
				
			fadebook(randomprodedi,id)
				
		}else{
			if(!document.getElementById("hidedi3")){return false}
			alert(id)
			closebook(id)
			
				
		}	
		
	}
	
	
	
	
}


var toptencycle
var randomchartpos = 1
var ferrr = true
var fade100 = 1
var fade200 = 100


function fadebook(str,id){
		
	if(id == "lib1"){id2 = "lib_1"}
	if(id == "lib2"){id2 = "lib_2"}
	if(id == "edi1"){id2 = "edi_1"}
	if(id == "edi2"){id2 = "edi_2"}
	
	
if(ferrr){
		
	fade100-=0.05
	fade200-=5

	//document.getElementById("div"+id).style.opacity = fade100;
	//document.getElementById("div"+id).style.filter="alpha(opacity="+fade200+")";
	//document.getElementById("chiudi"+id).style.opacity = fade100;
	//document.getElementById("chiudi"+id).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("div_img_"+id2).style.opacity = fade100;
	document.getElementById("div_img_"+id2).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("testo_"+id2).style.opacity = fade100;
	document.getElementById("testo_"+id2).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("booklink"+id).style.opacity = fade100;
	document.getElementById("booklink"+id).style.filter="alpha(opacity="+fade200+")";

	if(fade200 >= 1){
		//alert(fade200)
		window.clearTimeout(hh)
		var hh = window.setTimeout("fadebook('"+str+"','"+id+"')",45)
			
	}else{
			
			
			ferrr = false;
			
			fade100 = 0;
			fade200=0;
			
			chartfillpagina(str,id);
			window.clearTimeout(hh)
	}

}else if(!ferrr){	
	
	fade100+=0.05
	fade200+=5
	
	//document.getElementById("div"+id).style.opacity = fade100;
	//-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=50)";
	//document.getElementById("div"+id).style.filter="alpha(opacity="+fade200+")";
	//document.getElementById("chiudi"+id).style.opacity = fade100;
	//document.getElementById("chiudi"+id).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("div_img_"+id2).style.opacity = fade100;
	document.getElementById("div_img_"+id2).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("testo_"+id2).style.opacity = fade100;
	document.getElementById("testo_"+id2).style.filter="alpha(opacity="+fade200+")";
	document.getElementById("booklink"+id).style.opacity = fade100;
	document.getElementById("booklink"+id).style.filter="alpha(opacity="+fade200+")";
	
	
	if(fade200 <= 100){ 

		window.clearTimeout(hh)

		var hh = window.setTimeout("fadebook('"+str+"','"+id+"')",45)

		
	}else{
		ferrr=true;
		fade100=1;
		fade200=100;
		window.clearTimeout(hh)
		//document.getElementById("div"+id).style.opacity = "";
		//document.getElementById("div"+id).style.filter="";
		//document.getElementById("chiudi"+id).style.opacity = "";
		//document.getElementById("chiudi"+id).style.filter = "";
		document.getElementById("div_img_"+id2).style.opacity = "";
		document.getElementById("div_img_"+id2).style.filter = "";
		document.getElementById("testo_"+id2).style.opacity = "";
		document.getElementById("testo_"+id2).style.filter = "";
		document.getElementById("booklink"+id).style.opacity  = "";
		document.getElementById("booklink"+id).style.filter = "";

		
	}
	
}
			
		
}


function chartfillpagina(str,id){
	
	if(id.indexOf("lib")>-1){
		
		var h = id.replace("lib","")
		
		//alert("giocattoli_"+str)
		
		var contletto = document.getElementById("giocattoli_"+(str)).innerHTML
		
		//alert(contletto)
		
		contletto = contletto.toUpperCase()
				
		start_tit = contletto.indexOf("<TITOLO>")
		end_tit = contletto.indexOf("</TITOLO>")
		titolo = contletto.substring(start_tit+8,end_tit)
		
		
		if(titolo.length > 26){
			
			titolo = titolo.substr(0,26)+".."
			
			
		}
		
		document.getElementById("lib_tit"+(h)).innerHTML = titolo
	
		start_aut = contletto.indexOf("<AUTORE>")
		end_aut = contletto.indexOf("</AUTORE>")
		autore = contletto.substring(start_aut+8,end_aut)
		
		if(autore.length > 28){
			
			autore = autore.substr(0,28)+".."
			
			
		}
		
		document.getElementById("lib_aut"+(h)).innerHTML = autore
	
		start_edi = contletto.indexOf("<EDITOR>")
		end_edi = contletto.indexOf("</EDITOR>")
		editore = contletto.substring(start_edi+8,end_edi)
		
		document.getElementById("lib_ced"+(h)).innerHTML = editore
	
		start_pre= contletto.indexOf("<PREZZO>")
		end_pre = contletto.indexOf("</PREZZO>")
		prezzo = contletto.substring(start_pre+8,end_pre)
					
		start_bpre = contletto.indexOf("<BARREDPRICE>")
		end_bpre = contletto.indexOf("</BARREDPRICE>")
		bprezzo = contletto.substring(start_bpre+13,end_bpre)
		
		if(bprezzo == ""){
				
			var prezzilist = '&euro; '+prezzo
			
		}else{
			
			var prezzilist = '<font>&euro; '+bprezzo+'</font> -  &euro; '+prezzo
		}
		
		document.getElementById("lib_pre"+(h)).innerHTML = prezzilist
		
		start_imgm = contletto.indexOf("<IMG_M>")
		end_imgm = contletto.indexOf("</IMG_M>")
		imgm = contletto.substring(start_imgm+7,end_imgm)	
		
		document.getElementById("hidlib"+(h)).innerHTML = "giocattoli_"+(str)
		
		document.getElementById("img_lib_"+(h)).innerHTML = '<img id="piclib'+(h)+'" title="'+imgm+'" src="prodotti/giocattoli/M/'+imgm+'.jpg"/>'
		
		fadebook(str,id)
	
	}else{
		
		var h = id.replace("edi","")
		
		var contletto = document.getElementById("regalo_"+str).innerHTML
		
		contletto = contletto.toUpperCase()
				
		start_tit = contletto.indexOf("<TITOLO>")
		end_tit = contletto.indexOf("</TITOLO>")
		titolo = contletto.substring(start_tit+8,end_tit)
		
		if(titolo.length > 26){
			
			titolo = titolo.substr(0,26)+".."
			
			
		}
		
		document.getElementById("edi_tit"+(h)).innerHTML = titolo
	
		start_aut = contletto.indexOf("<AUTORE>")
		end_aut = contletto.indexOf("</AUTORE>")
		autore = contletto.substring(start_aut+8,end_aut)
		
		if(autore.length > 28){
			
			autore = autore.substr(0,28)+".."
			
			
		}
		
		document.getElementById("edi_aut"+(h)).innerHTML = autore
	
		start_edi = contletto.indexOf("<EDITOR>")
		end_edi = contletto.indexOf("</EDITOR>")
		editore = contletto.substring(start_edi+8,end_edi)
		
		document.getElementById("edi_ced"+(h)).innerHTML = editore
	
		start_pre= contletto.indexOf("<PREZZO>")
		end_pre = contletto.indexOf("</PREZZO>")
		prezzo = contletto.substring(start_pre+8,end_pre)
					
		start_bpre = contletto.indexOf("<BARREDPRICE>")
		end_bpre = contletto.indexOf("</BARREDPRICE>")
		bprezzo = contletto.substring(start_bpre+13,end_bpre)
		
		document.getElementById("edi_pre"+(h)).innerHTML = '<font>&euro; '+bprezzo+'</font> -  &euro; '+prezzo
		
		start_imgm = contletto.indexOf("<IMG_M>")
		end_imgm = contletto.indexOf("</IMG_M>")
		imgm = contletto.substring(start_imgm+7,end_imgm)		
	
		document.getElementById("hidedi"+(h)).innerHTML = "regalo_"+(str)
		
		document.getElementById("img_edi_"+(h)).innerHTML = '<img id="picedi'+(h)+'" title="'+imgm+'" src="prodotti/regalo/M/'+imgm+'.jpg"/>'
		
		fadebook(str,id)
		
		
	}
	
	
	
	/*document.getElementById("numeroimg").className = 'numero'+randomchartpos 
	document.getElementById("prodimgchart").src = 'VS_CLASSIFICA/IMG/'+imgm+'.jpg'
	document.getElementById("testonumero").innerHTML = '<h3>'+titolo+'</h3><h4>'+autore.toLowerCase()+'</h4>'*/
	
	//randomchartpos++

	
	
	
	
	
	
	

}

function notyet(){
	
	var error_str = "<h4>Siamo spiacenti, ma il servizio da Lei richiesto non &egrave; ancora attivo: per ricevere novit&agrave; o notifiche riguardo questo nuovo servizio, La preghiamo di iscriverSi al nostro servizio di newsletter in basso.<br/><br/>Le ricordiamo inoltre, che il servizio permetter&aacute; a qualsiasi utente del sito, previa iscrizione, di ordinare qualsiasi libro direttamente online, verificandone disponibilit&aacute; e prezzo autonomamente. Il libro verr&aacute; consegnato alla nostra libreria e potr&aacute; scegliere di ricevere un SMS di notifica direttamente sul Suo cellulare.<br/><br/>Libreria Cazzaniga</h4>"
	SVopenWin_web('include_App/varie/error_str.asp?erro='+error_str,320,350,false,true);
	
	
	
	
}

function colorButton(){
	
	var loc = window.location.href
	//alert(loc)
		if(loc.indexOf('Home20100304201321')>-1){
					
			document.getElementById("arg-1").style.background='url(include_img/botmenu_selected.png) no-repeat'		
			
		}else if(loc.indexOf('20100406165817')>-1){
			
			document.getElementById("arg-2").style.background='url(include_img/botmenu_selected.png) no-repeat'
			
		}else if(loc.indexOf('info')>-1){
			
			document.getElementById("xxx-info").style.background='url(include_img/botmenu_selected.png) no-repeat'
			
		}else if(loc.indexOf('url')<0){
			
			document.getElementById("arg-1").style.background='url(include_img/botmenu_selected.png) no-repeat'
			
		}else{ 
			
			document.getElementById("xxx-55").style.background='url(include_img/botmenu_selected.png) no-repeat'
			
		}
	
}

function checkhover(id){
	///alert(id)
	//alert(document.getElementById(id).style.background)
	if(document.getElementById(id).style.background == 'url(include_img/botmenu_selected.png) no-repeat' || document.getElementById(id).style.background == 'url(http://www.arcolibri.it/include_img/botmenu_selected.png) no-repeat' ){
		
		document.getElementById(id).style.background ='url(include_img/botmenu_selected_hover.png) no-repeat';
		
	}
	
}

function checkout(id){
	
	if(document.getElementById(id).style.background == 'url(include_img/botmenu_selected_hover.png) no-repeat' || document.getElementById(id).style.background == 'url(http://www.arcolibri.it/include_img/botmenu_selected_hover.png) no-repeat'){
		
		document.getElementById(id).style.background ='url(include_img/botmenu_selected.png) no-repeat';
		
	}
}
