var stileHelp = "top=200, left=500, width=200, height=200, status=no, menubar=no, toolbar=no scrollbar=no"; function Help(apri) { window.open(apri, "", stileHelp); } function submitenter(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { trackLogin(); myfield.form.submit(); return false; } else return true; } function chiudi(){ window.close(); } function openCenterWin(url, name, scrollbar, w, h) { var left = parseInt(screen.availWidth/2) - (w/2); var top = parseInt(screen.availHeight/2) - (h/2); popupWin = window.open(url, name, 'resizable=1,scrollbars=' + scrollbar + ',left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top + ',width=' + w + ',height=' + h + ''); // focus window (only for Navigator >= 3.0) if ( (navigator.appName != "Microsoft Internet Explorer") && (navigator.appVersion.substring(0,1) == "3") ) popupWin.focus(); } function openWin(url, name, scrollbar, w, h) { popupWin = window.open(url, name, 'resizable=1,scrollbars=' + scrollbar + ',width=' + w + ',height=' + h + ''); // focus window (only for Navigator >= 3.0) if ( (navigator.appName != "Microsoft Internet Explorer") && (navigator.appVersion.substring(0,1) == "3") ) popupWin.focus(); } function MM_openBrWindow (theURL, winName, features) { window.open(theURL, winName, features); } function MM_openBrWindow_f (theURL, winName, features) { popup=window.open(theURL, winName, features); popup.focus(); } function apri_popup_allegati (theUrl) { MM_openBrWindow(theUrl,'allegati','scrollbars=yes,left=50,top=20,width=700,height=500'); } //v1.0 //Copyright 2006 Adobe Systems, Inc. All rights reserved. function AC_AddExtension(src, ext) { if (src.indexOf(ext) == -1) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext+'?'); else return src + ext; } else return src; } function AC_Generateobj(objAttrs, params, embedAttrs, nowrite) { var str = ' '; str += ''; res += objid+'_DoFSCommand(command, args);'; res += ''; return res; } function AC_SW_RunContent(){ var ret = AC_GetArgs ( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000" , null ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_GetArgs(args, ext, srcParamName, classid, mimeType){ var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i=0; i < args.length; i=i+2){ var currArg = args[i].toLowerCase(); switch (currArg){ case "classid": break; case "pluginspage": case "swliveconnect": case "name": ret.embedAttrs[args[i]] = args[i+1]; break; case "src": case "movie": args[i+1] = AC_AddExtension(args[i+1], ext); ret.embedAttrs["src"] = args[i+1]; ret.params[srcParamName] = args[i+1]; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": case "codebase": case "id": ret.objAttrs[args[i]] = args[i+1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; } } ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret; } function changecrc(nmform,crc){ nmform.crc.value = crc; if (crc == '100' || crc == '112' || crc == '151' || crc == '140') { nmform.action ="/libri/ricerca"; } else if (crc == '400') { nmform.action ="/idee/ricerca"; } else if (crc == '300') { nmform.action ="/dvd/ricerca"; } else if (crc == '200') { nmform.action ="/cd/ricerca"; } else if (crc == '600') { nmform.action ="/books/ricerca"; } else if (crc == 'ENG') { nmform.action ="/books/ricerca"; } else if (crc == '700') { nmform.action ="/games/ricerca"; } else if (crc == '800') { nmform.action ="/download/ricerca"; } else if (crc == '880') { nmform.action ="/ebook-inglesi/ricerca"; } else if (crc == '881') { nmform.action ="/ebook-italiani/ricerca"; } var eds = nmform.eds.value; var pzf = nmform.pzf.value; var pzs = nmform.pzs.value; var scf = nmform.scf.value; var scs = nmform.scs.value; reset(nmform); nmform.eds.value = eds; nmform.pzf.value= pzf; nmform.pzs.value = pzs; nmform.scf.value = scf; nmform.scs.value = scs; } function termine(nmform,termine) { nmform.g.value = termine; Search(nmform); } function campagna(nmform,campagna) { nmform.cam.value = campagna; if (campagna != '') nmform.tpr.value = 50; else if (nmform.tpr.value == 50) nmform.tpr.value = 10; Search(nmform); } function gruppo(nmform,gruppo) { nmform.gr.value = gruppo; if (gruppo != '') nmform.tpr.value = 100; else { if (nmform.tpr.value == 100) nmform.tpr.value = 10; document.search.g.value = document.search.g_gr.value; } Search(nmform); } function changetipoRicerca(nmform,tpric){ if (tpric == 40) { confirmed = validateEAN(nmform.g.value); if (!confirmed) return; reset(nmform); } nmform.tpr.value = tpric; Search(nmform); } function changetipoRicerca_grp(nmform,tpric){ if (document.search_grp.g.value == ''){ return;} if (tpric == 40) { confirmed = validateEAN(document.search_grp.g.value); if (!confirmed) return; var gr = document.search.gr.value; reset(nmform); document.search.gr.value = gr; } nmform.tpr.value = tpric; Search_grp(); } function numpagina(nmform,npagina) { //nmform.noCache.value = 'N'; nmform.bln.value = npagina; nmform.submit(); } function numrighe(nmform,nrighe){ //nmform.noCache.value = 'N'; nmform.bld.value = nrighe; nmform.submit(); } function ordina(nmform,pos){ //nmform.noCache.value = 'N'; nmform.sort.value = pos; nmform.submit(); } function crc(nmform,crc,sezione){ //nmform.noCache.value = 'S'; nmform.crc.value = crc; if (sezione != null) nmform.action ="/"+sezione+"/ricerca"; nmform.ta.value = ''; nmform.submit(); } function prezzo(nmform,prz){ //nmform.noCache.value = 'S'; nmform.pzf.value = prz; if (prz!='') { nmform.ta.value = 7; } nmform.submit(); } function sottoprezzo(nmform,pzf,pzs){ //nmform.noCache.value = 'S'; nmform.pzf.value = pzf; nmform.pzs.value = pzs; if (pzs!='') { nmform.ta.value = 8; } nmform.submit(); } function sconto(nmform,scf){ //nmform.noCache.value = 'S'; nmform.scf.value = scf; if (scf!='') { nmform.ta.value = 9; } nmform.submit(); } function sottosconto(nmform,scf, scs){ //nmform.noCache.value = 'S'; nmform.scf.value = scf; nmform.scs.value = scs; if (scs!='') { nmform.ta.value = 10; } nmform.submit(); } function autore(nmform,aut){ //nmform.noCache.value = 'S'; nmform.aut.value = aut; if (aut!='') { nmform.ta.value = 4; } nmform.submit(); } function collana(nmform,col,nofiltro,descCol){ //nmform.noCache.value = 'S'; nmform.col.value = col; nmform.desCol.value = descCol; if (nofiltro =='1') { nmform.tpr.value = 90; nmform.g.value = ''; } else { if (col!='') { nmform.ta.value = 6; } } nmform.submit(); } function lingua(nmform,lan,desLan,nofiltro){ //nmform.noCache.value = 'S'; nmform.lan.value = lan; nmform.desLan.value = desLan; if (nofiltro =='1') { nmform.tpr.value = 180; nmform.g.value = ''; } else { if (lan!='') { nmform.ta.value = 15; } } nmform.submit(); } function editore(nmform,edt){ //nmform.noCache.value = 'S'; nmform.edt.value = edt; if (edt!='') { nmform.ta.value = 5; } nmform.submit(); } function genere(nmform,cdgen,desGen,idsez){ //nmform.noCache.value = 'S'; if (nmform.crc.value == 'ENG' && nmform.tpr.value == '40') { nmform.g.value = ''; nmform.tpr.value = 10; } nmform.gen.value = cdgen; if (desGen == null) { desGen = ''; } nmform.desGen.value = desGen; if (idsez == null) { idsez = ''; } nmform.idsez.value = idsez; nmform.sgn.value = ''; nmform.desSgn.value = ''; nmform.idchild.value = ''; if (cdgen!='') { nmform.ta.value = 2; } nmform.submit(); } function sottogenere(nmform,sgn,desSgn,idchild){ //nmform.noCache.value = 'S'; nmform.sgn.value = sgn; nmform.desSgn.value = desSgn; if (idchild == null) { idchild = ''; } nmform.idchild.value = idchild; if (sgn!='') { nmform.ta.value = 3; } nmform.submit(); } function generesottogenere(nmform,gen,desGen,sgn,desSgn){ //nmform.noCache.value = 'S'; nmform.gen.value = gen; nmform.desGen.value = desGen; nmform.sgn.value = sgn; nmform.desSgn.value = desSgn; if (sgn!='') { nmform.ta.value = 3; } nmform.submit(); } function affini(nmform,cod){ //nmform.noCache.value = 'S'; nmform.g.value = cod; nmform.ta.value = 12; Search(nmform); } function esatta(nmform,chkd){ //nmform.noCache.value = 'S'; if (chkd) { nmform.swe.value = "S"; } else { nmform.swe.value = ""; } Search(nmform); } function fuoricatalogo(nmform,chkd){ //nmform.noCache.value = 'S'; if (chkd) { nmform.swf.value = "S"; } else { nmform.swf.value = ""; } nmform.submit(); } function reset(nmform) { // //nmform.noCache.value = ''; nmform.tpr.value = 10; nmform.bln.value = ""; nmform.bld.value = ""; nmform.gen.value = ""; nmform.sgn.value = ""; nmform.desGen.value = ""; nmform.desSgn.value = ""; nmform.eds.value = ""; nmform.edt.value = ""; nmform.aut.value = ""; nmform.pzf.value = ""; nmform.pzs.value = ""; nmform.scf.value = ""; nmform.scs.value = ""; nmform.swe.value = ""; nmform.swf.value = ""; nmform.sort.value = ""; nmform.idsez.value = ""; nmform.idchild.value = ""; nmform.cam.value = ""; nmform.gr.value = ""; nmform.per.value = ""; nmform.tper.value = ""; nmform.dsper.value = ""; nmform.col.value = ""; nmform.lan.value = ""; nmform.ta.value = ""; } function reset_search(nmform) { //nmform.noCache.value = 'S'; if (jQuery.trim(nmform.g.value) == '') { thickBoxAlert('specificare almeno un termine di ricerca'); } else { reset(nmform); if (nmform.crc.value == '000') { if (jQuery.trim(nmform.g.value) != '') { Search_area(nmform); } } else Search(nmform); } } function IsNumeric(sText) { var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } function Search_area(nmform) { if (isValidEan(jQuery.trim(nmform.g.value))) { document.location = "/app/bol/web/ricerca/elenco?tpr=10&g="+nmform.g.value; } else { jQuery.ajax({ type: "POST", url: "/app/bol/web/ricerca/aggrega_area", data: "g="+safeEscape(nmform.g.value)+"&tpr=10", success: function(html) { jQuery("#dropdownRicercaInner").html(html); if (!jQuery('#dropdownRicerca').is(':visible')) jQuery('#dropdownRicerca').slideToggle("100"); } }); } } function safeEscape(to_escape) { to_escape = to_escape.replace(/\&/g, escape("&")); to_escape = to_escape.replace(/";"/g, escape(";")); to_escape = to_escape.replace(/"?"/g, escape("?")); to_escape = to_escape.replace(/"="/g, escape("=")); to_escape = to_escape.replace(/\+/g, "%2B"); return to_escape; } jQuery(document).ready(function(){ jQuery('#dropdownRicerca').click(function() { jQuery('#dropdownRicerca').fadeOut("150"); }); }); function Search(nmform){ try { if (nmform.tpr.value == 70 || nmform.tpr.value == 100) nmform.tpr.value = 10; } catch(e) {} var confirmed = true; if (nmform.crc.value == 'ENG') { confirmed = validateENG(nmform.g.value); } if (nmform.tpr.value == 40 && nmform.g.value != '') { confirmed = validateEAN(nmform.g.value); } if (confirmed) { var crcToWord; if (nmform.crc.value == '100' || nmform.crc.value == '112' || nmform.crc.value == '151' || nmform.crc.value == '140') { crcToWord = "libri"; } else if (nmform.crc.value == '400') { crcToWord = "idee"; } else if (nmform.crc.value == '300') { crcToWord = "dvd"; } else if (nmform.crc.value == '200') { crcToWord = "cd"; } else if (nmform.crc.value == '600') { crcToWord = "books"; } else if (nmform.crc.value == '700') { crcToWord = "games"; } else if (nmform.crc.value == '800') { crcToWord = "download"; } else if (nmform.crc.value == '880') { crcToWord = "ebook-inglesi"; } else if (nmform.crc.value == '881') { crcToWord = "ebook-italiani"; } var tprToWord; if (nmform.tpr.value == '10') { tprToWord = "Tutti i campi"; } else if (nmform.tpr.value == '20') { tprToWord = "Titolo"; } else if (nmform.tpr.value == '30') { tprToWord = "Regista"; } else if (nmform.tpr.value == '40') { tprToWord = "EAN"; } trackSearch(crcToWord, nmform.g.value, tprToWord); nmform.submit(); } } function cambiaCategoriaGruppo(nmform,crc) { nmform.crc.value = crc; if (crc == '100' || crc == '112' || crc == '151' || crc == '140') { nmform.action ="/libri/ricerca"; } else if (crc == '400') { nmform.action ="/idee/ricerca"; } else if (crc == '300') { nmform.action ="/dvd/ricerca"; } else if (crc == '200') { nmform.action ="/cd/ricerca"; } else if (crc == '600') { nmform.action ="/books/ricerca"; } else if (crc == 'ENG') { nmform.action ="/books/ricerca"; } else if (crc == '700') { nmform.action ="/games/ricerca"; } else if (crc == '800') { nmform.action ="/download/ricerca"; } else if (crc == '880') { nmform.action ="/ebook-inglesi/ricerca"; } else if (crc == '881') { nmform.action ="/ebook-italiani/ricerca"; } var eds = nmform.eds.value; nmform.eds.value = eds; document.search.tpr.value = 100; if (document.search_grp.g.value != '' && document.search_grp.g.value != null) { if (document.search.tpr.value != 20 && document.search.tpr.value != 30 && document.search.tpr.value != 40) { document.search.tpr.value = 10; document.search.g_gr.value = document.search_grp.g.value; } } nmform.submit(); } function Search_grp(nmform) { document.search.g_gr.value = document.search_grp.g.value; if (document.search.tpr.value != 20 && document.search.tpr.value != 30 && document.search.tpr.value != 40) document.search.tpr.value = 10; Search(document.search); } function Search_gen(nmform) { document.search.ricxgen.value = "true"; document.search.g_gr.value = jQuery("#search_gen").val(); if (document.search.tpr.value != 20 && document.search.tpr.value != 30 && document.search.tpr.value != 40) { document.search.tpr.value = 10; } Search(document.search); } function Search_grp_select(nmform) { var tipoRicerca = jQuery("#select_ricerca").val(); changetipoRicerca_grp(nmform, tipoRicerca); } function validate() { if (nmform.g.value == '') { return window.confirm("Non č stato indicato alcun termine, la ricerca verrā impostata a tutti i campi."); } return true; } function validateENG(nmform) { if (nmform.g.value == '' && nmform.tpr.value != 10) { return window.confirm("Non č stato indicato alcun termine, la ricerca verrā impostata a tutti i campi."); } return true; } function isValidEan(ean) { if (ean == null || ean.length > 15) { return false; } ean = ean.replace(/-/g,""); if (ean.length > 13 || ean.length < 12) { return false; } if (!IsNumeric(ean)) { return false; } return true; } function validateEAN(ean) { ean = ean.trim(); var valid = isValidEan(ean); if (!valid) thickBoxAlert('Il codice EAN da ricercare non č valido.
Esempi di EAN validi: 9-788876-701153 oppure 9788876701153'); return valid; } function apriPopupCover(link,width,height) { if (width==null) width=400; if (height==null) height=600; window.open(link,"popcover","scrollbars=no,top=200,left=200,width="+width+",height="+height); return false; } function apriPopup(link) { window.open(link,"popprint","scrollbars=no"); return false; } function truncate(text,length){ var truncText = text; if (truncText) { if (truncText.length > length) { truncText = truncText.substring(0, length); truncText = truncText.replace(/\w+$/, '');//rimuove l'ultima parola eventualmente troncata truncText += '...<\/a>'; text.innerHTML = truncText; } } return truncText; }//[f] truncate function cut(text,length){ var truncText = text; if (truncText) { if (truncText.length > length) { truncText = truncText.substring(0, (length-3>0)?length-3:0); //truncText = truncText.replace(/\w+$/, '');//rimuove l'ultima parola eventualmente troncata truncText += '...'; } } return truncText; }//[f] cut function limit(text, length) { var truncText = text; if (truncText) { if (truncText.length > length) { truncText = truncText.substring(0, length); truncText = truncText.replace(/\w+$/, '');//rimuove l'ultima parola eventualmente troncata text.innerHTML = truncText; } } return truncText; }//[f] limit //lettura di un cookie function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } //Costanti cookie navigatori var COOKIE_NAVIGATORI_NAME = 'cstn'; var COOKIE_NAVIGATORI_DEFAULTVALUE = '1111111111001100000011001101110110000'; var COOKIE_NAVIGATORI_DOMAIN = '.bol.it'; var COOKIE_NAVIGATORI_EXPIRES = parseInt('30'); var COOKIE_NAVIGATORI_PATH ='/'; var COOKIE_JSESSIONID = 'JSESSIONID'; setDefaultCookieStatoNavigatori(); /** * imposta lo stato di default per i cookie dei navigatori */ function setDefaultCookieStatoNavigatori(){ var cookieValue = jQuery.cookie(COOKIE_NAVIGATORI_NAME); if (cookieValue == null) { jQuery.cookie(COOKIE_NAVIGATORI_NAME, COOKIE_NAVIGATORI_DEFAULTVALUE, {domain: COOKIE_NAVIGATORI_DOMAIN, expires: COOKIE_NAVIGATORI_EXPIRES, path: COOKIE_NAVIGATORI_PATH }); } }//[f]setDefaultCookieStatoNavigatori /** * cambia il valore del cookie per i navigatori * flagCookie = posizione del flag indicatore di stato nel cookie * val = nuovo valore 0 oppure 1 */ function changeCookieStatoNavigatori(flagCookie, val) { if (flagCookie != null) { var cookieValue = jQuery.cookie(COOKIE_NAVIGATORI_NAME); var newCookieValue = cookieValue.substr(0, flagCookie)+ val +cookieValue.substr(flagCookie+1); jQuery.cookie(COOKIE_NAVIGATORI_NAME, newCookieValue, {domain: COOKIE_NAVIGATORI_DOMAIN, expires: COOKIE_NAVIGATORI_EXPIRES, path: COOKIE_NAVIGATORI_PATH }); } }//[f]changeCookieStatoNavigatori /** * Controllo per aprire e chiudere i box * idControl = id del tag ancora usato per aprire e chiudere * flagCookie = posizione del flag indicatore di stato nel cookie */ function openCloseHome(idControl, flagCookie) { jQuery("#"+idControl).click(function(){ var imgSrc = jQuery(this).children("img:first").attr("src"); if (imgSrc=='/bol/images/ico_piu.gif'){ imgSrc = '/bol/images/ico_meno.gif' changeCookieStatoNavigatori(flagCookie, 1); }else{ imgSrc = '/bol/images/ico_piu.gif'; changeCookieStatoNavigatori(flagCookie, 0); } jQuery(this).children("img:first").attr("src",imgSrc); jQuery(this).parent().nextAll(".collapsable").toggleClass("hide"); }); }//[f]openClose function openClose(idControl, flagCookie) { jQuery("#"+idControl).click(function(){ var imgSrc = jQuery(this).children("img:first").attr("src"); if (imgSrc=='/bol/images/ico_piu.gif'){ imgSrc = '/bol/images/ico_meno.gif' changeCookieStatoNavigatori(flagCookie, 1); }else{ imgSrc = '/bol/images/ico_piu.gif'; changeCookieStatoNavigatori(flagCookie, 0); } jQuery(this).children("img:first").attr("src",imgSrc); jQuery(this).parent().next(".collapsable:first").toggleClass("hide"); }); }//[f]openClose function openClosePromozione(idControl, pulsante) { if(jQuery("#"+idControl).hasClass("hide")) { jQuery("#"+idControl).removeClass("hide"); pulsante.attr("class","bol_top_promozioni"); } else { jQuery("#"+idControl).addClass("hide"); pulsante.attr("class","bol_top_promozioni_open"); } } function scrollPane(paneId,durata,offset){ jQuery('#'+paneId+'Up').click(function(){ jQuery('#'+paneId).stop().scrollTo( '-='+offset+'px',durata ); }); jQuery('#'+paneId+'Down').click(function(){ jQuery('#'+paneId).stop().scrollTo( '+='+offset+'px',durata ); }); } function toggleGenere( idGenere){ jQuery("#paneGeneri #"+idGenere+" ul").removeClass("hide"); jQuery("#paneGeneri #"+idGenere).addClass("bol_active"); jQuery("#paneGeneri #"+idGenere).html(""+jQuery("#paneGeneri #"+idGenere+" a").html()+""+ ""); jQuery("#paneGeneri #Gen > li:not(#paneGeneri #"+idGenere+")").remove(); } function toggleSottoGenere(idGenere, idChild){ jQuery("#paneGeneri #"+idGenere+" ul").removeClass("hide"); jQuery("#paneGeneri #Gen > li:not(#paneGeneri #"+idGenere+")").remove(); jQuery("#paneGeneri #"+idGenere+" li:not(:eq("+idChild+"))").remove(); jQuery("#paneGeneri #"+idGenere+" li:eq(0)").addClass("bol_active"); jQuery("#paneGeneri #"+idGenere+" li").html(""+jQuery("#paneGeneri #"+idGenere+" li a").html()+""); } function scrollHPane(paneId,durata,offset){ jQuery('#'+paneId+'Left').click(function(){ jQuery('#'+paneId).stop().scrollTo( '-='+offset+'px',durata, {axis:'x'} ); }); jQuery('#'+paneId+'Right').click(function(){ jQuery('#'+paneId).stop().scrollTo( '+='+offset+'px',durata, {axis:'x'} ); }); } jQuery(document).ready(function() { jQuery(".bol_path b").each(function (i) {jQuery(this).text(cut(jQuery(this).text(),100));}); }); jQuery(document).ready(function() { jQuery('#linkCarrello').click(function(){dropDownCarrello(false);}); }); jQuery(document).ready(function() { jQuery('#linkCarrello_close').click(function(){rollUpCarrello();}); }); function dropDownCarrello(flash) { var drop = jQuery('#dropdownCarrello'); var timestamp = (new Date()).getTime(); jQuery('#dropdownInnerCarrello').load("/bol/nose/servizi/carrello/carrelloLeggiDropDown.jsp?ts="+timestamp, {now: timestamp}, function() { var ultimo = jQuery("#ultimoAggiuntoCarrello"); if (drop.is(':visible')) { if (flash) { if (ultimo != null) { ultimo.effect("highlight", {}, 1500); } } } else { jQuery('#dropdownCarrello').slideToggle("100", function() { if (flash) { if (ultimo != null) { ultimo.effect("highlight", {}, 1500); } } }); } }); } function refreshCarrello() { jQuery.ajax({ url: "/app/bol/carrello/carrello/refresh", success: function(){ jQuery.ajax({url: "/bol/nose/servizi/carrello/numeroRigheCarrello.jsp", data: "now=", complete: function(res, status){ if ( status == "success" || status =="notmodified" ) { jQuery(".numeroElementiCarrello").html(jQuery.trim(res.responseText)); } } }); } }); } function initSearchBar(sezione){ jQuery("form[name='search']").attr("autocomplete", "off"); jQuery("form[name='search'] input, form[name='search'] select").attr("autocomplete", "off"); if (sezione!=null && sezione!='null' && sezione!='' && sezione != 'home'){ jQuery("form[name='search'] input[name='g']").autocomplete("/"+sezione+"/precompila", { parse: parse, formatItem: formatItem, formatResult: formatResult, width: 731, scrollHeight: 303, selectFirst: false, minChars: 4, matchSubset: false, cacheLength: 1, delay: 1000, columnsSeparator: columnsSeparator, rowsSeparator: rowsSeparator, go: function(data) { arr = data[0].split(columnsSeparator); ean = arr[0]; prz = arr[1]; aut = arr[2]; tit = arr[3]; sez = arr[4]; tpr = arr[5]; url = "/"+sez+"/scheda/ea"+ean+".html"; location.href = url; }, extraParams: {crc: function(){return jQuery("input[name='crc']").val();}} }); } } function rollUpCarrello() { jQuery('#dropdownCarrello').slideUp("100"); } var paginaCaricata = ""; function aggiungiCarrelloRefresh(ean, tipoProd, element, dbsource, formato, protezione, trackLabel) { if (tipoProd == "80" || tipoProd == "81") { aggiungiCarrelloDownload(ean, formato, dbsource, protezione, trackLabel); } else { aggiungiCarrelloStandard(ean, tipoProd, element, trackLabel, true); } } function aggiungiCarrello(ean, tipoProd, element, dbsource, formato, protezione, trackLabel) { if (tipoProd == "80" || tipoProd == "81") { aggiungiCarrelloDownload(ean, formato, dbsource, protezione, trackLabel); } else { aggiungiCarrelloStandard(ean, tipoProd, element, trackLabel); } } function aggiungiCarrelloDownload(ean, formatoDownload, dbsource, protezione, trackLabel) { if (paginaCaricata != "") { if (formatoDownload == null || dbsource == null) { thickBoxAlert("Parametri incompleti. Impossibile effettuare la richiesta di download."); } else { trackCart("Cart_add", ean); if (trackLabel != null && trackLabel != "") { trackCart(trackLabel, ean); } var act = "caricaDownload"; if (formatoDownload < 0) { act = "caricaDownloadZero"; } var url = "/carrello/" + act + "/" + dbsource + "/" + ean + "/" + Math.abs(formatoDownload) + "/" + protezione; location.href = url; window.event.returnValue=false; } } } function aggiungiCarrelloStandard(ean, tipoProd, element, trackLabel, refreshCarrello) { if (paginaCaricata != "") { if (readCookie('JSESSIONID') == null) { thickBoxAlert("Per poter inserire prodotti nel carrello, č necessario abilitare i cookie del browser.
Per maggiori informazioni,
clicca qui"); } else { trackCart("Cart_add", ean); if (trackLabel != null && trackLabel != "") { trackCart(trackLabel, ean); } jQuery.blockUI.defaults.css = { padding: 0, margin: 0, width: '30%', top: '40%', left: '35%', textAlign: 'center', color: '#666', border: '1px solid #98BCE5', backgroundColor:'#fff', cursor: 'wait' }; jQuery.blockUI({ message: jQuery('#spinnerAggiungiCarrello'), css:{width:'auto', left:'45%', background:'none', border:'none'}, overlayCSS: {opacity: '0.03'} }); var pop = jQuery('#popupAggiungiCarrello'); jQuery.ajax({ url:"/app/bol/carrello/carrello/caricaJSON?ean="+ean+"&tipoProd="+tipoProd+"&now="+(new Date()).getTime(), dataType:"json", success:function(data){ if(data.errorcode==9) { location.href="/carrello/WBSVerifica"; } else { pop.html(data.message); jQuery.ajax({url: "/bol/nose/servizi/carrello/numeroRigheCarrello.jsp", data: "now="+(new Date()).getTime(), complete: function(res, status) { if ( status == "success" || status =="notmodified" ) { jQuery(".numeroElementiCarrello").html(jQuery.trim(res.responseText)); jQuery.unblockUI(); jQuery.blockUI({ message: jQuery('#popupAggiungiCarrello'), css:{}, overlayCSS: {opacity: '0.0'} }); setTimeout(jQuery.unblockUI, 2000); //jQuery(".blockUI").fadeOut("slow"); if (refreshCarrello) { location.href= "/carrello/leggi"; } } else restoreBrokenStateAggiungiCarrello(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { restoreBrokenStateAggiungiCarrello(); } }); var carrVisible = jQuery('#dropdownCarrello').is(':visible'); dropDownCarrello(true); if (!carrVisible) { setTimeout(rollUpCarrello, 2000); // rollUpCarrello(); } } } ,error:function(data){restoreBrokenStateAggiungiCarrello(); } }); } } /* pop.load("/app/bol/carrello/carrello/caricaJSON?ean="+ean+"&tipoProd="+tipoProd+"&now="+(new Date()).getTime(),"", function(responseText, textStatus, XMLHttpRequest){ if ( textStatus == "success") { jQuery.ajax({url: "/bol/nose/servizi/carrello/numeroRigheCarrello.jsp", data: "now="+(new Date()).getTime(), complete: function(res, status) { if ( status == "success" || status =="notmodified" ) { jQuery(".numeroElementiCarrello").html(jQuery.trim(res.responseText)); jQuery.unblockUI(); jQuery.blockUI({ message: jQuery('#popupAggiungiCarrello'), css:{}, overlayCSS: {opacity: '0.0'} }); setTimeout(jQuery.unblockUI, 2000); //jQuery(".blockUI").fadeOut("slow"); if (refreshCarrello) { location.href= "/carrello/leggi"; } } else restoreBrokenStateAggiungiCarrello(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { restoreBrokenStateAggiungiCarrello(); } }); var carrVisible = jQuery('#dropdownCarrello').is(':visible'); dropDownCarrello(true); if (!carrVisible) { setTimeout(rollUpCarrello, 2000); // rollUpCarrello(); } } else { restoreBrokenStateAggiungiCarrello(); } }); } } */ return false; } function eliminaCarrello(eccprrig, ecccdpro) { trackCart("Cart_remove",ecccdpro); var baseCancellaUrl = "/carrello/cancella/"; var url = baseCancellaUrl+eccprrig+"/"+ecccdpro; location.href = url; } function restoreBrokenStateAggiungiCarrello() { jQuery.unblockUI(); jQuery('#popupAggiungiCarrello').html('errore in caricamento carrello'); jQuery.blockUI({ message: jQuery('#popupAggiungiCarrello'), css:{}, overlayCSS: {opacity: '0.0'} }); setTimeout(jQuery.unblockUI, 1000); } columnsSeparator= "==="; rowsSeparator = ";;"; function formatItem(data, i, n, value) { arr = value.split(columnsSeparator); ean = arr[0]; prz = arr[1]; aut = arr[2]; tit = arr[3]; sez = arr[4]; tpr = arr[5]; return "
"+prz+"
"+aut+"
"+tit+"
"; } function formatResult(data, value) { return value.split(columnsSeparator)[3]; } function parse(data) { data = jQuery(data).filter("#autocomplete_results").text();// risolve il bug delle entitā in caso di responso html var parsed = []; var rows = data.split(rowsSeparator); for (var i=0; i < rows.length; i++) { var row = jQuery.trim(rows[i]); if (row) { row = row.split("|"); parsed[parsed.length] = { data: row, value: row[0], result: formatResult && formatResult(row, row[0]) || row[0] }; } } return parsed; } function validaEmail(src) { var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"; var regex = new RegExp(emailReg); return regex.test(src); } function pos() { coccarda1 = jQuery('div.bol_box_threecols span.bol_ico_sale_small_red'); } function verificaCompleto() { var inString = ""; var completo = 1; var allegato = 1; var estensioneCorretta = 1; if (document.invia_dati.File_1){ inString = "" + document.invia_dati.File_1.value; if (inString.length > 0) { allegato = 0; } } inString = "" + document.invia_dati.name.value; if (inString.length < 1) { completo = 0; } inString = "" + document.invia_dati.surname.value; if (inString.length < 1) { completo = 0; } if (document.invia_dati.subject){ inString = "" + document.invia_dati.subject.value; if (inString.length < 1) { completo = 0; } } inString = "" + document.invia_dati.email.value; if (!validateEmail(inString)) { completo = 0; document.invia_dati.email.select(); } if(completo==0){ thickBoxAlert("Completa tutti i campi, per favore"); return false; } else if(allegato==0){ thickBoxAlert("Hai dimenticato di allegare il file, premi Allega"); return false; } else { return true; } } // Javascript per la verifica dell'indirizzo email // function validateEmail(inString) { var alfaNum; var startPos; var ch; var ch; var up; var pp; var dom; ch = inString.lastIndexOf('@'); dom = inString.substring(ch+1); pp = dom.indexOf('.'); up = dom.lastIndexOf('.'); //!*|,;:"<>()[]{}@&$#% if (inString.length < 6) { //indirizzo troppo corto return false; } if (ch < 1) { //@ troppo indierto return false; } if (pp < 1) { //@ troppo vicina al primo . return false; } if (up > dom.length - 3) { //ultimo . troppo avanti return false; } if (up < dom.length - 7) { //ultimo . troppo indietro return false; } startPos = 0; alfaNum = "!*|,;:<>()[]{}@&$#%?"; //!*|,;:<>()[]{}@&$#% caratteri vietati nel dominio while (startPos < dom.length) { ch = dom.charAt(startPos); if (alfaNum.indexOf(ch) >= 0) { return false; } startPos++; } return true; } function thickBoxAlert(message, h) { if (h == null) {h=70;} jQuery("#TB_alert").html("

