//COLLEGAMENTO AL FILE DELLE TRADUZIONI PER I TESTI D'ERRORE //COLLEGAMENTO AL FILE DELLE TRADUZIONI PER I TESTI D'ERRORE $(document).ready(function() { $("#closed_po_up").click(function(){ $(".pop-back").fadeOut(); }) $(".search-buttom").click(function () { $(".header_ricerca").css("display", "block") }) /*IMPOSTAZIONI CALENDARIO JQUERY*/ $.datepicker.setDefaults($.datepicker.regional["it"]); /*IMPOSTAZIONI CALENDARIO JQUERY*/ /*AGGIUNTA METODO VALIDATE DATA EUROPEA JQUERY*/ $.validator.addMethod( "dateEUR", function(value, element) { //Return NB: isRequired is not checked at this stage return (value == "") ? true : DataValida(value); }, "* invalid" ); /*AGGIUNTA METODO VALIDATE DATA EUROPEA JQUERY*/ /*PREVENIRE HREF DI DEFAULT*/ $("A.no_link").click(function(event) { event.preventDefault(); }); /*PREVENIRE HREF DI DEFAULT*/ /*PREVENIRE HREF DI DEFAULT*/ $("A.close_div_lvl2").click(function(event) { event.preventDefault(); $(this).parents("DIV").parents("DIV").fadeOut(); }); /*PREVENIRE HREF DI DEFAULT*/ /*TESTO DI DEFAULT CAMPI INPUT*/ $("FORM").each(function() { /*CONTROLLO CHE L'UTENTE ABBIA INSERITO UN VALORE DIVERSO DA QUELLO DI DEFAULT*/ $(this).submit(function() { if ($(this).children("INPUT.input_txt_description").val() == $(this).children("INPUT.input_txt_description").attr("def_txt")) { $(this).children("INPUT.input_txt_description").val(""); } }); /*CONTROLLO CHE L'UTENTE ABBIA INSERITO UN VALORE DIVERSO DA QUELLO DI DEFAULT*/ /*IMPOSTAZIONE VALORE DI DEFAULT*/ if ($(this).children("INPUT.input_txt_description").val() == "") { $(this).children("INPUT.input_txt_description").val($(this).children("INPUT.input_txt_description").attr("def_txt")); } /*IMPOSTAZIONE VALORE DI DEFAULT*/ /*CONTROLLO CLICK SULLA CASELLA*/ $(this).children("INPUT.input_txt_description").focus(function(event) { if ($(this).val() == $(this).attr("def_txt")) { $(this).val(""); }; }); $(this).children("INPUT.input_txt_description").blur(function(event) { if ($(this).val() == "") { $(this).val($(this).attr("def_txt")); }; }); /*CONTROLLO CLICK SULLA CASELLA*/ }); /*TESTO DI DEFAULT CAMPI INPUT*/ /*SUBMIT DEL FORM SUL LINK*/ $("A.submit").click(function(event) { event.preventDefault(); $(this).parents("FORM").submit(); }); /*SUBMIT DEL FORM SUL LINK*/ /*RISERVATA COL DX*/ $("#login_col_dx").click(function() { if ($(".header_up_riservata").height() == "20"){ $(".header_up_newsletter").animate({height: "20px"}, 100); $(this).parents(".header_up_riservata").animate({height: "74px"}, 300); }else{ $(this).parents(".header_up_riservata").animate({height: "20px"}, 300); } }); /*RISERVATA COL DX*/ /*ACCOUNT COL DX*/ $("#account_col_dx").click(function() { if ($(".header_up_account").height() == "20"){ $(".header_up_newsletter").animate({height: "20px"}, 100); $(this).parents(".header_up_account").animate({height: "84px"}, 300); }else{ $(this).parents(".header_up_account").animate({height: "20px"}, 300); } }); /*ACCOUNT COL DX*/ /*NEWSLETTER COL DX*/ $(".header_up_newsletter LABEL").click(function() { if ($(".header_up_newsletter").height() == "20"){ $(".header_up_riservata").animate({height: "20px"}, 100); $(".header_up_account").animate({height: "20px"}, 100); $(this).parents(".header_up_newsletter").animate({height: "50px"}, 300); }else{ $(this).parents(".header_up_newsletter").animate({height: "20px"}, 300); } }); /*NEWSLETTER COL DX*/ /*FOOTER SOCIAL*/ $(".footer_social").hover(function() { $(this).children(".footer_popup").slideToggle(300); }); /*FOOTER SOCIAL*/ /*FOOTER LANGUAGE*/ $(".footer_lingue").hover(function() { $(this).children(".footer_popup").slideToggle(300); }); /*FOOTER LANGUAGE*/ /*HOVER HOME PAGE*/ $(".col_center_products TABLE TD DIV").hover(function(){ $(this).children("DIV").slideToggle(); }); /*COLORBOX SULLE IMMAGINI*/ $(".img_to_zoom").colorbox({ transition: "elastic" }); $(".img_to_zoom_gallery").colorbox({ rel: 'gallery', transition: "elastic" }); $(".youtube").colorbox({ iframe: true, innerWidth: 640, innerHeight: 390 }); /*COLORBOX SULLE IMMAGINI*/ /*FORM DI RICERCA NELL'HEADER*/ $("#form_cerca_header").submit(function() { var titolo_cerca = "" /*if ($("#id_c option:selected").val() != "") { titolo_cerca = titolo_cerca + $("#id_c option:selected'").text() + ": "; }*/ if ($("#testo").val() != "") { titolo_cerca = titolo_cerca + "\"" + $("#testo").val() + "\""; } /*if ($("#id_m option:selected").val() != "") { if (titolo_cerca != "") { titolo_cerca = titolo_cerca + " - " } titolo_cerca = titolo_cerca + $("#id_m option:selected").text(); }*/ if (titolo_cerca == "") { titolo_cerca = "Tutti i prodotti" } $("#t").val(titolo_cerca); }); /*FORM DI RICERCA NELL'HEADER*/ /*SCHEDA PRODOTTO - APERTURA INFORMAZIONI AGGIUNTIVE*/ $("#scheda_prodotto_txt_scheda_ingredienti").click(function(){ $("#scheda_prodotto_txt_scheda_ingredienti_p").slideToggle(200,function(){ if ($(this).css("display") == "none"){ $("#scheda_prodotto_txt_scheda_ingredienti").css("background-position","right 8px"); }else{ $("#scheda_prodotto_txt_scheda_ingredienti").css("background-position","right -8px"); } }); }); $("#scheda_prodotto_txt_scheda_nutrizione").click(function(){ $("#scheda_prodotto_txt_scheda_nutrizione_p").slideToggle(200,function(){ if ($(this).css("display") == "none"){ $("#scheda_prodotto_txt_scheda_nutrizione").css("background-position","right 8px"); }else{ $("#scheda_prodotto_txt_scheda_nutrizione").css("background-position","right -8px"); } }); }); /*SCHEDA PRODOTTO - APERTURA INFORMAZIONI AGGIUNTIVE*/ /*CONTROLLO CASELLA SOLO NUMERI - PRODOTTO ADDCART*/ $("#carrello_add").validate({ rules: { qt_add: { required: true, digits: true } }, messages: { qt_add: "Solo valori numerici" } }); /*CONTROLLO CASELLA SOLO NUMERI - PRODOTTO ADDCART*/ /*CONTROLLO FORM REGISTRAZIONE*/ /*$("#reg_nascita").datepicker({ showOn: "both", buttonImage: "/images/template/calendar.png", buttonImageOnly: true, changeYear: true, changeMonth: true, yearRange: "-100:+0" }); $('#reg_nascita').attr('readonly', true); $('#reg_nascita').change(function() { $(this).focus(); $(this).blur(); });*/ $("#form_registrazione").validate({ rules: { reg_nascita: { dateEUR: true, required: true }, reg_nome: "required", reg_cognome: "required", reg_provincia: { minlength: 2, maxlength: 2 }, reg_cap: { minlength: 5, maxlength: 5, digits: true }, reg_email: { required: true, email: true }, reg_password: { required: true, minlength: 6 }, reg_conf_password: { required: true, equalTo: "#reg_password" }, reg_privacy: "required", reg_privacy_dati: "required" }, messages: { reg_nascita: "Inserire una data valida", reg_nome: "Inserire nome", reg_cognome: "Inserire cognome", reg_provincia: "Massimo 2 caratteri", reg_cap: "Massimo 5 caratteri numerici", reg_email: "Inserire una mail valida", reg_password: "Impostare una password(minimo 6 caratteri)", reg_conf_password: "La conferma non corrisponde alla password", reg_privacy: "Non hai accettato i termini del servizio", reg_privacy_dati: "Non hai accettato i termini del servizio" } }); /*CONTROLLO FORM REGISTRAZIONE*/ /*CONTROLLO FORM LOGIN HEADER*/ $('#email_login_header').focus(function() { $(this).select(); }).mouseup(function(e) { e.preventDefault(); }); $('#pwd_login_header').focus(function() { $(this).select(); }).mouseup(function(e) { e.preventDefault(); }); /*CONTROLLO FORM LOGIN HEADER*/ /*CONTROLLO FORM LOGIN*/ $("#form_login").validate({ rules: { email_login: { required: true, email: true }, pwd_login: { required: true, minlength: 6 } }, messages: { email_login: "Inserire una mail valida", pwd_login: "Inserire una password valida" } }); /*CONTROLLO FORM LOGIN*/ /*CONTROLLO FORM LOGIN*/ $("#form_login_persa").validate({ rules: { email_login_persa: { required: true, email: true } }, messages: { email_login_persa: "Inserire una mail valida" } }); /*CONTROLLO FORM LOGIN*/ /*CONTROLLO FORM PROFILO*/ /*$("#prfl_nascita").datepicker({ showOn: "both", buttonImage: "/images/template/calendar.png", buttonImageOnly: true, changeYear: true, changeMonth: true, yearRange: "-100:+0" }); $('#prfl_nascita').attr('readonly', true); $('#prfl_nascita').change(function() { $(this).focus(); $(this).blur(); });*/ $('#prfl_email').attr('readonly', true); $('.label_saved').delay(2000).slideUp(1000); $("#form_profilo").validate({ rules: { prfl_nascita: { dateEUR: true, required: true }, prfl_nome: "required", prfl_cognome: "required", prfl_provincia: { minlength: 2, maxlength: 2 }, prfl_cap: { minlength: 5, maxlength: 5, digits: true }, prfl_password: { required: true, minlength: 6 }, prfl_conf_password: { required: true, equalTo: "#prfl_password" } }, messages: { prfl_nascita: "Inserire la data di nascita", prfl_nome: "Inserire nome", prfl_cognome: "Inserire cognome", prfl_provincia: "Massimo 2 caratteri", prfl_cap: "Massimo 5 caratteri numerici", prfl_password: "Impostare una password(minimo 6 caratteri)", prfl_conf_password: "La conferma non corrisponde alla password" } }); /*CONTROLLO FORM PROFILO*/ /*APERTURA MENU ACCOUNT HEADER*/ $('#header_open_account_menu').hover(function() { $('#header_div_account_menu').fadeIn(500); }); $('#header_div_account_menu').hover(function() { /*$('#header_div_account_menu').fadeIn(100);*/ }, function() { $('#header_div_account_menu').fadeOut(500); }); /*APERTURA MENU ACCOUNT HEADER*/ /*CONTROLLO FORM CARRELLO*/ $("#form_carrello SELECT").change(function() { $(this).parents("FORM").submit(); }); $("#form_carrello INPUT:checkbox").change(function() { $(this).parents("FORM").submit(); }); $("#submit_carrello").click(function(event) { event.preventDefault(); $(this).parents("FORM").attr("action", "carrello_spedizione.asp"); $(this).parents("FORM").submit(); }); /*CONTROLLO FORM CARRELLO*/ /*CONTROLLO FORM CARRELLO SPEDIZIONE*/ $("#submit_carrello_spedizioni").click(function(event) { event.preventDefault(); $(this).parents("FORM").attr("action", "carrello_elabora.asp"); $(this).parents("FORM").submit(); }); $("#form_spedizione INPUT[name=id_spedizione]").click(function(event) { if ($(this).val() != 0) { $("#nuovo_indirizzo").slideUp(); } else { $("#nuovo_indirizzo").slideDown(); } }); $("#form_spedizione INPUT[name=id_fatturazione]").click(function(event) { if ($(this).val() != 0) { $("#nuovo_fattura").slideUp(); } else { $("#nuovo_fattura").slideDown(); } }); $("#form_spedizione").validate({ rules: { sped_nome: "required", sped_cognome: "required", sped_cf: { required: true, minlength: 16, maxlength: 16 }, sped_via: "required", sped_comune: "required", sped_provincia: { required: true, minlength: 2, maxlength: 2 }, sped_cap: { required: true, minlength: 5, maxlength: 5, digits: true }, sped_telefono: "required", fatt_rag_sociale: "required", fatt_piva: { required: true, maxlength: 11 }, fatt_cf: { required: true, maxlength: 16 }, fatt_via: "required", fatt_comune: "required", fatt_provincia: { required: true, minlength: 2, maxlength: 2 }, fatt_cap: { required: true, minlength: 5, maxlength: 5, digits: true } }, messages: { sped_nome: "Inserire nome", sped_cognome: "Inserire cognome", sped_cf: "Inserire Codice Fiscale(16 caratteri)", sped_via: "Inserire indirizzo", sped_comune: "Inserire comune", sped_provincia: "Inserire provincia. Massimo 2 caratteri", sped_cap: "Inserire CAP. Massimo 5 caratteri numerici", sped_telefono: "Inserire telefono", fatt_rag_sociale: "Inserire Ragione sociale", fatt_piva: "Inserire P.IVA (massimo 11 caratteri)", fatt_cf: "Inserire Cod.Fisc. (massimo 16 caratteri)", fatt_via: "Inserire indirizzo", fatt_comune: "Inserire comune", fatt_provincia: "Inserire provincia. Massimo 2 caratteri", fatt_cap: "Inserire CAP. Massimo 5 caratteri numerici" } }); /*CONTROLLO FORM CARRELLO SPEDIZIONE*/ /*CONTROLLO FORM CARRELLO RIEPILOGO*/ $("#submit_carrello_riepilogo").click(function(event) { event.preventDefault(); $(this).parents("FORM").attr("action", "carrello_concludi.asp"); $(this).parents("FORM").submit(); }); /*CONTROLLO FORM CARRELLO RIEPILOGO*/ /*LISTA FAQ*/ $(".div_faq_list").accordion({ heightStyle: "content" }); /*LISTA FAQ*/ /*CONTROLLO FORM CONTATTI*/ $("#linkCaptcha").click(function() { RefreshImage('imgCaptcha'); }); $("#form_contatti").validate({ rules: { cont_cap: { minlength: 5, maxlength: 5, digits: true }, cont_email: { required: true, email: true }, cont_richiesta: "required", cont_privacy: "required" }, messages: { cont_cap: "Massimo 5 caratteri numerici", cont_email: "Inserire una mail valida", cont_richiesta: "Inserire il testo della richiesta", cont_privacy: "Non hai accettato i termini del servizio" } }); /*CONTROLLO FORM CONTATTI*/ /*CONTROLLO FORM NEWSLETTER*/ /*$("#newsletter_nascita").datepicker({ showOn: "both", buttonImage: "/images/template/calendar.png", buttonImageOnly: true, changeYear: true, changeMonth: true, yearRange: "-100:+0" }); $('#newsletter_nascita').attr('readonly', true); $('#newsletter_nascita').change(function() { $(this).focus(); $(this).blur(); });*/ $("#form_newsletter").validate({ rules: { newsletter_nascita: { dateEUR: true, required: true }, newsletter_nome: "required", newsletter_cognome: "required", newsletter_comune: "required", newsletter_provincia: { required: true, minlength: 2, maxlength: 2 }, newsletter_email: { required: true, email: true }, newsletter_privacy: "required" }, messages: { newsletter_nascita: "Inserire la data di nascita", newsletter_nome: "Inserire nome", newsletter_cognome: "Inserire cognome", newsletter_comune: "Inserire comune", newsletter_provincia: "Massimo 2 caratteri", newsletter_email: "Inserire una mail valida", newsletter_privacy: "Non hai accettato i termini del servizio" } }); /*CONTROLLO FORM NEWSLETTER*/ /*GESTIONE SITEMAP - APERTURA ALBERO LINK*/ $(".sitemap_down_arrow").click(function() { if ($(this).css("background-position") == "0% 0%") { $(this).css("background-position", "left bottom"); } else { $(this).css("background-position", "left top"); } $(this).parent().parent().children("UL").slideToggle(300); $('html,body').animate({ scrollTop: $(this).offset().top }, 500); }); /*GESTIONE SITEMAP - APERTURA ALBERO LINK*/ }); $(window).load(function() { $("#closed_ricerca").click(function(){ $(".header_ricerca").css("display", "none") }) /*Posizionamento immagine al centro esatto con controllo immagine già caricata*/ $(".imgPosAbs").each(function() { if ($(this).height() > 0) { imgWPosAbs = $(this).width(); imgHPosAbs = $(this).height(); $(this).css("margin-left", "-" + imgWPosAbs / 2 + "px"); $(this).css("margin-top", "-" + imgHPosAbs / 2 + "px"); } else { $(this).load(function() { imgWPosAbs = $(this).width(); imgHPosAbs = $(this).height(); $(this).css("margin-left", "-" + imgWPosAbs / 2 + "px"); $(this).css("margin-top", "-" + imgHPosAbs / 2 + "px"); }); } }); /*Posizionamento immagine al centro esatto con controllo immagine già caricata*/ /*ZOOM IMMAGINE*/ $("#show_img").simpleZoom({ zoomBox : "#zoom_img", markSize : [100, 100], zoomSize : [509, 450] //zoomSize : [288, 250] }); /*ZOOM IMMAGINE*/ $(".scheda_prodotto_list_gallery .img").click(function(){ src_old_image = $("#show_img IMG").attr("src"); //src_old_image = src_old_image.replace("prodotti/","prodotti/thumbs/"); src_new_image = $(this).children("IMG").attr("src"); src_new_image_zoom = src_new_image.replace("thumbs/",""); $("#show_img IMG").attr("src",src_new_image); $("#zoom_img IMG").attr("src",src_new_image_zoom); $(this).children("IMG").attr("src",src_old_image); $(".scheda_prodotto_img_scheda_image").load(); $(".imgPosAbs").each(function() { if ($(this).height() > 0) { imgWPosAbs = $(this).width(); imgHPosAbs = $(this).height(); $(this).css("margin-left", "-" + imgWPosAbs / 2 + "px"); $(this).css("margin-top", "-" + imgHPosAbs / 2 + "px"); } else { $(this).load(function() { imgWPosAbs = $(this).width(); imgHPosAbs = $(this).height(); $(this).css("margin-left", "-" + imgWPosAbs / 2 + "px"); $(this).css("margin-top", "-" + imgHPosAbs / 2 + "px"); }); } }); $("#show_img I").remove(); $("#show_img").simpleZoom({ zoomBox : "#zoom_img", markSize : [100, 100], zoomSize : [509, 450] //zoomSize : [288, 250] }); }); /*Inizializzazione Slideshow Gallery*/ $('.flexslider').flexslider({ animation: "slide" }); /*Inizializzazione Slideshow Gallery*/ });