// ACTIVITY INDICATOR $(function () { var imageLightBoxItems = { count: 0, byIndex: {}, byHref: {}, }; var activityIndicatorOn = function(){ $('
').appendTo('body'); }, activityIndicatorOff = function(){ $('#imagelightbox-loading').remove(); }, // OVERLAY overlayOn = function(){ $('
').appendTo('body'); }, overlayOff = function(){ $('#imagelightbox-overlay').remove(); }, // CLOSE BUTTON closeButtonOn = function(instance){ $('').appendTo('body').on('click touchend', function() { $(this).remove(); instance.quitImageLightbox(); return false; }); }, closeButtonOff = function(){ $('#imagelightbox-close').remove(); }, // CAPTION captionOn = function(){ var description = $('a[href="' + $('#imagelightbox').attr('src') + '"] img').attr('alt'); if (description != '' && description != undefined) $('
' + description + '
').appendTo('body'); }, captionOff = function(){ $('#imagelightbox-caption').remove(); }, // NAVIGATION navigationOn = function(instance, selector){ var images = $(selector); if (images.length) { var nav = $('
'); for (var i = 0; i < images.length; i++) nav.append(''); nav.appendTo('body'); nav.on('click touchend', function() { return false; }); var navItems = nav.find('button'); navItems.on('click touchend', function() { var $this = $(this); if (images.eq($this.index()).attr('href') != $('#imagelightbox').attr('src')) instance.switchImageLightbox($this.index()); navItems.removeClass('active'); navItems.eq($this.index()).addClass('active'); return false; }) .on('touchend', function() { return false; }); } }, navigationUpdate = function(selector) { var items = $('#imagelightbox-nav button'); items.removeClass('active'); items.eq($(selector).filter('[href="' + $('#imagelightbox').attr('src') + '"]').index(selector)).addClass('active'); }, navigationOff = function(){ $('#imagelightbox-nav').remove(); }, // ARROWS arrowsOn = function (instance, selector) { var $arrows = $(''); $arrows.appendTo('body'); $arrows.on('click touchend', function (e) { var $this = $(this); var index = imageLightBoxItems.byHref[$('#imagelightbox').attr('src')]; e.preventDefault(); if (typeof index === 'undefined') { return false; } if ($this.hasClass('imagelightbox-arrow-left')) { index = index - 1; if (typeof imageLightBoxItems.byIndex[index] === 'undefined') { index = imageLightBoxItems.count - 1; } } else { index = index + 1; if (typeof imageLightBoxItems.byIndex[index] === 'undefined') { index = 0; } } instance.switchImageLightbox(index); return false; }); }, arrowsOff = function() { $('.imagelightbox-arrow').remove(); }; var imageLighBoxSelector = 'a.fancybox', imageLightboxInstance = $(imageLighBoxSelector).imageLightbox({ onStart: function() { overlayOn(); closeButtonOn( imageLightboxInstance ); arrowsOn( imageLightboxInstance, imageLighBoxSelector ); }, onEnd: function() { overlayOff(); captionOff(); closeButtonOff(); arrowsOff(); activityIndicatorOff(); }, onLoadStart: function() { captionOff(); activityIndicatorOn(); }, onLoadEnd: function() { captionOn(); activityIndicatorOff(); $( '.imagelightbox-arrow' ).css( 'display', 'block' ); } }); $(imageLighBoxSelector).each(function (index) { imageLightBoxItems.byHref[$(this).attr('href')] = index; imageLightBoxItems.byIndex[index] = $(this).attr('href'); imageLightBoxItems.count += 1; }); }); function validatenip(nip) { var nip_bez_kresek = String(nip).replace(/-/g, ""); var reg = /^[0-9]{10}$/; if (reg.test(nip_bez_kresek) == false) { return false; } else { var dig = ("" + nip_bez_kresek).split(""); var kontrola = (6 * parseInt(dig[0]) + 5 * parseInt(dig[1]) + 7 * parseInt(dig[2]) + 2 * parseInt(dig[3]) + 3 * parseInt(dig[4]) + 4 * parseInt(dig[5]) + 5 * parseInt(dig[6]) + 6 * parseInt(dig[7]) + 7 * parseInt(dig[8])) % 11; if (parseInt(dig[9]) == kontrola) { return true; } else { return false; } } } function formatToNumber(inp) { return +(String(inp).replace(/\s+/g, '').replace(',', '.')); } function formatToPrice(inp) { return formatToNumber(inp).toFixed(2) + ' zł'; } $(document).ready(function(){ $('.slider').owlCarousel({ items: 1, nav: false, dots: false, autoplay: false, autoplaySpeed: 2000, loop : false, touchDrag: false, mouseDrag: false, }).addClass("owl-carousel").addClass("owl-theme");; $('.offerSlider').owlCarousel({ items: 1, nav: false, dots: true, autoplay: false, autoplaySpeed: 2000, loop : false }).addClass("owl-carousel").addClass("owl-theme");; }); $(function () { var $form = $('#contactFormSend'); $form.on('submit', function(evt){ var good = $form.validateInputs(); evt.preventDefault(); $form.find('p.ajaxInfo').hide(); if (good){ $.post( $form.attr('action'), $form.serialize(), (function(response){ if (response.indexOf('false') === -1) { $form.find('input, textarea').val(''); $form.find('p.ajaxInfo.ok').show(); } else { $form.find('p.ajaxInfo.error_send').show(); } }).bind(this)); } else { $form.find('p.ajaxInfo.error').show(); } }); }); $(".scrollTop").on( "click", function(event) { event.preventDefault(); $('html, body').animate({scrollTop: 0}, 800); });