"+message+"

"); jQuery("#TB_load").remove(); tb_show("", "#TB_inline?height="+(h+38)+"&width=484&inlineId=TB_alert&modal=true", "false"); jQuery("#TB_ajaxContent .TB_bol_right a:eq(0)").focus(); jQuery("#TB_ajaxContent .TB_bol_right a:eq(0)").keypress(function(e) { if (e.which == 13 || e.which == 27 || e.which == 0 || e.which == 32) { tb_remove(); } }); } function thickBoxLoader() { if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 jQuery("body","html").css({height: "100%", width: "100%"}); jQuery("html").css("overflow","hidden"); if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 jQuery("body").append("
"); jQuery("#TB_overlay").click(tb_remove); } }else{//all others if(document.getElementById("TB_overlay") === null){ jQuery("body").append("
"); jQuery("#TB_overlay").click(tb_remove); } } if(tb_detectMacXFF()){ jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash }else{ jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity } jQuery("body").append("
");//add loader to the page jQuery('#TB_load').show();//show loader } /************* * funzioni per i banner adv openx esterni * ***************************************************/ function lead_remove(){ jQuery(document).ready(function () { jQuery("#bol_banner").remove(); }); } function rct_remove(){ jQuery(document).ready(function () { jQuery("#bol_rct_scheda").remove(); }); } function adv_adloc_mmnd(categ) { var adloc_sez=""; switch (categ) { case "home": case "libri": case "books": case "cd": case "dvd": case "games": case "idee": adloc_sez=categ; break; case "professionali": adloc_sez="profe"; break; case "remainders": adloc_sez="remai"; break; case "ebook-inglesi": adloc_sez="ebeng"; break; /* case "ebook-italiani": adloc_sez="ebita"; break; case "download": adloc_sez="downl"; break; */ default: adloc_sez="altre"; } return adloc_sez; } /************* * funzioni jquery per le frecce di amministrazione * ***************************************************/ function aggiornaNuova(formId,cookieName){ jQuery('#'+formId).toggle(); aggiornaCookie(1,cookieName); jQuery('#buttonNuovoLink').focus(); jQuery('#descrizionenLink').focus(); } function aggiorna(formId,node,cookieName){ node.click( function(){ var j = jQuery(this).attr("id").substring(4); jQuery('#'+formId+j).toggle('slow'); aggiornaFrecce(j); aggiornaCookie(j,cookieName); }); } function aggiornaFrecce(j){ var src = jQuery('#arrow'+j).attr('src'); if (src=='/bol/images/ico_box_arrow_up.gif'){ src = '/bol/images/ico_box_arrow_down.gif'; }else{ src='/bol/images/ico_box_arrow_up.gif'; } jQuery('#arrow'+j).attr('src',src); } function aggiornaCookie(i,cookieName){ if (i>0){ var cookieValue = jQuery.cookie(cookieName); if (cookieValue==null){ cookieValue="0"; } while (cookieValue.lengthi){ cookieValueTemp += cookieValue.substring(i); } cookieValue = cookieValueTemp; var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); dominio = ''; var pos = dominio.indexOf(':'); if (pos>-1){ dominio = dominio.substring(0,pos); } jQuery.cookie(cookieName,cookieValue , { domain: dominio, path: '/', expires: date }); } } /************* * fine funzioni jquery per le frecce di amministrazione * ***************************************************/ /******************************** * funzioni jquery per pubblicazione SE * ********************************/ function pubblicaLogin() { jQuery("#nickName").val(""); jQuery("#pwd").val(""); tb_show("", "#TB_inline?height=195&width=400&inlineId=TB_confermaLogin&modal=true", "false"); //jQuery("#TB_confermaLogin").show(); } function pubblica() { var page = "/admin/pubblicaSe/"; var idsezione = jQuery("#idSezionePadre").val(); var utente = jQuery("#nickName").val(); var password = jQuery("#pwd").val(); var idArticoloSx = jQuery("#idArticoloSx").val(); var idArticoloCe = jQuery("#idArticoloCe").val(); var idArticoloDx = jQuery("#idArticoloDx").val(); jQuery.post(page, {brand: 'default', sezione: idsezione.substr(idsezione.length-6), utente: utente, password: password, idArticoloSx: idArticoloSx, idArticoloCe: idArticoloCe, idArticoloDx: idArticoloDx}, function(data){ if (data.type == "success") { jQuery("#flashAlertAdmin1").removeClass("flashAlertAdmin"); jQuery("#flashAlertAdmin1").removeClass("flashAlertAdminKo"); jQuery("#flashAlertAdmin1").addClass("flashAlertAdminOk"); jQuery("#flashAlertAdmin1").html('Vetrina correttamente pubblicata'); } else { jQuery("#flashAlertAdmin1").addClass("flashAlertAdminKo"); jQuery("#flashAlertAdmin1").removeClass("flashAlertAdminOk"); jQuery("#flashAlertAdmin1").removeClass("flashAlertAdmin"); if (data.message != "errorePubblicazione") { jQuery("#flashAlertAdmin1").html('Errore in fase di login, pubblicare'); } else { jQuery("#flashAlertAdmin1").html('Errore nella pubblicazione della vetrina, pubblicare'); } } }, "json"); tb_remove(); jQuery("#flashAlertAdmin1").html('Loader'); } /******************************** * fine funzioni jquery per pubblicazione SE * ********************************/ /*********************** * Funzioni per Rating * ***********************/ // pre-submit callback function checkStar(formData, jqForm, options) { // Se il voto no č impostato lo forzo a zero if (!formData[4].value) { formData[4].value = 0; } return true; } function processJson(data) { // 'data' č l'oggetto JSON ritornato dal server tb_show("", "/bol/nose/servizi/recensione/recensione_ok.jsp?messaggio="+data.message+"&height=400&width=495&modal=true", "false"); } function toglieDoppi( fieldId ) { var fieldValue = jQuery("#"+fieldId).val(); re = /"/gi; var newstx=fieldValue.replace(re, "''"); jQuery("#"+fieldId).val(newstx); } function cercaDoppi(){ toglieDoppi('ratingreview'); toglieDoppi('ratingautore'); } function validaReview(review) { var anchorRegex = //i; var urlBBRegex = /\[url=(.*)\[\/url\]/i; var linkBBRegex = /\[link=(.*)\[\/link\]/i; if (anchorRegex.test(review)) {return false;} if (urlBBRegex.test(review)) {return false;} if (linkBBRegex.test(review)) {return false;} return true; } function controlliForm() { var autore = jQuery.trim(jQuery("#ratingautore").val()); var email = jQuery.trim(jQuery("#ratingemail").val()); var review = jQuery.trim(jQuery("#ratingreview").val()); var result = true; if (jQuery.trim(review).length < 1){result = false; } if (jQuery.trim(autore).length < 1) {result=false;} if (!validaEmail(email)){result = false; } if (!validaReview(review)){result = false; } cercaDoppi(); if (!result) { tb_show("", "/bol/nose/servizi/recensione/anteprima.jsp?height=400&width=495&modal=true", "false"); } return result; } function validaCaptchaRecensione() { var precaptcha = jQuery("#confirmmessage"); if (precaptcha.val() != null && precaptcha.val() != "") { jQuery("#TB_ajaxContent").load("/bol/nose/servizi/recensione/recensione_ok.jsp?messaggio=true"); return ; } var captcha = jQuery("#captcha"); var message = 'il codice inserito non corrisponde a quello nell’ immagine'; jQuery.get("/app/bol/web/recensione/validaCaptcha", { captcha: captcha.val()}, function(data){ if (data.message == 'false') { jQuery("#errore_captcha").html(message); jQuery("#commento_captcha img").attr("src", "/jcaptcha?" + (new Date()).getTime()); } else { voto = jQuery("#ratingvoto").children("[name=voto]"); if (voto.val() == ""){ voto.val("0");} jQuery.get("/app/bol/web/recensione/aggiungiJSON?"+jQuery("#ratingform").serialize(), {}, function(data){ jQuery("#TB_ajaxContent").load("/bol/nose/servizi/recensione/recensione_ok.jsp?messaggio="+data.message); } ,'json'); } },'json'); } /********************** *Fine funzioni Rating * ***********************/