;/*flyitems.js*/ /**//*!* Function: flyToElement* Author: CodexWorld* Author URI: http://www.codexworld.com* Author Email: contact@codexworld.com* Description: This function is used for adding flying effect to the element.*/function flyToElement(flyer, flyingTo) {try{var $func = $(this);var divider = 3;var flyerClone = $(flyer).clone();$(flyerClone).css({ position: 'absolute', top: $(flyer).offset().top + "px", left: $(flyer).offset().left + "px", opacity: 1, 'z-index': 1000 });$('body').append($(flyerClone));var gotoX = $(flyingTo).offset().left + ($(flyingTo).width() / 2) - ($(flyer).width()/divider)/2;var gotoY = $(flyingTo).offset().top + ($(flyingTo).height() / 2) - ($(flyer).height()/divider)/2;$(flyerClone).animate({opacity: 0.4,left: gotoX,top: gotoY,width: $(flyer).width()/divider,height: $(flyer).height()/divider}, 700,function () {$(flyingTo).fadeOut('fast', function () {$(flyingTo).fadeIn('fast', function () {$(flyerClone).fadeOut('fast', function () {$(flyerClone).remove();});});});});}catch(e){console.log('Failed to execute flyToElement function, flyer: ',flyer,' flyingTo: ',flyingTo);}}/**/
;/*bubble.js*/ /**/var run = 0;function showFalg(){if ($('#checkout').length){return;}if (run !== 1) {run = 1;$("#basket-flag").fadeIn().fadeOut().fadeIn().fadeOut().fadeIn().fadeOut().fadeIn();run = 0;}}$(window).ready(function () {$('#basket-flag-close').click(function () {$('#basket-flag').hide();});});/**/
;/*productinfo.js*/ /**/$('.seeMore').click(function(){$("html, body").animate({ scrollTop: $(window).scrollTop() + $(window).height()}, 600);return false;});$(window).scroll(function() {var scroll = $(window).scrollTop();var footer = ($("#brands").position() || { top: 0 }).top-600;if ($(document).width() > 950) {if (scroll <= footer) {$(".seeMore").fadeIn();}if (scroll >= footer) {$(".seeMore").fadeOut();}}});function loadReplacements(){console.log('Log: loading replacements',document.getElementById('replacements'));/**//**/$('#replacements').load('/ajax.php?module=ProductListing&action=parts&pid='+'223181');/**//**/}function loadParts(){console.log('Log: loading parts',document.getElementById('partsoffer'));$('#partsoffer').load('/ajax.php?module=ProductListing&action=parts&apid=223181');}function loadCompressorsOffer(){console.log('Log: loading compressorsoffer',document.getElementById('compressorsoffer'));/**/}(function (){/**/var pid = '223181';var cid = '0';var target_ele = $('#captcha_module');target_ele.html('');console.log('Log: getting captcha');$.getJSON('/ajax.php?module=Captcha&action=getForm&pid='+pid+'&cid='+cid,{ },function(result){console.log('Log: got captcha');target_ele.html(result.datas);loadReplacements();loadParts();loadCompressorsOffer();});/**/})();/**/
;/*cart.js*/ /**/function increaseCartAmount(self) {var input = $(self).closest('.cartamountparent').find('.cartModify');input.val(parseInt(input.val()) + 1);input.trigger('change');}function decreaseCartAmount(self) {var parent = $(self).closest('.cartamountparent');var input = parent.find('.cartModify');var remove = parent.find('.remove_button');if (parseInt(input.val()) === 0) {return;}input.val(parseInt(input.val()) - 1);if (input.val() >= 0) {input.trigger('change');} else {remove.trigger('click');}}function bindCartEvents() {/* modify cart js */$('.mainToCart').unbind('click').bind('click', function mainToCartKosarbahelyezes() {var ele = $('.mainToCartValue');var current = parseInt(ele.attr('data-current'));var val = parseInt(ele.val());sendCartModification($(this).data('pid'), val, 1);});$('.toCart').unbind('click').bind('click', function () {addToCart(this);});$('.toCartInc').unbind('click').bind('click', function () {addToCartIncremental(this);});$('.set_minus').unbind('click').bind('click', function () {decreaseCartAmount(this);return false;});$('.set_plus').unbind('click').bind('click', function () {increaseCartAmount(this);return false;});$('.cartModify').unbind('change').bind('change', function () {modifyCart(this);});$('.remove_button').unbind('click').bind('click', function () {if ($('.productstr').length > 1 || confirm('Are you sure you want to clear your basket and return to the search page?')) {this.parentNode.parentNode.remove();removeFromCart(this);}return false;});$('#cart').unbind('click').bind('click', function () {if ($('#cartBox').is(':visible')) {$('#cartBox').fadeOut();} else {$(".buyAndCart").fadeOut();positionLoginBox();$('#carBox').fadeOut();$('#countryBox').fadeOut();$('#countryBox').fadeOut();$('#cartBox').fadeIn();}});}function addToCart(self) {sendCartModification($(self).data('pid'), 1, $(self).data('cid'));}function addToCartIncremental(self) {sendCartModification($(self).data('pid'), 1, 1);}function removeFromCart(self) {sendCartModification($(self).data('pid'), 0);}function modifyCart(self) {console.log('Log: modifyCart()');if (self.value < 0) {$(self).val(self.defaultValue);return;}sendCartModification($(self).data('pid'), $(self).val());}function sendCartModification(pid, amo, inc) {console.log('Log: sendCartModification(' + pid + ',' + amo + ',' + inc + ')');var request = $.ajax({url: '/ajax.php?module=Cart', type: "POST", data: {pid: pid, amo: amo, inc: inc, shipment: $('[name=shipment]:checked').val(), payment: $('[name=payment]:checked').val()}});request.success(function (data, textStatus, jqXHR) {var _data = JSON.parse(data);if (_data.status) {/*console.log('Log: sendCartModification->',_data.datas);*/$('#cartBox').html(_data.datas.CartBox);$('#cartBoxOpen').addClass('has');$('.mainToCartValue').attr('data-current', _data.datas[pid]);$('#modal .modal-body').html(_data.datas.cartNotification);if (_data.datas.cartNotification){$('#modal').modal();setTimeout(function () {flyToElement($("#cartnotification").find('img'), $('#cart'));$('#modal').modal('hide');}, 1500);}if (typeof loadReplacements === 'function') {loadReplacements();}if (typeof loadPartsOffer === 'function') {loadPartsOffer();}$('#cart').replaceWith(_data.datas.cart);if (_data.datas.cartAmount > 0){showFalg();}else {$('#basket-flag').hide();}basketLoadScroll();if (typeof window.checkoutObj !== 'undefined') {window.checkoutObj.reloadChain();}bindCartEvents();if (!document.URL.includes("checkout")) {} else if (!$('.productstr').length) {document.location.href = "/";}}});return false;}bindCartEvents();/**/
;/*header.js*/ /**/function urlSanitizeText(input){return input.toLowerCase().replace(/\(|\)/gi,'').replace(/\s|-/gi,'-').replace(/-+/gi,'-');}function onlyUnique(value, index, self) {return self.indexOf(value) === index;}function compareLowerFirst(strA, strB){try {var a = strA[0];var b = strB[0];var _debug = false;if ((isNaN(a)&&!isNaN(b)) || (!isNaN(a)&&isNaN(b))){if(_debug) console.log('1 '+a+' '+(isNaN(a) ? '<' : '>')+' '+b);return isNaN(a) ? -1 : 1;} else if ((a.toLowerCase()===a&&b.toLowerCase()!==b) || (a.toLowerCase()!==a&&b.toLowerCase()===b)){if(_debug) console.log('2 '+a+' '+(a.toLowerCase()===a ? '<' : '>')+' '+b);return a.toLowerCase()===a ? -1 : 1;} else if (strA > strB) {if(_debug) console.log('3 '+a+' > '+b);return 1;} else if (strA < strB) {if(_debug) console.log('4 '+a+' < '+b);return -1;} else {if(_debug) console.log('5 '+a+' = '+b);return 0;}} catch(err){console.error(err);return -1;}}var divs = $('.fade');function fade() {var current = $('.current');var currentIndex = divs.index(current),nextIndex = currentIndex + 1;if (nextIndex >= divs.length) {nextIndex = 0;}var next = divs.eq(nextIndex);next.stop().fadeIn(1000, function() {$(this).addClass('current');});current.stop().fadeOut(1000, function() {$(this).removeClass('current');setTimeout(fade, 5000);});}fade();$('#profileLogin').bind('click',function() {if ($('#loginBox').is(':visible'))$('#loginBox').fadeOut();else {positionLoginBox();$('#carBox').fadeOut();$('#countryBox').fadeOut();$('#loginBox').fadeIn();}});$('#carboxbutton').bind('click',function() {if ($('#carBox').is(':visible'))$('#carBox').fadeOut();else {positionLoginBox();$('#loginBox').fadeOut();$('#countryBox').fadeOut();$('#carBox').fadeIn();}});$('#country').bind('click',function() {if ($('#countryBox').is(':visible'))$('#countryBox').fadeOut();else {positionLoginBox();$('#loginBox').fadeOut();$('#carBox').fadeOut();$('#countryBox').fadeIn();}});$('.mobilbutton').bind('click',function() {if ($('#mobilmenulist').is(':visible'))$('#mobilmenulist').hide();else {$('#mobilmenulist').show();}});$( window ).resize(function() {positionLoginBox();});function positionLoginBox() {var position = $('#carboxbutton').offset();var cartposition = $('#cart').offset();var countryposition = $('#country').offset();var carposition = $('#carboxbutton').offset();var loginposition = $('#profileLogin').offset();/*alert(position.left);alert(carposition.left);alert(countryposition.left);alert(loginposition.left);*//*$('#countryBox').css({ left: position.left + 120, top: position.top+100 });$('#loginBox').css({ left: position.left + 120, top: position.top+100 });$('#carBox').css({ left: position.left + 120, top: position.top+100 });$('#countryBox .triangle').css({ left: countryposition.left-(position.left+120)});$('#loginBox .triangle').css({ left: loginposition.left-(position.left+120) });$('#carBox .triangle').css({ left: carposition.left -position.left });var w = window.innerWidth;if(w>951){$('#cartBox .triangle').css({ left: cartposition.left - (position.left + 117 ) });$('#cartBox').css({ left: position.left + 120, top: position.top+100 });}*/}$(document).ready(function() {$("html").mouseup(function(e) {var subject = $("#cartBox, #loginBox, #countryBox, #carBox");if(e.target.id != subject.attr('id') && !subject.has(e.target).length) {subject.fadeOut();}});});$('#loginform').bind('submit',function(e){e.stopPropagation;e.preventDefault;form = $(this);uname = form.find('input[name=username]').val();pass = form.find('input[name=password]').val();var url = URI('/ajax.php').addSearch('module','Login');var request = $.ajax({url: url.valueOf(),type: "POST",data: { email:uname,pass:pass }});request.success(function(data, textStatus, jqXHR){var _data = JSON.parse(data);if (_data['status']){window.location.reload();}});return false;});$('.logout').bind('click',function(e){e.stopPropagation;e.preventDefault;var url = URI('/ajax.php').addSearch('module','Login').addSearch('logout','1');var request = $.ajax({url: url.valueOf(),type: "POST",data: { }});request.success(function(data, textStatus, jqXHR){var _data = JSON.parse(data);if (_data['status']){window.location.reload();}});return false;});setTimeout(function checkCountryCookie(){var country=getCookie("country");if(!country.length){$("#delivery_country_selector").show();}},30000);function countryselect(cid){var url = URI('/ajax.php').addSearch('module','Countryselect').addSearch('selectedcountry',cid);var request = $.ajax({url: url.valueOf(),type: "POST",data: { }});request.success(function(data, textStatus, jqXHR){var _data = JSON.parse(data);if (_data.status){setCookie('country',_data.msg,7);$('[name=country]').val(_data.msg);$("#delivery_country_selector").remove();$('#countryBox').fadeOut();$('.dropdown.country.open').removeClass('open');}});return false;}/**/
;/*lscache.js*/ /**/window.LSCache = new function (){this.ls = window.localStorage;this.isTimeExpired = function(created,seconds){return (this.getTime()-seconds) > created;};this.getTime = function(){return parseInt(new Date().getTime()/1000);};this.get = function(key,timeout_seconds){var key = JSON.stringify(key);timeout_seconds = parseInt(timeout_seconds);var data = JSON.parse(this.ls.getItem(key));if (!data || typeof data.created === 'undefined' || this.isTimeExpired(data.created,timeout_seconds)){console.log('LSCache::getItem('+key+','+timeout_seconds+') ->failed');return false;}return data.val;};this.set = function(key,val){var key = key;var key = JSON.stringify(key);this.ls.setItem( key,JSON.stringify({ created : this.getTime(), val : val }) );return val;};}/**//**/
;/*searcher_beta.js*/ /**/var compareLowerFirst = compareLowerFirst || false;var URI = URI || false;function searcher(){this.ele = null;this.rewriteurl = true;this.data = {};this.brands = {};this.cars_ID = '';this.__construct = function(element,rewriteurl){this.rewriteurl = rewriteurl !== false;this.ele = element;console.log('Log: searcher initializing...','rewriteurl:'+(this.rewriteurl?'true':'false'),this.cars_ID.length?('preselected cars_ID found: '+this.cars_ID):'');var cache_key = 'getdata1';this.data = $.when(window.LSCache.get(cache_key,3600));this.data.done(function(result){if (!result){console.log('Log: loading from remote JSON');window.loadingAnimation.init();window.loadingAnimation.start();this.data = $.getJSON( "/ajax.php?module=Searcher&getData=1" );return this.data.done(function(result){window.loadingAnimation.stop();window.LSCache.set(cache_key,result);return result;}.bind(this));}return result;}.bind(this));this.data.done(function(result){var brands_unordered = { };var brands = { };var brands_preselected = false;for(var i in result){if (result[i]['cID'] === this.cars_ID){brands_preselected = result[i]['b_s'];}brands_unordered[result[i]['b']] = result[i];}Object.keys(brands_unordered).sort(compareLowerFirst).forEach(function(key) {brands[key] = brands_unordered[key];});console.log('Log: Found '+Object.keys(brands).length+' brands.');var ele = $('#brand');var ele2 = $('#brand_header');var selected = $(this.ele).closest('form').find('[name=sbrand]');var selected_val = selected.val();if (selected.val()+'' === '0' || !selected.val() || selected.val() === '---'){ele.html('');ele2.html('');}else{ele.html('');ele2.html('');}for(var i in brands){ele.append('');ele2.append('');}return result;}.bind(this)).done(function(result){var cartype_unordered = { };var cartype = { };var brands_selected = $(this.ele).closest('form').find('[name=sbrand]').val();var cartype_preselected = false;if(!brands_selected){return result;}for(var i in result){if (result[i]['cID'] === this.cars_ID){cartype_preselected = result[i]['vt_s'];}if(result[i]['b_s'] === brands_selected){cartype_unordered[result[i]['vt']] = result[i];}}Object.keys(cartype_unordered).sort(compareLowerFirst).forEach(function(key) {cartype[key] = cartype_unordered[key];});console.log('Log: Found '+Object.keys(cartype).length+' cartype.');var ele = $('#cartype');var ele2 = $('#cartype_header');var selected = $(this.ele).closest('form').find('[name=sctype]');var selected_val = selected.val();if (cartype.length !== 1 &&(selected.val()+'' === '0' || !selected.val() || selected.val() === '---')){ele.html('');ele2.html('');}else{ele.html('');ele2.html('');}for(var i in cartype){ele.append('');ele2.append('');}return result;}.bind(this)).done(function(result){var motor = { };var motor_unordered = { };var brands_selected = $(this.ele).closest('form').find('[name=sbrand]').val();var cartype_selected = $(this.ele).closest('form').find('[name=sctype]').val();var motor_selected = $(this.ele).closest('form').find('[name=smotor]').val();var motor_preselected = motor_selected;if (!motor_selected){motor_preselected = false;}if(!cartype_selected){return result;}for(var i in result){if (result[i]['cID'] === this.cars_ID){motor_preselected = result[i]['m_s'];}if( result[i]['b_s'] === brands_selected&& result[i]['vt_s'] === cartype_selected){motor_unordered[result[i]['m_s']] = result[i];}}Object.keys(motor_unordered).sort(compareLowerFirst).forEach(function(key) {motor[key] = motor_unordered[key];});console.log('Log: Found '+Object.keys(motor).length+' motor.');var ele = $('#carmotor');var ele2 = $('#carmotor_header');var selected = $(this.ele).closest('form').find('[name=smotor]');var selected_val = selected.val();if (Object.keys(motor).length !== 1 && (selected.val()+'' === '0' || !selected.val() || selected.val() === '---')){ele.html('');ele2.html('');}else{ele.html('');ele2.html('');}for(var i in motor){ele.append('');ele2.append('');}return result;}.bind(this)).done(function(result){var category_unordered = { };var category = { };var cids = [ ];var brands_selected = $(this.ele).closest('form').find('[name=sbrand]').val();var cartype_selected = $(this.ele).closest('form').find('[name=sctype]').val();var motor_selected = $(this.ele).closest('form').find('[name=smotor]').val();if(!motor_selected && motor_selected !== ''){return result;}for(var i in result){if( result[i]['b_s'] === brands_selected&& result[i]['vt_s'] === cartype_selected&& result[i]['m_s'] === motor_selected){cids.push(result[i]['cID']);}}if (!cids.length){return result;}$.getJSON( "/ajax.php?module=Searcher&getData=1&cids="+cids.join(',') ).done(function(result){for(var i in result){category[(result[i].cicsop === 'A' ? 'compressor' : result[i].category)] = result[i];}Object.keys(category_unordered).sort(compareLowerFirst).forEach(function(key) {category[key] = category_unordered[key];});console.log('Log: Found '+Object.keys(category).length+' category.');var ele = $('#category');var selected_val = $('select[name=scategory]').val();if (Object.keys(category).length !== 1 && !selected_val){ele.html('');}else{ele.html('');}if (Object.keys(category).length === 1 && URI().path() === '/'){console.log('Forcing url rewrite');this.rewriteurl = true;}for(var i in category){ele.append('');}}.bind(this)).done(function(result){var form = $(this.ele).closest('form');var brands_selected = form.find('[name=sbrand]').val();var cartype_selected = form.find('[name=sctype]').val();var motor_selected = form.find('[name=smotor]').val();var category_selected = $('select[name=scategory]').val();if (!brands_selected){return result;}var segments = [];if (brands_selected){segments.push(brands_selected);}if (cartype_selected){segments.push(cartype_selected);}if (motor_selected){segments.push(motor_selected);}if (motor_selected === ''){segments.push('---');}if (category_selected){segments.push(category_selected);}var uri = URI.decode(URI('/').segment(segments).valueOf())+'/search.html';form[0].action = uri;if (this.rewriteurl){console.log('Event: rewriting url');window.history.pushState({ uri: uri }, "", uri);}return result;}.bind(this)).done(function(result){console.log('Log: ...searcher initialized');}.bind(this));return result;}.bind(this));return this;};}function searchTabber(){$('.tabgroup').tabs({activate: function( event, ui ) {switch(ui.newTab.index()+1){case 2: $('#dopsearch_form').load('/ajax.php?module=Searcher&compressorP=1');break;default:}}});}function loadPSearchForm() {$('#dopsearch_form').load('/ajax.php?module=Searcher&compressorP=1');}$(document).ready(function(){window.searcher = new searcher();window.searcher.__construct( document.querySelector('[name=scategory]') ? document.querySelector('[name=scategory]') : document.querySelector('[name=sbrand]'), document.querySelector('[name=scategory]') && document.querySelector('[name=scategory]').value.length ? true : false);$.when(searchTabber()).then(function(result){window.onpopstate = function(event){window.location = window.location.href;};}.bind(this));$('#dopsearch_form').on('change',function(e){if(e.target.name !== 'cCategoryP'){$(this).load(URI('/ajax.php').query($(this).serialize()).addSearch('module','Searcher').addSearch(($('[name=cCategoryP]').val() === '1'?'compressorP':'partsP'),'1').valueOf());}});$('#homeTab li').click(function(){loadPSearchForm();});});$('#searcher_submit,#carform [type=submit]').bind('click',function(e){e.preventDefault();var form = $(this).closest('form');if (!form.find('[name=sbrand]').val() || !form.find('[name=sctype]').val() || (form.find('[name=smotor] option').length > 1 && !form.find('[name=smotor]').val())){return false;}$.when($.ajax({url : URI('/ajax.php').addSearch('module','UserData').addSearch('sbrand',form.find('[name=sbrand]').val()).addSearch('sctype',form.find('[name=sctype]').val()).addSearch('smotor',form.find('[name=smotor]').val()).valueOf()})).then(function(result){if (!form.find('[name=scategory]').val()){var uri = URI.decode(URI('/m-'+form.find('[name=sbrand]').val()+'-x-'+form.find('[name=sctype]').val()+'-x-'+form.find('[name=smotor]').val()).valueOf());$.ajax({url:uri,dataType: "html",statusCode: {404: function() {$('#carBox').fadeOut();return false;}},success:function(){console.log('Log: Brand page exists');window.location.href=uri;}});return false;}$.when(form.attr('onsubmit','')/*,form.attr('action',URI(form.attr('action')).valueOf())*/).then(function(result){if (URI().directory() === '/'){console.error('Empty URL problem!!!!');return;}var url = URI.decode(URI(window.location.href).filename('dopsearch.html').valueOf());form[0].action = url;/*window.history.pushState({ uri: url }, "", url);*/form[0].submit();}.bind(this));}.bind(this));return false;});/**/
;/*footer.js*/ /**/function setCookie(cname, cvalue, exdays) {var d = new Date();d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));var expires = "expires=" + d.toUTCString();document.cookie = cname + "=" + cvalue + "; " + expires+"; path=/";}$('#macookieaccepto').bind('click', function () {$('#macookie').css('height', 0).css('margin', 0);setTimeout(function () {$('#macookie').css('display', 'none').css('visibility', 'hidden').css('width', 0).css('padding', 0);}, 1900);setCookie('macookie', 1, 3);});$('.brand [data-url]').click(function() {window.location.href='/'+$(this).attr('data-url');});$(window).scroll(function() {var scroll = $(window).scrollTop();});$( document ).ready(function() {$('#scroller1').click(function() {$("#brandsContainer").css("height","auto");$('#scroller1').fadeOut("fast");$('#scroller2').fadeIn("fast");});$('#scroller2').click(function() {$("#brandsContainer").css("height","13.2em");$('#scroller2').fadeOut("fast");$('#scroller1').fadeIn("fast");});});setInterval(function(){ $.get('/keepalive.php'); }, 90000);function getCookie(cname) {var name = cname + "=";var ca = document.cookie.split(';');for(var i = 0; i |
');*/var ele = $('');$('body').find('#'+this.id).remove();var toAppend = $('#footer').length > 0 ? $('#footer') : $('body');toAppend.append(ele);ele.bind('click',function(){ ele.hide(); });return this;},start: function(){console.log('Log: loading animation visible');$('#'+this.id).show();},stop: function(){console.log('Log: loading animation hidden');$('#'+this.id).hide();}};window.loadingAnimation.init();function ajaxLoadPage(url,params){var params = typeof params === 'object' ? params : { };var url = url || '';var post = params.post || { };console.log('action:ajaxLoadpage()',url,post);var title = title || '';window.loadingAnimation.start();$.ajax({url: url,data: post,type: "POST",timeout : params.timeout || 10000,success : params.success && typeof params.success === 'function' ? params.success: function(data){ $('body').html(data); },error : params.error && typeof params.error === 'function' ? params.error : function(){ },complete: function( ){window.loadingAnimation.stop();}});window.history.pushState(post,title,url);window.addEventListener('popstate', function(){console.log('page reloaded');window.location.reload();});};/**/