jQuery.fn.extend({ ajaxSelectGift: function () { $('.ajax-loader').show(); id = $('input[name=Gift_Id]:radio:checked').val(); $.ajax({ type: "POST", url: "/checkout/buy/ajaxselectgift", data: {Gift_Id: id}, success: function(msg) { msg = parseInt(msg); if (msg == 1) { $.ajax({ type: "POST", url: '/checkout/buy/ajaxcheckorder', data: $(this).serialize(), success: function(msg) { jQuery.fn.setActiveStep(5); $('.ajax-loader').show(); msg = jQuery.trim(msg); $('.ajax-loader').hide(); $('#order-review').html(msg); $('#order-review').slideDown(500); $('#order-review').parent().hide().fadeIn(1000); $('#accept-form #submit').click(function () { $('#step5').addClass('ui-state-disabled'); var w = $('#step5').width(); var h = $('#step5').height(); elem = $('#order-progressbar-container'); elem.css('margin-top', 0 - 50 - (h / 2 - elem.height() / 2) + 'px'); elem.css('margin-left', (w / 2 - elem.width() / 2) + 'px'); elem.show(); }); if (mbPortal.mobileMode == 1) { $('#order-review').trigger('create'); } $('tr td.item-variant-description').hover( function() { $(this).find('.item-variants-info-bubble').show('slow'); }, function() { $(this).find('.item-variants-info-bubble').hide('slow'); }); return false; } }); } else { alert(mbPortal.captions.GiftNotAavailable); return false; } } }); return false; }, ajaxSendForm: function() { $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); alert(msg); } }); return false; }, ajaxSendRegisterForm: function() { $('.ajax-loader').show(); $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); if (msg == 'Success') { //jQuery.fn.setActiveStep(3); document.location.reload(); } else { $('#registerForm').html(msg); $('#registerForm').show(); } } }); return false; }, ajaxSendBillingAddressForm: function() { $('.ajax-loader').show(); $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); if (msg == 'Success') { jQuery.fn.setActiveStep(2); } else if (msg == 'SuccessOver') { jQuery.fn.setActiveStep(3); } else { $('#billing-address').html(msg); $('#billing-address').show(); } } }); return false; }, ajaxSendShipAddressForm: function() { $('.ajax-loader').show(); $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); if (msg == 'Success') { jQuery.fn.setActiveStep(3); jQuery.fn.getShipmentMethodForm(); } else { $('#ship-address').html(msg); $('#ship-address').show(); } } }); return false; }, ajaxSendShipMethodForm: function() { $('.ajax-loader').show(); $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); if (msg == 'Success') { jQuery.fn.setActiveStep(4); jQuery.fn.getPaymentMethodForm(); } else { $('#ship-method').html(msg); $('#ship-method').show(); } } }); return false; }, ajaxSendPaymentMethodForm: function() { $('.ajax-loader').show(); $.ajax({ type: "POST", url: $(this).attr('action'), data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); if (msg == 'Success') { jQuery.fn.setActiveStep(5); $('.ajax-loader').show(); $('#order-review').hide(); if ($('#stepg').length > 0) { $.ajax({ type: "POST", url: '/checkout/buy/ajaxgetgift', data: $(this).serialize(), success: function (msg) { $('.ajax-loader').hide(); if (msg != 0) { $('#stepg').children('.shopping-step-content').show('slow'); $('#gift-list').html(msg); } else { $.ajax({ type: "POST", url: '/checkout/buy/ajaxcheckorder', data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); $('#order-review').html(msg); $('#order-review').slideDown(500); $('#order-review').parent().hide().fadeIn(1000); $('#accept-form #submit').click(function () { $('#step5').addClass('ui-state-disabled'); var w = $('#step5').width(); var h = $('#step5').height(); elem = $('#order-progressbar-container'); elem.css('margin-top', 0 - 50 - (h / 2 - elem.height() / 2) + 'px'); elem.css('margin-left', (w / 2 - elem.width() / 2) + 'px'); elem.show(); }); if (mbPortal.mobileMode == 1) { $('#order-review').trigger('create'); } $('tr td.item-variant-description').hover( function() { $(this).find('.item-variants-info-bubble').show('slow'); }, function() { $(this).find('.item-variants-info-bubble').hide('slow'); }); } }); } } }); } else { $.ajax({ type: "POST", url: '/checkout/buy/ajaxcheckorder', data: $(this).serialize(), success: function(msg) { msg = jQuery.trim(msg); $('.ajax-loader').hide(); $('#order-review').html(msg); $('#order-review').slideDown(500); $('#order-review').parent().hide().fadeIn(1000); $('#accept-form #submit').click(function () { $('#step5').addClass('ui-state-disabled'); var w = $('#step5').width(); var h = $('#step5').height(); elem = $('#order-progressbar-container'); elem.css('margin-top', 0 - 50 - (h / 2 - elem.height() / 2) + 'px'); elem.css('margin-left', (w / 2 - elem.width() / 2) + 'px'); elem.show(); }); if (mbPortal.mobileMode == 1) { $('#order-review').trigger('create'); } $('tr td.item-variant-description').hover( function() { $(this).find('.item-variants-info-bubble').show('slow'); }, function() { $(this).find('.item-variants-info-bubble').hide('slow'); }); } }); } } else { $('#payment-method').html(msg); $('#payment-method').show(); } } }); return false; }, showFormTab: function(tab) { $('div#tabs div.tab-caption').removeClass('tab-active'); $(this).addClass('tab-active'); $('form.tabbed-form fieldset').parent().prev().hide(); $('form.tabbed-form fieldset').parent().hide(); $('form.tabbed-form fieldset#fieldset-' + tab).parent().show(); $('form.tabbed-form fieldset#fieldset-save').parent().show(); }, setActiveStep: function(step) { $('#shopping-progress div.shopping-step-header').addClass('ui-state-active'); if (step == 0) $('#shopping-progress div.shopping-step-content').hide(); else $('#shopping-progress div.shopping-step-content').slideUp('fast'); $('#step' + step).find('div.shopping-step-header').removeClass('ui-state-active'); if (step > 0 && step < 5) $('#step' + step).find('div.shopping-step-content').slideDown('normal'); else $('#step' + step).find('div.shopping-step-content').show(); //$.scrollTo('#step' + step); return false; }, showAddressForm: function() { if ($(this).val() == 'new') { $('.element-form div.errors').hide(); $('.element-form div.errors').prev('.element-label').hide(); $('fieldset#fieldset-newaddress').show(); } else { $('fieldset#fieldset-newaddress').hide(); } }, refreshPhotobox: function(id) { $.ajax({ type: 'post', url: '/core/cms/index/photo', data: {photobox : id}, success: function(msg) { msg = jQuery.trim(msg); elem = $('#photobox-' + id + ' .photos'); elem.html(msg); /*img = elem.find('.photobox-image'); if (img.width() > img.height()) { img.css('width', '190px'); } if (img.height() > img.width()) { img.css('height', '190px'); }*/ elem.fadeTo(0, 0.1); elem.fadeTo(1500, 1.0); } }); }, refreshItembox: function(boxType) { $.ajax({ type: 'post', url: '/core/cms/index/ajaxitem', data: {type : boxType}, success: function(msg) { msg = jQuery.trim(msg); elem = $('#itembox-'+boxType); elem.html(msg); //elem.fadeTo(0, 0.1); //elem.fadeTo(500, 1.0); } }); }, refreshCategorybox: function(boxType) { $.ajax({ type: 'post', url: '/core/cms/index/ajaxcategory', data: {type : boxType}, success: function(msg) { msg = jQuery.trim(msg); elem = $('#'+boxType+'-category-box'); elem.html(msg); //elem.fadeTo(0, 0.1); //elem.fadeTo(500, 1.0); } }); }, resizeElem: function(width) { if ($(this).width() > width) { $(this).width(width); } }, checkOrderQty: function () { $(this).blur(function () { var val = parseFloat($(this).val()); var minVal = parseFloat($(this).parent().find('.min-order-qty').html()); var inv = parseFloat($(this).parent().find('.inventory').html()); var oldqty = parseFloat($(this).parent().find('.old-qty').val()); val = (isNaN(val) ? 0 : val); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); inv = (isNaN(inv) ? 0 : inv); if (val < minVal) { if (confirm(sprintf(mbPortal.captions.Min_Qty, minVal))) { val = minVal; $(this).val(minVal); } else { $(this).val(oldqty); return false; } } /*if (val > inv) { var mul = Math.floor(inv / minVal); var newVal = mul * minVal; if (inv == 0) { return true; } else { if (confirm('Az elérhető készlet ' + newVal + '. Elfogadja ' + val + ' helyett?')) { $(this).val(newVal); } else { $(this).val(oldqty); return false; } } } else {*/ if (val % minVal != 0) { var mul = Math.ceil(val / minVal); var newVal = mul * minVal; if (confirm(sprintf(mbPortal.captions.Unit_Pack, minVal, newVal))) { $(this).val(newVal); } else { $(this).val(oldqty); return false; } } //} }); }, validateCartCreateForm: function () { var itemid = $('#shopping-cart-create #itemid'); var no = $('#shopping-cart-create #itemno'); var desc = $('#shopping-cart-create #itemdesc'); var qty = $('#shopping-cart-create #orderqty'); var alerted = false; qty.focus(function() { $(this).select(); if ($('#field-No').html() != no.val()) { $('#field-No').html(no.val()); qty.focus(); $.ajax({ type: "POST", url: '/core/catalog/order/getbycode', data: {code: no.val()}, success: function (data) { obj = JSON.parse(data); switch (obj.message) { case 'notfound': $('#ajax-item-info').html(''); desc.val(''); qty.val(0); no.val(''); $('#itemid').val(''); if (!alerted) alert(mbPortal.captions.Product_Not_Found); alerted = true; no.focus(); break; default: case 'success': $('#orderqty').val(obj.qty); $('#shopping-cart-create #itemid').val(obj.itemid); $('#shopping-cart-create .min-order-qty').html(obj.minqty); $('#shopping-cart-create #itemdesc').val(obj.desc); $.ajax({ type: "POST", url: '/core/catalog/list/ajaxcard', data: {itemid: $('#itemid').val()}, success: function (data) { $('#ajax-item-info').html(data); qty.focus(); } }); break; } } }); } }); no.autocomplete({ source: '/core/catalog/order/autocomplete/field/No/desc/No,Description/limit/50/plusfield/Description/applyfilter/1', minLength: 1, select: function(event, ui) { $('#ajax-item-info').html(''); desc.val(ui.item.Description); }, close: function(event, ui) { //if (no.val().lenth > 0) qty.focus(); } }) .blur(function () { var elem = $(this); if (elem.val().length == 0) { $('#ajax-item-info').html(''); return true; } }). keypress(function (e) { alerted = false; var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: $(this).autocomplete('close'); qty.focus(); return false; break; } }); desc.autocomplete({ source: '/core/catalog/item/autocomplete/field/Description/desc/No,Description/limit/50/plusfield/No/applyfilter/1', minLength: 1, open: function (event, ui) { no.val(''); itemid.val(''); $('#field-No').html(''); }, select: function(event, ui) { no.val(ui.item.No); /*if ($('#field-Description').html() != desc.val()) { $('#field-Description').html(desc.val()); $.ajax({ type: "POST", url: '/core/catalog/order/getbycode', data: {code: no.val()}, success: function (data) { obj = JSON.parse(data); switch (obj.message) { case 'notfound': $('#ajax-item-info').html(''); desc.val(''); qty.val(0); no.val(''); $('#itemid').val(''); alert('Termék nem található!'); no.focus(); break; default: case 'success': $('#orderqty').val(obj.qty); $('#shopping-cart-create #itemid').val(obj.itemid); $('#shopping-cart-create .min-order-qty').html(obj.minqty); $.ajax({ type: "POST", url: '/core/catalog/list/ajaxcard', data: {itemid: $('#itemid').val()}, success: function (data) { $('#ajax-item-info').html(data); qty.focus(); } }); break; } } }); }*/ }, close: function(event, ui) { qty.focus(); } }) .blur(function () { var elem = $(this); if (elem.val().length == 0) { return true; } }) .keypress(function (e) { alerted = false; var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: $(this).autocomplete('close'); qty.focus(); return false; break; } });; }, registerShow: function (type) { $('#registerForm').show(); switch (type) { default: case 'person': $('#registerForm #Subtype').val('Person'); //$('#ICO_No').parent().parent().hide(); //$('#ICO_No').parent().parent().prev('label').hide(); $('#Community_Tax_Number').parent().parent().hide(); $('#Community_Tax_Number').parent().parent().prev('label').hide(); $('#VAT_Registration_No').parent().parent().hide(); $('#VAT_Registration_No').parent().parent().prev('label').hide(); $('#Contact').parent().parent().hide(); $('#Contact').parent().parent().prev('label').hide(); /*switch (mbPortal.companyId) { case 5: $('#VAT_Registration_No').parent().next('p.help').html('Cod numeric personal'); $('#VAT_Registration_No').parent().parent().prev('label').html('CPN: *'); break; case 15: $('#County').parent().parent().hide(); $('#County').parent().parent().prev('label').hide(); break; }*/ break; case 'company': $('#registerForm #Subtype').val('Company'); $('#VAT_Registration_No').parent().parent().show(); $('#VAT_Registration_No').parent().parent().prev('label').show(); $('#Community_Tax_Number').parent().parent().show(); $('#Community_Tax_Number').parent().parent().prev('label').show(); $('#Contact').parent().parent().show(); $('#Contact').parent().parent().prev('label').show(); /*switch (mbPortal.companyId) { case 3: break; case 5: $('#VAT_Registration_No').parent().next('p.help').html('CUI: *'); $('#VAT_Registration_No').parent().parent().prev('label').html('CUI: *'); $('#ICO_No').parent().parent().hide(); $('#ICO_No').parent().parent().prev('label').hide(); break; case 15: $('#County').parent().parent().hide(); $('#County').parent().parent().prev('label').hide(); $('#Community_Tax_Number').parent().parent().hide(); $('#Community_Tax_Number').parent().parent().prev('label').hide(); $('#ICO_No').parent().parent().hide(); $('#ICO_No').parent().parent().prev('label').hide(); break; case 7: case 17: $('#Community_Tax_Number').parent().parent().hide(); $('#Community_Tax_Number').parent().parent().prev('label').hide(); $('#ICO_No').parent().parent().hide(); $('#ICO_No').parent().parent().prev('label').hide(); break; default: $('#ICO_No').parent().parent().hide(); $('#ICO_No').parent().parent().prev('label').hide(); break; }*/ break; case 'distributor': $('#registerForm #Subtype').val('Distributor'); break; } $('#registerForm').setActiveStep(1); }, validateCartFormSubmitButton: function () { var form = $(this).parents('form'); var val = parseFloat(form.find('.order-qty').val()); var minVal = parseFloat(form.find('.min-order-qty').html()); var inv = parseFloat(form.find('.inventory').text()); val = (isNaN(val) ? 0 : val); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); inv = (isNaN(inv) ? 0 : inv); if (val < minVal) { if (confirm(sprintf(mbPortal.captions.Min_Qty, minVal))) { val = minVal; form.find('.order-qty').val(minVal); } else { return false; } } if (val > inv) { var mul = Math.floor(inv / minVal); var newVal = mul * minVal; if (inv == 0) { return true; } else { if (confirm('Az elérhető készlet ' + newVal + '. Elfogadja ' + val + ' helyett?')) { $(this).val(newVal); } else { $(this).val(oldqty); return false; } } } else { if (val % minVal != 0) { var mul = Math.ceil(val / minVal); var newVal = mul * minVal; if (confirm(sprintf(mbPortal.captions.Unit_Pack, minVal, newVal))) { form.find('.order-qty').val(newVal); } else { return false; } } } }, validateMultiCartFormSubmitButton: function () { var form = $(this); var selectedItems = $('.item-selected:checked'); var allchecked = true; if (selectedItems.length == 0) { alert(mbPortal.captions.Choose_Product); return false; } selectedItems.each(function (i) { var itemId = $(this).attr('id').replace('item-selected-', ''); var parent = $(this).parent().parent(); var val = parseFloat(parent.find('.order-qty').val()); var minVal = parseFloat(parent.find('.min-order-qty').html()); var inv = parseFloat(parent.find('.inventory').text()); val = (isNaN(val) ? 0 : val); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); inv = (isNaN(inv) ? 0 : inv); if (val < minVal) { allchecked = false; $('#item-row-message-'+itemId).find('.displaybox-minunit').hide(); $('#item-row-message-'+itemId).find('.displaybox-minorder .minval').html(minVal); $('#item-row-message-'+itemId).find('.displaybox-minorder').show(); $('#item-row-message-'+itemId).show(); return; } else { $('#item-row-message-'+itemId).hide(); } if (val % minVal != 0) { allchecked = false; var mul = Math.ceil(val / minVal); var newVal = mul * minVal; $('#item-row-message-'+itemId).find('.displaybox-minorder').hide(); $('#item-row-message-'+itemId).find('.displaybox-unit .minunitdef').html(minVal); $('#item-row-message-'+itemId).find('.displaybox-unit .minunit').html(newVal); $('#item-row-message-'+itemId).find('.displaybox-unit').show(); $('#item-row-message-'+itemId).show(); return; } else { $('#item-row-message-'+itemId).hide(); } }); return allchecked; }, cartMinorderAccept: function (id, condition) { var qty = $('#row-'+id+' .order-qty'); var checkbox = $('#row-'+id+' .item-selected'); var minVal = parseFloat($('#item-row-message-'+id+' .minval').html()); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); if (condition == 'yes') { qty.val(minVal); checkbox.attr('checked', true); } else { checkbox.attr('checked', false); } $('#item-row-message-'+id).hide(); }, cartMinunitAccept: function (id, condition) { var qty = $('#row-'+id+' .order-qty'); var checkbox = $('#row-'+id+' .item-selected'); var minVal = parseFloat($('#item-row-message-'+id+' .minunit').html()); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); if (condition == 'yes') { qty.val(minVal); checkbox.attr('checked', true); } else { checkbox.attr('checked', false); } $('#item-row-message-'+id).hide(); }, getShipmentMethodForm: function () { $.ajax({ type: "POST", url: '/checkout/buy/ajaxgetshipmentmethod', data: {}, success: function(msg) { msg = jQuery.trim(msg); $('#ship-method-ajax').html(msg); if ($('#ship-method-form input#date').length > 0) { if (mbPortal.Delivery_Date_Visible == 1) { $('#ship-method-form input#date').parents('.element-form').css('margin-top', '10px'); $('#ship-method-form input#date').parent().datepicker({ onSelect: function(dateText, inst) { $('input#date').val(dateText); }, minDate: $('input#date').val(), beforeShowDay: $.datepicker.noWeekends }); } else { $('#ship-method-form input#date').hide(); } } if ($("#ship-method-form input[name='shipment']:radio").length > 0) { $("#ship-method-form input[name='shipment']:radio").change( function() { var value = $(this).val(); switch (value) { case 'SZEMÉLYES': case 'SZEMÉLYEST': case 'SZEMÉLYESÜ': case 'SZEMÉLYESA': $('#ship-method').html(''); $('#ship-method').html('Kérem várja meg az üzlet visszajelzését a rendelés leadását követően!'); break; default: $('#ship-method').html(''); } }); } $('#ship-method-ajax').show(); $('.ui-datepicker').show(); if ($("#ship-method-form").length > 0) { $('.shipment-method-info .shipment-info-img').hover( function () { $(this).parent().find('.shipment-info-bubble').show('slow'); }, function () { $(this).parent().find('.shipment-info-bubble').hide('slow'); } ) }; if (mbPortal.mobileMode == 1) { $('#ship-method-ajax').trigger('create'); } switch (mbPortal.domainId) { case 3: break; default: $('input#date').parent().parent().hide(); $('input#date').parent().parent().prev('label').hide(); $('input#date').parent().next('p.help').hide(); if ($('#shipment-text').html().length > 0) $('#ship-method-ajax').after('
'+$('#shipment-text').html()+'
'); break; } } }); }, getPaymentMethodForm: function () { $.ajax({ type: "POST", url: '/checkout/buy/ajaxgetpaymentmethod', data: {}, success: function(msg) { msg = jQuery.trim(msg); $('#payment-method-ajax').html(msg); $('#payment-method-ajax').show(); if (mbPortal.mobileMode == 1) { $('#payment-method-ajax').trigger('create'); } } }); }, sendItemOrdering: function (orderby, seq) { href = window.location.href; helppos = href.indexOf('?'); if (helppos >= 0) { href = href.substr(0, helppos); } orderpos = href.indexOf('/Orderby/'); if (orderpos >= 0) { href = href.substr(0, orderpos); } href = href + '/Orderby/' + orderby + '/Sequence/' + seq; window.location.href = href; }, selectSizeOptionByCode: function(code) { if ($('#detailed-search-form').length > 0) { form = $('#detailed-search-form'); inputSize = form.find('.mb-multi-checkbox-line input#Size-' + code); inputSize.attr('checked', !inputSize.attr('checked')); form.find('#submit').click(); } }, selectMultipleSizeOptionByCode: function(/*check,*/ code1, code2, code3) { if ($('#detailed-search-form').length > 0) { form = $('#detailed-search-form'); inputSize = form.find('.mb-multi-checkbox-line input#Size-' + code1); inputSize.attr('checked', !inputSize.attr('checked')); if (code2 != '-1') { inputSize2 = form.find('.mb-multi-checkbox-line input#Size-' + code2); inputSize2.attr('checked', !inputSize2.attr('checked')); } if (code3 != '-1') { inputSize3 = form.find('.mb-multi-checkbox-line input#Size-' + code3); inputSize3.attr('checked', !inputSize3.attr('checked')); } form.find('#submit').click(); } }, validateCouponCode: function() { if ($('#Coupon_Code').length > 0) { $.ajax({ type: "POST", url: '/checkout/buy/ajaxvalidatecuponcode', data: {Coupon_Code: $('#Coupon_Code').val()}, success: function (msg) { //$('#couponvalidate_btn').hide(); message = JSON.parse(msg); if (message['available'] == 1) { alert(sprintf(mbPortal.captions.CouponDiscount, message['discount'])); } else { alert(mbPortal.captions.CouponNotFounded); } } }); } return false; }, galleryCatScroll: function(scroll) { var leftvalue = $('#gallery-category-block').css('margin-left'); var maxvalue = $('#gallery-category-block .categories').width(); leftvalue = parseInt(leftvalue.substr(0, leftvalue.length-2)); switch (scroll) { case 'Left': if (leftvalue + 32 > 0) { $('#gallery-category-block .categories').css('margin-left', '0px' ); } else { $('#gallery-category-block .categories').css('margin-left', (leftvalue + 32) + 'px' ); } break; case 'Right': if (leftvalue - 32 > maxvalue) { $('#gallery-category-block .categories').css('margin-left', (-maxvalue) + 'px' ); } else { $('#gallery-category-block .categories').css('margin-left', (leftvalue - 32) + 'px' ); } break; } }, categoryScrollChangeParentCategory: function (catid) { $.ajax({ type: "POST", url: '/frontend/catalog/category/scroller', data: {catid: catid}, success: function (msg) { message = JSON.parse(msg); if (message['success'] == 1) { $('#tabcatscroller').html(message['html']); } /*if (message['subcatCount'] > 0) { $('#mb-carousel').jCarouselLite({ btnNext: ".j-next", btnPrev: ".j-prev", visible: 20, start: 0, circular: false, scroll: 5 }); $('#mb-carousel').width('1164px'); $('#mb-carousel').height('105px'); $('#mb-carousel-ul').width('auto'); $('#mb-carousel-ul .jcarousel-item').width('75px'); $('#mb-carousel-ul .jcarousel-item').height('105px'); }*/ // $('#tabcatscroller').html(msg); } }); }, itemScrollChangePage: function (page, type) { $.ajax({ type: "POST", url: '/frontend/catalog/item/getscrollbox', data: {type: type, page: page}, success: function (msg) { //$('#couponvalidate_btn').hide(); $('#itemscrollbox').html(msg); } }); }, itemVariantSelectChange: function () { var elementName = $(this).attr('name'); var itemId = elementName.substring(elementName.indexOf("_")+1, elementName.indexOf("[")); var vars = $.map($('select[name=\'variants_' + itemId + '[]\']>option:selected'), function(e) { return e.value; }); var variantId = $(this).val(); var element = $(this); $.ajax({ type: 'POST', url: '/frontend/catalog/item/variantprice', data: {itemid: itemId, variants: vars}, success: function (msg) { data = JSON.parse(msg); if ($('#item-price-' + data['itemid']).length > 0) { $('#item-price-' + data['itemid']).html(data['price']); } } }); $.ajax({ type: 'POST', url: '/frontend/catalog/item/variantpicture', data: {id: variantId}, success: function (msg) { data = JSON.parse(msg); img = element.parent().find('img.variant-image'); if (data['picture'] == '') { img.attr('style', 'display: none;'); } else { img.attr('style', ''); } img.attr('src', data['picture']); } }); }, toggleSearchForm: function() { if ($('#detailed-search-form').is(':visible')) { $('#detailed-search-form').animate({ height: 'hide' }, 1000); } else { $('#detailed-search-form').animate({ height: 'show' }, 1000); } }, itemSingleAddAjax: function () { $.ajax({ type: 'POST', cache: false, url: '/checkout/cart/add/ajax/on', data: $(this).serialize(), success: function(data) { obj = jQuery.parseJSON(data); $('#customer_cart').html(obj.cart_html); noty({ type: obj.status, text: obj.notify_html, layout: 'topRight', closeOnSelfClick: false, closeButton: true, timeout: 8000, animateOpen: {opacity: 'toggle'}, animateClose: {opacity: 'toggle'} }); } }); return false; }, itemMultiAddAjax: function () { $.ajax({ type: 'POST', cache: false, url: '/checkout/cart/multiadd/ajax/on', data: $(this).serialize(), success: function(data) { obj = jQuery.parseJSON(data); $('#customer_cart').html(obj.cart_html); $('input.item-selected').attr('checked', false); noty({ type: obj.status, text: obj.notify_html, layout: 'topRight', closeOnSelfClick: false, closeButton: true, timeout: 8000, animateOpen: {opacity: 'toggle'}, animateClose: {opacity: 'toggle'} }); } }); return false; } }); /*function sprintf() { var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = ''; while (f) { if (m = /^[^\x25]+/.exec(f)) { o.push(m[0]); } else if (m = /^\x25{2}/.exec(f)) { o.push('%'); } else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) { if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) { throw('Too few arguments.'); } if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) { throw('Expecting number but found ' + typeof(a)); } switch (m[7]) { case 'b':a = a.toString(2);break; case 'c':a = String.fromCharCode(a);break; case 'd':a = parseInt(a);break; case 'e':a = m[6] ? a.toExponential(m[6]) : a.toExponential();break; case 'f':a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a);break; case 'o':a = a.toString(8);break; case 's':a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a);break; case 'u':a = Math.abs(a);break; case 'x':a = a.toString(16);break; case 'X':a = a.toString(16).toUpperCase();break; } a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a); c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' '; x = m[5] - String(a).length - s.length; p = m[5] ? str_repeat(c, x) : ''; o.push(s + (m[4] ? a + p : p + a)); } else { throw('Huh ?!'); } f = f.substring(m[0].length); } return o.join(''); } */ sprintfWrapper = { init : function () { if (typeof arguments == "undefined") {return null;} if (arguments.length < 1) {return null;} if (typeof arguments[0] != "string") {return null;} if (typeof RegExp == "undefined") {return null;} var string = arguments[0]; var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g); var matches = new Array(); var strings = new Array(); var convCount = 0; var stringPosStart = 0; var stringPosEnd = 0; var matchPosEnd = 0; var newString = ''; var match = null; while (match = exp.exec(string)) { if (match[9]) {convCount += 1;} stringPosStart = matchPosEnd; stringPosEnd = exp.lastIndex - match[0].length; strings[strings.length] = string.substring(stringPosStart, stringPosEnd); matchPosEnd = exp.lastIndex; matches[matches.length] = { match: match[0], left: match[3] ? true : false, sign: match[4] || '', pad: match[5] || ' ', min: match[6] || 0, precision: match[8], code: match[9] || '%', negative: parseInt(arguments[convCount]) < 0 ? true : false, argument: String(arguments[convCount]) }; } strings[strings.length] = string.substring(matchPosEnd); if (matches.length == 0) {return string;} if ((arguments.length - 1) < convCount) {return null;} var code = null; var match = null; var i = null; for (i=0; i All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of sprintf() for JavaScript nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Changelog: 2007.04.03 - 0.1: - initial release 2007.09.11 - 0.2: - feature: added argument swapping 2007.09.17 - 0.3: - bug fix: no longer throws exception on empty paramenters (Hans Pufal) 2007.10.21 - 0.4: - unit test and patch (David Baird) 2010.05.09 - 0.5: - bug fix: 0 is now preceeded with a + sign - bug fix: the sign was not at the right position on padded results (Kamal Abdali) - switched from GPL to BSD license 2010.05.22 - 0.6: - reverted to 0.4 and fixed the bug regarding the sign of the number 0 Note: Thanks to Raphael Pigulla (http://www.n3rd.org/) who warned me about a bug in 0.5, I discovered that the last update was a regress. I appologize for that. **/ function str_repeat(i, m) { for (var o = []; m > 0; o[--m] = i); return o.join(''); } $(document).ready(function() { if (mbPortal.mobileMode == 1) { //$('.account-info-content table').css('max-width', 580); } //if ((window.location.pathname != '/home') && (window.location.pathname != '/')) { // $('body').scrollTo('#breadcumb'); //} $('.item-list-info-img').mouseover(function () { $(this).parent().find('.item-list-info-bubble').show(); }); $('.item-list-info-img').mouseleave(function () { $(this).parent().find('.item-list-info-bubble').hide(); }); $('.cat-link a').click(function () { $.cookie('opencat', $(this).attr('id').replace('cat-', ''), {path: '/'}); }); $('.middle-cat-link a').click(function () { cid = $(this).attr('id').replace('middle-cat1-link-', ''); cid = $(this).attr('id').replace('middle-cat2-link-', ''); cid = $(this).attr('id').replace('middle-cat3-link-', ''); $.cookie('opencat', cid, {path: '/'}); }); $('#set_currency_code_top, #set_currency_code_bottom').change(function () { $.cookie('selectedcurrency', $(this).val(), {path: '/'}); document.location.reload(true); }); $('#categories .leveltwo ul').addClass('levelthree'); var cats = $('#categories').find('#cat-'+$.cookie('opencat')); cats.parents('ul').addClass('selected').show(); //cats.parents('li').addClass('selected'); //$('#categories ul:not(.selected)').show(); //$('#categories li:not(.selected) ul').remove(); $('#categories').kendoTreeView(); var treeview = $("#categories").data("kendoTreeView"); // expand all loaded items //treeview.expand(".k-item"); //if ($.cookie('opencat') > 0) { $('#cat-'+$.cookie('opencat')) .parent() .addClass('k-state-selected'); treeview.expand($('#cat-'+$.cookie('opencat')).parents('.k-item')); //treeview.expand('ul.selected .k-item'); //} //var cats = $('#categories .cat-link-folder').find('#cat-'+$.cookie('opencat')); //cats.next().show(); $('div#open-company').css('opacity', 0.85); $('div#open-form').css('opacity', 1.5); $('div.action-menu div.action-menu-list').hide(); $('#cms-cat-select').change(function () { var url = document.location.href; url = url.replace(/\/category\/[0-9]+/, ''); document.location.href = url + '/category/' + $(this).val();; }); $('div#tabs div.tab-caption:first').addClass('tab-active'); $('form.tabbed-form fieldset').parent().hide(); $('form.tabbed-form fieldset').parent().prev().hide(); $('form.tabbed-form fieldset#fieldset-general').parent().show(); $('form.tabbed-form fieldset#fieldset-save').parent().show(); $('form.line-sub-form .element-label').hide(); jQuery.fn.setActiveStep(0); $(':text, input[type=password], textarea').focus(function() { $(':text, input[type=password], textarea').removeClass('highlight'); $(this).addClass('highlight'); }); $('fieldset#fieldset-newaddress').hide(); $('div#product-gallery div#pictures div.picture').click(function() { link = $(this).find('img').next('div').text(); $(this).parent('div#pictures').parent("div#product-gallery").find('div#actual-picture').find('img').attr('src', link); // $('div#product-gallery div#actual-picture').find('img').attr('src', link); }); if ($("#gallery-pictures").length > 0) { // We only want these styles applied when javascript is enabled $('div.sl-content').css('display', 'block'); // Initially set opacity on thumbs and add // additional styling for hover effect on thumbs var onMouseOutOpacity = 0.67; $('#thumbs ul.thumbs li').opacityrollover({ mouseOutOpacity: onMouseOutOpacity, mouseOverOpacity: 1.0, fadeSpeed: 'fast', exemptionSelector: '.selected' }); var gallery = $('#thumbs').galleriffic({ delay: 3000, // in milliseconds numThumbs: 9, // The number of thumbnails to show page preloadAhead: 40, // Set to -1 to preload all images enableTopPager: false, enableBottomPager: false, maxPagesToShow: 8, // The maximum number of pages to display in either the top or bottom pager imageContainerSel: '#slideshow', // The CSS selector for the element within which the main slideshow image should be rendered controlsContainerSel: '#controls', // The CSS selector for the element within which the slideshow controls should be rendered captionContainerSel: '#caption', // The CSS selector for the element within which the captions should be rendered loadingContainerSel: '#loading', // The CSS selector for the element within which should be shown when an image is loading renderSSControls: true, // Specifies whether the slideshow's Play and Pause links should be rendered renderNavControls: true, // Specifies whether the slideshow's Next and Previous links should be rendered playLinkText: 'Vetítés', pauseLinkText: 'Szünet', prevLinkText: 'Előző', nextLinkText: 'Következő', nextPageLinkText: 'Következő ›', prevPageLinkText: '‹ Előző', enableHistory: false, // Specifies whether the url's hash and the browser's history cache should update when the current slideshow image changes enableKeyboardNavigation: true, // Specifies whether keyboard navigation is enabled autoStart: false, // Specifies whether the slideshow should be playing or paused when the page first loads syncTransitions: false, // Specifies whether the out and in transitions occur simultaneously or distinctly defaultTransitionDuration: 1000, // If using the default transitions, specifies the duration of the transitions onSlideChange: undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... } onTransitionOut: undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... } onTransitionIn: undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... } onPageTransitionOut: function(callback) { this.fadeTo('fast', 0.0, callback); }, onPageTransitionIn: function() { var prevPageLink = this.find('a.prev').css('visibility', 'hidden'); var nextPageLink = this.find('a.next').css('visibility', 'hidden'); // Show appropriate next / prev page links if (this.displayedPage > 0) prevPageLink.css('visibility', 'visible'); var lastPage = this.getNumPages() - 1; if (this.displayedPage < lastPage) nextPageLink.css('visibility', 'visible'); this.fadeTo('fast', 1.0); }, //onPageTransitionOut: undefined, // accepts a delegate like such: function(callback) { ... } //onPageTransitionIn: undefined, // accepts a delegate like such: function() { ... } onImageAdded: undefined, // accepts a delegate like such: function(imageData, $li) { ... } onImageRemoved: undefined // accepts a delegate like such: function(imageData, $li) { ... } }); /**************** Event handlers for custom next / prev page links **********************/ gallery.find('a.prev').click(function(e) { gallery.previousPage(); e.preventDefault(); }); gallery.find('a.next').click(function(e) { gallery.nextPage(); e.preventDefault(); }); /****************************************************************************************/ /**** Functions to support integration of galleriffic with the jquery.history plugin ****/ // PageLoad function // This function is called when: // 1. after calling $.historyInit(); // 2. after calling $.historyLoad(); // 3. after pushing "Go Back" button of a browser /*function pageload(hash) { // alert("pageload: " + hash); // hash doesn't contain the first # character. if(hash) { $.galleriffic.gotoImage(hash); } else { gallery.gotoIndex(0); } } // Initialize history plugin. // The callback is called at once by present location.hash. $.historyInit(pageload, "advanced.html"); // set onlick event for buttons using the jQuery 1.3 live method $("a[rel='history']").live('click', function(e) { if (e.button != 0) return true; var hash = this.href; hash = hash.replace(/^.*#/, ''); // moves to a new page. // pageload is called at once. // hash don't contain "#", "?" $.historyLoad(hash); return false; });*/ } $('.photobox').each(function (i) { id = $(this).attr('id').substring(9); $(this).refreshPhotobox(id); }); $('div#header').everyTime(10000, function(i) { set = $('.photobox'); set.each(function (i) { id = $(this).attr('id').substring(9); $(this).refreshPhotobox(id); }); }); $('div#product-gallery div#actual-picture img').resizeElem(500); $('div#product-gallery div#actual-picture img').show(); currDate = new Date(); var currYear = currDate.getFullYear() + 10; if (mbPortal.currLang == 'en') { $.datepicker.setDefaults($.datepicker.regional['en-GB']); } else { $.datepicker.setDefaults($.datepicker.regional[mbPortal.currLang]); } $.datepicker.setDefaults($.extend({ showMonthAfterYear: false, minDate: mbPortal.minDate, constrainInput: true, yearRange: '1920:' + currYear, showOtherMonths: false, numberOfMonths: 2, showWeek: true, firstDay: 1 }) ); if ($('#ship-method-form input#date').length > 0) { $('#ship-method-form input#date').parents('.element-form').css('margin-top', '10px'); $('#ship-method-form input#date').parent().datepicker({ minDate: $('input#date').val(), onSelect: function(dateText, inst) { $('input#date').val(dateText); } }); } $('#item-list tr .item-list-description').hover( function () { var jq = $(this).find('.product-info-bubble'); if (jq.css('display') == 'none') { jq.fadeIn('slow'); } $().mousemove(function (e) { jq.css('top', e.pageY + 'px').css('left', e.pageX + 'px'); }); }, function () { $(this).find('.product-info-bubble').fadeOut('fast'); } ); $('.lang-change').click(function () { lang = $(this).attr('id').replace('language-', ''); $.cookie('language', lang, { path: '/'}); document.location.reload(true); }); /* $('#language-change-hu').click(function () { $.cookie('language', 'hu', { path: '/'}); document.location.reload(true); }); $('#language-change-en').click(function () { $.cookie('language', 'en', { path: '/'}); document.location.reload(true); }); */ $('a#registerBtn').hover(function() { $(this).addClass('ui-state-highlight'); },function () { $(this).removeClass('ui-state-highlight'); }); $('#shopping-cart-form .order-qty').checkOrderQty(); if (mbPortal.itemBoxChangeInterval > 0) { $('div#itembox-new').everyTime(mbPortal.itemBoxChangeInterval, function(i) { $.fn.refreshItembox('new'); }); } if (mbPortal.itemBoxChangeInterval > 0) { $('div#itembox-offer').everyTime(mbPortal.itemBoxChangeInterval, function(i) { $.fn.refreshItembox('offer'); }); } if (mbPortal.itemBoxChangeInterval > 0) { $('div#offer-category-box').everyTime(mbPortal.itemBoxChangeInterval, function(i) { $.fn.refreshCategorybox('offer'); }); $('div#new-category-box').everyTime(mbPortal.itemBoxChangeInterval, function(i) { $.fn.refreshCategorybox('new'); }); } $('#select-abc-list').change(function () { if ($(this).val.length > 0) document.location.href='/products/index/Category_Id/'+$(this).val(); }); if ($('#shopping-cart-create').length > 0) { $('#shopping-cart-create input#itemno').focus(); } $('#shopping-cart-create').validateCartCreateForm(); $('#shopping-cart-create').submit(function () { var no = $('#shopping-cart-create #itemno'); var desc = $('#shopping-cart-create #itemdesc'); var qty = $('#shopping-cart-create #orderqty'); if (no.val().length == 0) { alert('Kérem adjon meg cikkszámot!'); no.focus(); return false; } var val = parseFloat($(this).find('.order-qty').val()); var minVal = parseFloat($(this).find('.min-order-qty').html()); var inv = parseFloat($(this).find('.inventory').text()); val = (isNaN(val) ? 0 : val); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); inv = (isNaN(inv) ? 0 : inv); if (val < minVal) { if (confirm(sprintf(mbPortal.captions.Min_Qty, minVal))) { val = minVal; $(this).find('.order-qty').val(minVal); } else { return false; } } if (val % minVal != 0) { var mul = Math.ceil(val / minVal); var newVal = mul * minVal; if (confirm(sprintf(mbPortal.captions.Unit_Pack, minVal, newVal))) { $(this).find('.order-qty').val(newVal); } else { return false; } } return true; }); $('#itemcard-cart-form, #item-list .cart-form').keypress(function (e) { var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: var val = parseFloat($(this).find('.order-qty').val()); var minVal = parseFloat($(this).find('.min-order-qty').html()); var inv = parseFloat($(this).find('.inventory').text()); val = (isNaN(val) ? 0 : val); minVal = (isNaN(minVal) ? 1 : minVal); minVal = (minVal == 0 ? 1 : minVal); inv = (isNaN(inv) ? 0 : inv); if (val < minVal) { if (confirm(sprintf(mbPortal.captions.Min_Qty, minVal))) { val = minVal; $(this).find('.order-qty').val(minVal); } else { return false; } } if (val % minVal != 0) { var mul = Math.ceil(val / minVal); var newVal = mul * minVal; if (confirm(sprintf(mbPortal.captions.Unit_Pack, minVal, newVal))) { $(this).find('.order-qty').val(newVal); } else { return false; } } return true; break; } }); $('#shopping-cart-form').keypress(function (e) { var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: return false; break; } }); $('#wcag-view').click(function () { if ($.cookie('wcag')) { $.cookie('wcag', null, {path: '/'}); } else { $.cookie('wcag', 1, {path: '/'}); } document.location.reload(true); }); if ($('#shopping-progress').length > 0) { $('.shopping-step').each (function () { $(this).keypress(function (e) { var elem = $(this); var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: $(this).find('form').submit(); return false; break; } }); }); } /*$('.language-change').click(function () { lang = $(this).attr('id').replace('language-', ''); $.cookie('language', lang, { path: '/'}); document.location.reload(true); });*/ $('#itemselectedall').click(function() { if ($(this).attr('checked')) { $('.item-selected').attr('checked', true); } else { $('.item-selected').attr('checked', false); } }); $('input.order-qty').each(function () { $(this).keyup(function() { $(this).parent().next().next().attr('checked', true); }); }); $('.item-selected').click(function() { var elem = $(this).prev().prev().find('.order-qty'); if ($(this).attr('checked')) { elem.focus(function () { $(this).select(); }); elem.focus(); } else { elem.blur(); } }); $('.displaybox-unit input:button, .displaybox-minorder input:button').button(); $('#shopping-cart-form').keypress(function (e) { var code = (e.keyCode ? e.keyCode : e.which); switch(code) { case 13: return false; break; } }); $('#item-card-info-img').hover( function () { $('#item-card-info-bubble').show('slow'); }, function () { $('#item-card-info-bubble').hide('slow'); } ); if ($('#item-variants-info-bubble').length > 0) { $('tr td#item-variant-description').hover( function() { $(this).find('#item-variants-info-bubble').show('slow'); }, function() { $(this).find('#item-variants-info-bubble').hide('slow'); }); } if ($("#popup-dialog").length > 0) { $("#popup-dialog").dialog({ bgiframe: true, position: [mbPortal.popupHPos,mbPortal.popupVPos], height: mbPortal.popupHeight, width: mbPortal.popupWidth, modal: true, show: mbPortal.popupAnimation, overlay: { backgroundColor: '#000', opacity: 0.5 }, buttons: { /*Ok: function() { $(this).dialog('destroy'); }*/ }, close: function(event, ui) { $(this).dialog('destroy'); } }); } /*if (mbPortal.domainId != 3 && $('input#Subtype').length > 0) { if ($('input#Subtype').val() == 'Company') { $('input#VAT_Registration_No').parent().parent().append('
'+mbPortal.captions.VAT_Text_2+'
'); $('input#Community_Tax_Number').keyup(function () { if ($(this).val().length > 0) { if ($('#vat-text').length == 0) { $(this).parent().parent().append('
'+mbPortal.captions.VAT_Text+'
'); } else { $('#vat-text').show(); } } else { $('#vat-text').hide(); } }); } }*/ if ($('#form1').length > 0) { no = $('#form1 #No'); no.autocomplete({ source: '/core/catalog/item/autocompleteitem/field/No', minLength: 1, select: function(event, ui) { no.val(ui.item.value); } }); desc = $('#form1 #Description'); desc.autocomplete({ source: '/core/catalog/item/autocompleteitem/field/Description', minLength: 1, select: function(event, ui) { desc.val(ui.item.value); } }); } $('#mb-carousel').jCarouselLite({ btnNext: ".j-next", btnPrev: ".j-prev", visible: 10, start: 0, circular: false, scroll: 1 }); $('#mb-carousel').width('1150px'); $('#mb-carousel').height('105px'); // $('#mb-carousel-ul').width('auto'); $('#mb-carousel-ul .jcarousel-item').width('75px'); $('#mb-carousel-ul .jcarousel-item').height('105px'); $('.cart-submit-btn').button({ icons: { primary: "ui-icon-cart" }, text: true }); $('.wishlist-submit-btn').button({ icons: { primary: "ui-icon-script" }, text: false }); if ($('.variant-box').length > 0) { if ($('div.variant-type-30 ').length > 0) { var elementName = $('div.variant-type-30 select').attr('name'); var itemId = elementName.substring(elementName.indexOf("_")+1, elementName.indexOf("[")); var val = $('div.variant-type-30 select[name=[variants-' + itemId + ']]>option:selected').attr('name'); if (val == 'Egyedi_felirat_nelkül') { $('div.variant-type-4 select').attr('disabled', 'disabled'); $('div.variant-type-4 select').addClass('select-inactive'); } $('.variant-type-30').change(function() { var val = $(this).find('option:selected').attr('name'); if (val == 'Egyedi_felirat_nelkül') { $('div.variant-type-4 select').attr('disabled', 'disabled'); $('div.variant-type-4 select').addClass('select-inactive'); } else { $('div.variant-type-4 select').removeAttr('disabled'); $('div.variant-type-4 select').removeClass('select-inactive'); } }) } } $('.button80, .button100, .button150, input[type=button], input[type=submit]').button(); if ($('#cart-form').length > 0) { $.ajax({ type: "POST", url: '/frontend/catalog/list/getscroll', success: function(msg) { if (msg != '') { var row = $('#item-list').find('#row-'+msg ); if( (window.location.pathname == '/categories/gyerek') || (window.location.pathname == '/categories/baba') || (window.location.pathname == '/categories/lanyoknak') || (window.location.pathname == '/categories/fiuknak') || (window.location.pathname == '/categories/fonalak') || (window.location.pathname == '/categories/karacsonyi_teritok') || (window.location.pathname == 'categories/kezzel_himzett_kezimunka') || (window.location.pathname == 'categories/noi_kismama') || (window.location.pathname == '/categories/egyedi_feliratos_termekek') || (window.location.pathname == '/categories/K051')) { $('html, body').animate({ scrollTop: row.offset().top }, 2000); } else if ((window.location.pathname != '/home') && (window.location.pathname != '/')) { $('html, body').animate({ scrollTop: row.offset().top }, 2000); } } else { if( (window.location.pathname == '/categories/gyerek') || (window.location.pathname == '/categories/baba') || (window.location.pathname == '/categories/lanyoknak') || (window.location.pathname == '/categories/fiuknak') || (window.location.pathname == '/categories/fonalak') || (window.location.pathname == '/categories/karacsonyi_teritok') || (window.location.pathname == 'categories/kezzel_himzett_kezimunka') || (window.location.pathname == 'categories/noi_kismama') || (window.location.pathname == '/categories/egyedi_feliratos_termekek') || (window.location.pathname == '/categories/K051')) { $('html, body').animate({ scrollTop: $("#category-scroller").offset().top }, 2000); } else if ((window.location.pathname != '/home') && (window.location.pathname != '/')) { $('html, body').animate({ scrollTop: $("#content").offset().top }, 2000); } } } }); } else { if( (window.location.pathname == '/categories/gyerek') || (window.location.pathname == '/categories/baba') || (window.location.pathname == '/categories/lanyoknak') || (window.location.pathname == '/categories/fiuknak') || (window.location.pathname == '/categories/fonalak') || (window.location.pathname == '/categories/karacsonyi_teritok') || (window.location.pathname == 'categories/kezzel_himzett_kezimunka') || (window.location.pathname == 'categories/noi_kismama') || (window.location.pathname == '/categories/egyedi_feliratos_termekek') || (window.location.pathname == '/categories/K051')) { $('html, body').animate({ scrollTop: $("#category-scroller").offset().top }, 2000); } else if ((window.location.pathname != '/home') && (window.location.pathname != '/')) { $('html, body').animate({ scrollTop: $("#content").offset().top }, 2000); } } if ($('#detailed-search-form').length > 0) { $('#detailed-search-form .mb-multick').parent().parent().addClass('mb-multi-checkbox'); $('#detailed-search-form .mb-multick').parent().addClass('mb-multi-checkbox-line'); } if ($('#filter-top').length > 0 || $('#filter-bottom').length > 0) { $('#field-top').change(function() { href = window.location.href; splitted = href.split('/'); fpos = splitted.indexOf('field'); if (fpos >= 0) { splitted[fpos+1] = $('#field-top').val(); href = splitted.join('/'); } else { href = href + '/field/' + $('#field-top').val(); } window.location.href = href; }) $('#field-bottom').change(function() { href = window.location.href; splitted = href.split('/'); fpos = splitted.indexOf('field'); if (fpos >= 0) { splitted[fpos+1] = $('#field-bottom').val(); href = splitted.join('/'); } else { href = href + '/field/' + $('#field-bottom').val(); } window.location.href = href; }) $('#sort-top').change(function() { href = window.location.href; splitted = href.split('/'); spos = splitted.indexOf('sort'); if (spos >= 0) { splitted[spos+1] = $('#sort-top').val(); href = splitted.join('/'); } else { href = href + '/sort/' + $('#sort-top').val(); } window.location.href = href; }) $('#sort-bottom').change(function() { href = window.location.href; splitted = href.split('/'); spos = splitted.indexOf('sort'); if (spos >= 0) { splitted[spos+1] = $('#sort-bottom').val(); href = splitted.join('/'); } else { href = href + '/sort/' + $('#sort-bottom').val(); } window.location.href = href; }) $('#count-top').change(function() { href = window.location.href; splitted = href.split('/'); cpos = splitted.indexOf('count'); if (cpos >= 0) { splitted[cpos+1] = $('#count-top').val(); href = splitted.join('/'); } else { href = href + '/count/' + $('#count-top').val(); } window.location.href = href; }) $('#count-bottom').change(function() { href = window.location.href; splitted = href.split('/'); cpos = splitted.indexOf('count'); if (cpos >= 0) { splitted[cpos+1] = $('#count-bottom').val(); href = splitted.join('/'); } else { href = href + '/count/' + $('#count-bottom').val(); } window.location.href = href; }) } });