function newsListAddMore(l) { var $l = l || $("#news-list li div"); $l.each(function(i, e) { var $e = $(e); $e.css("z-index", 1); if (e.offsetHeight < e.scrollHeight) { $e.parent().children("span.more").show(); } }); } if (window.lightbox) { lightbox.option({ 'resizeDuration': 200, 'albumLabel': 'Immagine %1 di %2' }) } $(document).ready(function() { $(".auto-submit").change(function() { $(this).parents("form").submit(); }); $("input.auto-sum").attr("readonly", true); $("input#auto-tot").attr("readonly", true); $("input.auto-add").keyup(function(e) { id = this.id.substr(0, this.id.indexOf(":")); doAutoSum(id); }); $(".buying_option_1_quantity").each(function() { id = this.id.substr(0, this.id.indexOf(":")); showBuyingOptionUnit(id, $(this).val()); }); doAutoTot(); var dates = []; $("#picking_up_on\\:date").datepicker({ buttonText: '...', showOn: 'button', minDate: null, maxDate: null, beforeShowDay: function(date) { return [dates.indexOf(dateToIso(date)) > -1, ""]; } }); $("#capcha").s3Capcha(); $("a.bookmark").click(function(ev){ var bookmarkUrl = this.href; var bookmarkTitle = this.title; if (window.sidebar) { // For Mozilla Firefox Bookmark window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,""); } else if (document.all) { // For IE Favorite window.external.AddFavorite(bookmarkUrl, bookmarkTitle); } else { alert('Per aggiungere questo sito ai preferiti premi CTRL+D.'); } return false; }); $("input.button.go").click(function() { var c = $(this).attr("class"); var go = c.substr(3 + c.indexOf("go")); window.location = go; }); if ($(".error").length) { if ($(".error:first").closest("tr").offset()) { $("html, body").animate({ scrollTop: $(".error:first").closest("tr").offset().top }, "fast"); } $("input.error:first").focus(); } /* var h = 0; $("#rectangles .rect .inner").each(function(i, e) { $e = $(e); if ($e.height() > h) h = $e.height(); }); $("#rectangles .rect .inner").height(h); */ if ($.fn.nivoSlider) { $('#slider').nivoSlider(); } $("#map").hide(); $("a.map.toggle").click(function() { $("#map").toggle(); return false; }); $("input.num").keydown(function(evt) { if ( evt.keyCode == 46 || evt.keyCode == 8 || evt.keyCode == 9 || evt.keyCode == 27 || evt.keyCode == 13 // Allow backspace, delete, tab, escape, and enter || (evt.keyCode == 65 && evt.ctrlKey === true) // Ctrl + A || (evt.keyCode >= 35 && evt.keyCode <= 39)) // Home, end, left, right { return; } else if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 ) && event.keyCode != 190) { // Ensure that it is a number or a dot and stop the keypress event.preventDefault(); } }); $("a.more.news").click(function() { var s = 400; var a = $(this); var c = a.attr("class"); var i = parseInt(c.substring(c.lastIndexOf(" "))); var ul = $("ul#more-news-" + i); ul.load(this.href, function() { $('html, body').animate({ scrollTop:a.position().top }, s); ul.slideDown(s); a.hide(); $("a.more.news." + (1 + i)).show(); newsListAddMore($("ul#more-news-" + i + " li div")); }); return false; }); $.fn.cycle && $(".ticker").cycle({easing:"easeInOutBack", fx:"scrollRight",timeout:5000}); $.fn.slick && $(".slick-gallery").slick({ infinite: true, speed: 300, slidesToShow: 3, centerMode: true, variableWidth: true, autoplay: true, autoplaySpeed: 3000 }); newsListAddMore(); });