var mobile = function detectmob(){
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else {
return false;
}
}();
var lockSend = false;
var music;
$(window).load(function () {
$("html").addClass("loaded");
setTimeout(function () {
$(".preloader").remove();
}, 1500);
});
$(document).ready(function () {
var href = window.location.href;
if ( href.length > 0 ) {
console.log(slug);
var slug = href.split( /\/pl\/|\/de\/|\/en\/|\/ru\//)[1];
if ( slug != undefined ) {
var slug2 = slug.split( '/' )[1];
if ( slug2 != undefined ) {
var slug3 = slug2.split( '.html' );
if ( slug3 != undefined ) {
$( 'body' ).addClass( slug3[0] );
}
}
}
}
// aquascreen
var as_link;
var as_txt;
if ( $('body').hasClass('langpl') ) {
as_link = 'broszura_pl';
as_txt = 'pobierz ulotkę informacyjną';
} else if ( $('body').hasClass('langen') ) {
as_link = 'broszura_eng';
as_txt = 'download the leaflet';
} else if ( $('body').hasClass('langde') ) {
as_link = 'broszura_de';
as_txt = 'flyer herunterladen';
} else {
as_link = 'broszura_ros';
as_txt = 'скачать флаер';
}
if ( $('.introIn h1').text() === 'aquascreen' ) {
$('.intro p:first-of-type').append('' + as_txt + '');
}
// polimery
$(".polimery").click(function (event) {
$(".cbPopup.cbPolimery").addClass("shown");
$(".newsletterOverlay").removeClass("hide");
$("html").addClass("popupOpened");
event.preventDefault();
});
$(".cbPopup.cbPolimery").append('
');
$(".cbPopup.cbPolimery .cbPopupBottom").niceScroll({
mousescrollstep: 20,
cursorborder: 0,
cursorborderradius: 0,
cursorcolor: "#909090",
background: "#ddd",
cursoropacitymin: 1,
cursoropacitymax: 1,
autohidemode: false
});
$(".cbPopup.cbPolimery .cbPopupClose").click(function (event) {
$(this).parent(".cbPopup").removeClass("shown");
$(".newsletterOverlay").addClass("hide");
$("html").removeClass("popupOpened");
event.preventDefault();
});
// popup
$('.cbPopup:not(.cbPolimery) .cbPopupTop').each(function(){
var src = $(this).children('img').attr('src');
$(this).css({
'background':'url('+src+') center top no-repeat',
'background-size':'cover'
});
$(this).children('img').remove();
});
if(mobile){
$('.logistykaBlock').prependTo('.contactLeft');
$('.dirButton').remove();
}else{
$('.dirButton2').remove();
}
$("#form-newsletter").submit(function () {
$(".news_komunikat").hide();
$(".news_komunikat_agree").hide();
var hasError = false;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var checkbox = $(this).find(".agree input").prop('checked');
var emailaddressVal = $(this).find("#form_email").val();
console.log(checkbox);
if (checkbox == false){
$(this).siblings(".news_komunikat_agree").fadeIn().html('Zaznacz pole zgód.');
hasError = true;
}
if (emailaddressVal == '') {
$(this).siblings(".news_komunikat").fadeIn().html('Укажите ваш электронный адрес');
hasError = true;
}
else if (!emailReg.test(emailaddressVal)) {
$(this).siblings(".news_komunikat").fadeIn().html('Проверьте ваш электронный адрес');
hasError = true;
}
var form = $(this);
if (hasError == false) {
$.ajax({
type: this.method,
url: this.action,
data: $(this).serialize(),
success: function (data) {
form.fadeOut();
form.siblings(".news_komunikat").fadeIn().html(data);
},
error: function (data) {
console.log(data);
form.show();
form.siblings(".news_komunikat").fadeIn().html(data);
}
});
}
return false;
});
$('body').find('*').not('script').contents().filter(function () {
return this.nodeType === 3;
}).each(function () {
var newTxt = $(this).text().replace("Plastica Sp. z o.o.", "Plastica Sp. z o.o.");
newTxt = newTxt.replace("Plastica Sp. z o. o.", "Plastica Sp. z o. o.");
newTxt = newTxt.replace("TZMO SA", "TZMO SA");
newTxt = newTxt.replace(/ ([wzoiau]{1}|aby) /ig, ' $1 ');//ipad problem
$(this).replaceWith(newTxt);
});
$('.siteMapItem a:contains("B+R")').each(function(){
var txt = $(this).text();
txt = txt.replace("B+R", 'B+R');
$(this).html(txt);
});
var wHeight = $(window).height();
var wWidth = $(window).width();
// minigaleria
/*$('.newsContent .tinyContent img').each(function(){
var u = $(this).attr('src');
$(this).wrap('');
$(this).attr({
'src':u.replace('aktualnosci','aktualnosci_thumb'),
'width':'',
'height':''
});
});*/
$('.tinyContent a[href]').filter(function() {
return /(.jpg|.gif|.png)$/.test($(this).attr('href'))
}).attr('data-gallery', '');
// formatowanie tekstu
$(".halfPic .hpIn h2, .halfPic .hpIn h2 *").replaceText(/\b \b/gi, "");
// ie detect
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE");
if ($.browser.msie) {
$(".body").addClass("ie");
}
// formularz kontaktowy
$('.contactRight form').submit(function () {
if (lockSend)
return false;
var ok = true;
var checkbox_contact = $(this).find("#agree_form").prop('checked');
if ($('#form_name').val() == '' || $('#form_name').val().length < 5) {
$('#form_name').addClass('error');
ok = false;
} else {
$('#form_name').removeClass('error');
}
if (checkbox_contact == false){
$('#agree_form').addClass('error');
ok = false;
} else {
$('#agree_form').removeClass('error');
}
if (!validateEmail($('#form_email').val())) {
$('#form_email').addClass('error');
ok = false;
} else {
$('#form_email').removeClass('error');
}
if ($('#form_content').val().length < 10) {
$('#form_content').addClass('error');
ok = false;
} else {
$('#form_content').removeClass('error');
}
if (ok) {
lockSend = true;
$('.contactSubmit').val('Отправка');
$.ajax({
type: "POST",
url: "ajax.php",
data: {
akcja: 'kontakt',
name: $('#form_name').val(),
email: $('#form_email').val(),
phone: $('#form_phone').val(),
subject: $('#form_subject').val(),
content: $('#form_content').val(),
captcha: $('#form_captcha').val(),
},
success: function (data) {
lockSend = false;
if (data.wynik == 'OK') {
$('.contactRight form').remove();
$('.contactRight p').after('
Пролистать вниз').appendTo(".intro");
} else {
$(".sProd .intro").css("height", $(window).height() - 83 + "px");
$('
Пролистать вниз').appendTo(".intro");
$("#dots").hide();
}
$(".scrollDown").live('click', function () {
console.log("ads");
$("html, body").animate({
scrollTop: $(".row:first-child").next().offset().top
}, 2000, function () {
$("body").off("mousewheel");
});
return false;
});
$(".sProd .row").each(function (index) {
if (index == 0) {
} else {
if ($(this).find(".display > div").hasClass("halfPic")) {
if ($(this).find(".display > div.halfPic .halfPicLeft img").length > 0) {
$(this).find(".display > div").prepend('');
} else {
$(this).find(".display > div").prepend('');
}
} else if ($(this).find(".cbPopup").length > 0) {
} else {
if ($(this).find(".colorPic").length > 0) {
$(this).find(".colorPicText").prepend('');
} else {
$(this).find(".display > div").prepend('');
}
}
}
});
$(".num").each(function (index) {
$(this).text("").text(index + 1);
});
$(".cbPopup:not(.cbPolimery)").append('
');
$(".cbPopupBottom").niceScroll({
mousescrollstep: 20,
cursorborder: 0,
cursorborderradius: 0,
cursorcolor: "#909090",
background: "#ddd",
cursoropacitymin: 1,
cursoropacitymax: 1,
autohidemode: false
});
$('.newsletterOverlay, .cbPopupTop').bind('mousewheel DOMMouseScroll', function (event) {
var delta = event.originalEvent.wheelDelta || event.originalEvent.detail;
$('.cbPopup.shown .cbPopupBottom').getNiceScroll().doScrollPos(0, $('.cbPopup.shown .cbPopupBottom').scrollTop() - delta);
});
if (wWidth <= 768 || wHeight <= 800) {
setTimeout(function () {
$(".cbPopupBottom").css({
'height': $(window).height() / 2 - 60 + "px"
});
$("#ascrail2001").css({
"top": $(".cbPopupTop").height() + $(".cbPopup").css("top")
});
}, 500);
}
$('.newsletterOverlay').click(function () {
$(".cbPopup.shown .cbPopupClose").click();
});
$(".halfMore").click(function (event) {
$(this).closest(".row").next(".row").find(".cbPopup").addClass("shown");
$(".newsletterOverlay").removeClass("hide");
$("html").addClass("popupOpened");
event.preventDefault();
});
$(".cbPopupClose").click(function (event) {
$(this).parent(".cbPopup").removeClass("shown");
$(".newsletterOverlay").addClass("hide");
$("html").removeClass("popupOpened");
event.preventDefault();
});
$(".halfPic h2 a").click(function (event) {
$(this).closest(".hpIn").find(".halfMore").trigger("click");
$("html").addClass("popupOpened");
event.preventDefault();
});
}
// mobile
$(".mobMenu").click(function (event) {
if ($("body").hasClass("mobActive")) {
$("body").removeClass("mobActive");
} else {
$("body").addClass("mobActive");
}
event.preventDefault();
});
$(".slideOverlay").click(function () {
$("body").removeClass("mobActive");
});
$(".slideMenu").niceScroll({
mousescrollstep: 60,
cursoropacitymax: 0
});
// inne
if ($(".subShortIn").html() == "") {
$(".subShortTxt").addClass("newsSubShort");
}
if ($(".docContent").length > 0) {
$(".subShortIn").html("");
$(".subShortTxt").addClass("newsSubShort");
}
// kariera
if (
$(".soLeft > h1 span:contains('dołącz do nas')").length > 0 ||
$(".soLeft > h1 span:contains('dołącz do nas')").length > 0
) {
$("body").addClass("firstOffer");
}
// muzyczka
if ($(".homeContent").length > 0 && wWidth > 1024) {
music = new buzz.sound("music/preview.mp3", {
preload: true,
autoplay: false,
loop: true,
volume: 3
});
setTimeout(function () {
music.fadeTo(25, 10000).play();
}, 1);
$(".musicToggle").toggle(function () {
music.pause();
}, function () {
music.play();
});
} else {
$(".musicToggle").remove();
}
if (wHeight <= 768 && $(".sProd").length > 0) {
$("#dots").hide();
}
// praca
var ostCount = parseInt($(".ostCount").text());
$(".ostCount").text(ostCount - 1);
// kontakt select
$('.dzial-select').on( 'click tap', function() {
$('.clientServList').toggleClass('shown');
});
$('.clientServList li').on( 'click tap', function() {
$(".dzial-select option[value='" + $(this).attr('data-select') + "']").attr('selected', 'selected').siblings().removeAttr('selected');
$('.clientServList').toggleClass('shown');
console.log($(this).attr('data-select'));
});
});
$(window).load(function () {
// lista dokumentów
var $container = $('#docList');
$container.imagesLoaded(function () {
$container.masonry({
itemSelector: '.item'
});
});
$("#docList .item").each(function (index) {
$(this).css("z-index", index);
});
});
function homeAnim() {
setTimeout(function () {
$(".cb1").addClass("shown");
}, 1500);
setTimeout(function () {
$(".kDots, .linesBold").addClass("shown firstAnim");
}, 2000);
setTimeout(function () {
$(".kDots").removeClass("firstAnim");
}, 6000);
setTimeout(function () {
$(".kDots").addClass('pulseAnim');
}, 8000);
setTimeout(function () {
$(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9").addClass("shown");
}, 3000);
setTimeout(function () {
$(".circlesSmall, .shadow").addClass("shown");
}, 5000);
setTimeout(function () {
$(".linesNormal").addClass("shown");
}, 5500);
setTimeout(function () {
$("#top, #footer").addClass("shown");
}, 5500);
setTimeout(function () {
$("li.cb1 span").addClass("shown");
}, 7500);
$(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9, .cs9").hover(function () {
$(this).css({
"transition-delay": '0',
"transform": "scale(1.1)",
"transition": "all 300ms ease"
});
}, function () {
$(this).css({"transform": ''});
});
}
function mobCircles() {
setTimeout(function () {
$(".cb1").addClass("shown");
}, 0);
setTimeout(function () {
$(".kDots, .linesBold").addClass("shown firstAnim");
}, 0);
setTimeout(function () {
$(".kDots").removeClass("firstAnim");
}, 0);
setTimeout(function () {
$(".kDots").addClass('pulseAnim');
}, 0);
setTimeout(function () {
$(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9").addClass("shown");
}, 0);
setTimeout(function () {
$(".linesNormal").addClass("shown");
}, 7000);
setTimeout(function () {
$("#top, #footer, li.cb1 span").addClass("shown");
}, 0);
$(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cs9, .cb9").hover(function () {
$(this).css({
"transition-delay": '0',
"transform": "scale(1.1)",
"transition": "all 300ms ease"
});
}, function () {
$(this).css({"transform": ''});
});
}
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}