function checkCV() { var k = [ "birth-date", "surname", "name", "birth-place", "status", "town", "street", "available", "education", "additional", "languages", "licence", "expirience"], good = true; $('[name]').removeClass('error'); if (/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($('[name="email"]').val()) == false) { $('[name="email"]').addClass('error'); good = false; } if ($('[name="phone"]').val().replace(/[^\d]/, '').length < 9) { $('[name="phone"]').addClass('error'); good = false; } if ( /^[\d]{2}-[\d]{3}$/.test( $('[name="zip-code"]').val() ) == false ){ $('[name="zip-code"]').addClass('error'); good = false; } for (var i = 0; i < k.length; i++) { var obj = $('[name="' + k[i] + '"]'); if (obj.val().length <= 1) { good = false; obj.addClass('error'); } } if (good) { return true; } else { return false; } } $(document).ready(function(){ $('#menucaller').click(function(e){ $('#mobilemenu').toggleClass("on"); }); $('#cv-expand').on('click', function(evt){ evt.preventDefault(); $('.cv-box').show(300); $(this).fadeOut(300); $('body, html').animate({ scrollTop: $('#cv-form').offset().top }, 1000); }); $('#cv-form').on('submit', function(evt) { if ( checkCV() ){ return true; } else { evt.preventDefault(); return false; } }); if ( location.hash === '#zloz-cv' ){ $('#cv-expand').click(); $('html, body').animate({ scrollTop: $('.cv-box').offset().top }, 0); } $('#contactFormSend').on('submit', function(evt){ evt.preventDefault(); $('.ajaxInfo').hide(); $('[name]').removeClass('error'); var k = [ 'name', 'question' ], good = true; if ( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test( $('[name="mail"]').val() ) == false ){ $('[name="mail"]').addClass('error'); good = false; } if ( $('[name="phone"]').val().replace(/[^\d]/, '').length < 9 ){ $('[name="phone"]').addClass('error'); good = false; } for ( var i = 0; i < k.length; i++ ){ var obj = $('[name="'+ k[i] +'"]'); if ( obj.val().length <= 1 ){ good = false; obj.addClass('error'); } } if ( good ){ $.post( $(this).attr('action'), $(this).serialize(), function(response){ if (response.indexOf('false') === -1) { $('input, textarea').val(''); $('p.ajaxInfo.ok').show(); } else { $('p.ajaxInfo.error_send').show(); } }); } else { $('p.ajaxInfo.error').show(); } }); // Zabiegaj linkom # $('a[href=#]').click(function(e){ e.preventDefault(); }); $('#checkpoint form').prepend('
'); $('#cardCheckForm').submit(function(evt){ evt.preventDefault(); var cardId = $('#cardCheckForm [name="cardid"]').val(); var fx = ''; $.ajax({ type: "POST", url: "ajax/readCard.php", cache: false, data: { cardId: cardId }, success: function(resp){ if ( resp.indexOf(':') != -1 ){ var ret = resp.split(':'); switch ( ret[0] ){ case 'err': switch ( ret[1] ){ case 'wrongid': // nieprawidłowy format kodu fx = 'nieprawidłowy format kodu'; break; case 'emptystring': // kod jest pusty fx = 'kod jest pusty'; break; case 'nocard': // numer nie został wprowadzony do systemu fx = 'numer nie został wprowadzony do systemu'; break; default: // nieoczekiwany błąd fx = 'nieoczekiwany błąd'; break; } break; case 'ok': fx = 'na karcie masz: '+ ret[1] +' punktów, a wszystkich: '+ ret[2]; break; default: fx = 'nieprawidłowa odpowiedź serwera'; break; } $('#checkpoint form').fadeOut(500, function(){ $('#checkpoint #result').html(fx).fadeIn(); }); } } }); }); ///////////////////////////////////////////////////////////////// // BACKSTRETCH SLIDER (UNCOMMENT TO USE) ///////////////////////////////////////////////////////////////// /*$("body").backstretch([ "img-1.jpg", "img-2.jpg", "img-3.jpg" ], {duration: 3000, fade: 750, random: true});*/ ///////////////////////////////////////////////////////////////// // CAMERA SLIDER ///////////////////////////////////////////////////////////////// if ($('.camera_slider').length > 0) { jQuery('.camera_slider').camera({ fx: 'random', playPause: false, pagination: false, height: '450', random: false }); } ///////////////////////////////////////////////////////////////// // Fancybox ///////////////////////////////////////////////////////////////// $("a.fancybox").fancybox({ openEffect : 'elastic', openSpeed : 500, closeEffect : 'elastic', closeSpeed : 250, closeClick : true, helpers : { title: { type: 'inside' } } }); }); $(window).load(function(){ $('.start-top .bg').addClass("on"); $('#start-places-slider').owlCarousel({ items: 3 }); $('.owl_camera_slider').owlCarousel({ items: 1, singleItem: true, lazyLoad : true, navigation : true, autoPlay: 3000 }); $('.shop-category-carousel').owlCarousel({ lazyLoad : true, navigation : true, autoPlay: 3000 }); //$('.preload').removeClass("preload"); $('.preload').fadeOut(1500, function(){ $(this).remove(); }); });