function addParameterToURL(_url,param){ _url += (_url.split('?')[1] ? '&':'?') + param; return _url; } function upd_carrello(url_par){ url_par = '?'+url_par || ''; $( "#div_carrello" ).html('') .load(addParameterToURL(window.location.protocol + "//" + window.location.hostname+'/carrello_ajax.php'+url_par,'nocache='+new Date().getTime())); $('#carrello_nqta').load(window.location.protocol + "//" + window.location.hostname+'/carrello_ajax.php?get_qta=1&nocache='+new Date().getTime()); } function upd_carrello_qty(){ form = $('#form_cart'); $.ajax({ type: "POST", url: window.location.protocol + "//" + window.location.hostname+"/carrello_ajax.php?action=update_product", data: form.serialize(), success: function (data) { $( "#div_carrello" ).html(data); $('#carrello_nqta').load(window.location.protocol + "//" + window.location.hostname+'/carrello_ajax.php?get_qta=1&nocache='+new Date().getTime()); }, beforeSend: function() { $( "#div_carrello" ).html(''); } }); } function controlloConfronta(ck_ncheck){ var i=0; var cComp = document.getElementById('compara_' + ck_ncheck); if(cComp){ var codice_prod=cComp.value; }else{ var codice_prod=''; } if(cComp.checked){ if ($.cookie('pConfrontati')){ var a_pConfrontati = $.cookie('pConfrontati').split(','); if (a_pConfrontati.length < 4){ a_pConfrontati.push(codice_prod); }else if (a_pConfrontati.length >= 4){ alert('Puoi comparare massimo 4 prodotti\r\nFai click su Compara per rimuovere i prodotti dalla comparazione'); cComp.checked=false; } }else{ var a_pConfrontati = new Array(); a_pConfrontati.push(codice_prod); } }else{ if ($.cookie('pConfrontati')) { var a_pConfrontati = $.cookie('pConfrontati').split(','); while (i < a_pConfrontati.length) { if (a_pConfrontati[i] == codice_prod) { a_pConfrontati.splice(i, 1); } else { i++; } } } } $.cookie('pConfrontati', a_pConfrontati, {path: '/'}); } function quickTabs(navQuick,show_hide,init_mode){ init_mode = init_mode || 0; if(navQuick){ if(show_hide){ if (init_mode) { $('#qck_all'+navQuick).show(); }else{ $('#qck_all'+navQuick).slideDown('fast'); } $('#qckt'+navQuick).parent().parent().hide(); }else{ if (init_mode) { $('#qck_all'+navQuick).hide(); }else{ $('#qck_all'+navQuick).slideUp('fast',function(){ $('#qckt'+navQuick).parent().parent().show(); }); } } } return; } function shfiltri(show_hide) { if (show_hide && $('#filtri_show > span > span > a').hasClass('disabled')==false) { $('#filtri_show > span > span > a').addClass('disabled'); $('.column_left_main').css('display','block'); $('.column_left_main').animate({"left": '+=200'}); }else{ $('.column_left_main').animate({"left": '-=200'},function(){ $('.column_left_main').css('display',''); $('#filtri_show > span > span > a').removeClass('disabled');; }); } } var column_left=0; function chksearchtext(search_form){ search_form.keywords.value=trim(search_form.keywords.value); if (search_form.keywords.value.length < 2 ) { alert('Termine di ricerca troppo corto (minimo 2 caratteri)') ; search_form.keywords.focus(); return (false); } if (search_form.keywords.value == 'Cosa stai cercando?'){ alert('Inserisci un termine per la ricerca'); search_form.keywords.focus(); return (false); } if (search_form.keywords.value.length > 50 ){ alert('Il termine di ricerca รจ troppo lungo. (Massimo 50 caratteri)'); search_form.keywords.focus(); return (false); } $(".head_search_go").css("display","none"); $(".search-rot").css("display","block"); return true; } function trim (str) { var str = str.replace(/^\s\s*/, ''), ws = /\s/, i = str.length; while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); }