var section ;
var factor = 0.8;
var fontSizeStep = 3;
function getFontSize(el)
{
var fs = $(el).css('font-size');
if(!el.originalFontSize)el.originalFontSize =fs; //set dynamic property for later reset
return parseFloat(fs);
}
function setFontSize(fact){
if(section==null)
section = $('body').find('*')
.filter(
function(){return $(this).clone()
.children()
.remove()
.end()
.text().trim().length > 0;
}); //filter -> exclude all elements without text
section.each(function(){
var newsize = fact ? getFontSize(this) * fact : this.originalFontSize;
if(newsize) $(this).css('font-size', newsize );
});
if( fontSizeStep >= 4 ) {
$(".col-sm-8, .col-sm-4").addClass("force-col-12");
} else {
$(".force-col-12").removeClass("force-col-12");
}
localStorage.setItem("accessFontsize", fact);
}
function resetFont(){
setFontSize();
}
function increaseFont() {
fontSizeStep++;
if( fontSizeStep > 5 ) {
fontSizeStep = 5;
}
setFontSize(1 / factor);
}
function decreaseFont(){
fontSizeStep--;
if( fontSizeStep < 1 ) {
fontSizeStep = 1;
}
setFontSize(factor);
}
function setAccess( act ) {
//console.log("Activating " + act);
localStorage.setItem("accessSet", act);
if( $('.accessCss').length == 0 ) {
$('head').append('');
}
var path = __URL__ + 'tpl/page/css/access/';
if( act == 'zoomInText' ) {
increaseFont();
} else if( act == 'zoomOutText' ) {
decreaseFont();
} else if( act == 'contrast') {
$('.accessCss').attr("href", path + 'contrast.css');
} else if( act == 'negative') {
$('.accessCss').attr("href", path + 'negative.css');
} else if( act == 'reset' ) {
resetFont();
$('.accessCss').remove();
}
}
$(function () {
$(".accessibility-widget .caller").on("click", function(e){
e.preventDefault();
$(".accessibility-widget").toggleClass("on");
});
$(".accessibility-widget .close-btn").on("click", function(e){
e.preventDefault();
$(".accessibility-widget").removeClass("on");
});
if (localStorage.getItem("accessSet") === null) {
localStorage.setItem("accessSet", "");
}
if (localStorage.getItem("accessFontsize") === null) {
localStorage.setItem("accessFontsize", "");
}
$('.access-set').click(function(e){
e.preventDefault();
var act = $(this).attr("data-what");
setAccess( act );
});
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,
dots: true,
autoplay: true,
autoplaySpeed: 3500,
loop : true,
nav: true,
navText: ['‹','›']
}).addClass("owl-carousel").addClass("owl-theme");
var c = 0;
var nCode = '';
$(".offer-header a").each(function(e){
var $parDiv = $(this).parent();
nCode += $parDiv.html();
$parDiv.remove();
});
wrCode = '' + nCode + '
';
$('.offer-header .sub-offer-button').remove();
$('.offer-header').append(wrCode);
setTimeout(function(e){
$('.offer-nav a[href="' + top.location.href + '"]').addClass("on");
},100);
});
$(function () {
$('.slider .slide').click(function(e){
var _url = $(this).find("a").attr("href");
top.location.href = _url;
});
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();
}
});
var $form2 = $('#form-woda, #form-odpady');
$form2.on('submit', function(evt){
var good = $form2.validateInputs();
evt.preventDefault();
$form2.find('p.ajaxInfo').hide();
if (good){
$.post( $form2.attr('action'), $form2.serialize(), (function(response){
if (response.indexOf('false') === -1) {
$form2.find('input, textarea').val('');
$form2.find('p.ajaxInfo.ok').show();
} else {
$form2.find('p.ajaxInfo.error_send').show();
}
}).bind(this));
} else {
$form2.find('p.ajaxInfo.error').show();
}
});
});
$(document).on('click', '.mobile-nav-toggle', function(evt){
evt.preventDefault();
evt.stopPropagation();
$('.menu').toggleClass('show');
});
$(document).ready(function(){
dt = localStorage.getItem("accessSet");
if( dt != '' ) {
setAccess( dt );
}
dt = localStorage.getItem("accessFontsize");
if( dt != '' ) {
setFontSize( dt );
}
});