var hook_cookie = getCookie('hook_cookie'); function makeid(length) { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; for ( var i = 0; i < length; i++ ) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } function getUserCookie() { var cookie = getCookie('mkUserCookie'); var localS = localStorage.getItem('mkUserCookie'); if(cookie && !localS) localS = cookie; if(localS && !cookie) cookie = localS; if(cookie || localS) return cookie; return false; } function createUserCookie() { var mkid = makeid(10)+'_'+Date.now(); setCookie('mkUserCookie', mkid, 999); window.localStorage.setItem("mkUserCookie",mkid); } jQuery(document).ready(function(){ if(!getUserCookie()) createUserCookie(); if(outerWidth < 1159) { /* $('body').on('click','#left_column .block_title', function(){ var parent_block = jQuery(this).parent().parent(); if(parent_block.hasClass('expanded')) { jQuery('#left_column .block_content').removeClass('expanded'); jQuery('.filter_tag').removeClass('expanded_filter'); parent_block.removeClass('expanded'); //parent_block.find('.filter_tag').removeClass('expanded_filter'); } else { jQuery('.filter_tag').removeClass('expanded_filter'); jQuery('#left_column .block_content').removeClass('expanded'); parent_block.addClass('expanded'); parent_block.find('.filter_tag').addClass('expanded_filter'); } }); */ $('body').on('click','.t_f button', function(){ var rel = jQuery(this).attr('rel'); jQuery('#inner_left_collumn .block_content').removeClass('expanded'); jQuery(rel).addClass('expanded'); }); } jQuery('body').on('click', '#accept_cookie', function(){ setCookie('cookie_law',1,9999999); $("#cookie_law").remove(); }); if (typeof display_cookie_law !== 'undefined') { if(display_cookie_law == 1) { if(!getCookie('cookie_law')) { if($("#cookie_law").length > 0) { var el = $("#cookie_law")[0].outerHTML; $("#cookie_law").remove(); $("#clw").html(el); $("#cookie_law").show(); } } else { jQuery("#cookie_law").remove(); } } } var ref_string = ''; var last_source = ''; var last_source_token = ''; if (document.referrer) { if(document.referrer.length > 5) { if(document.referrer.indexOf(location.protocol + "//" + location.host) === -1) { var ref = document.referrer.toLowerCase(); if ( (ref.search("aclk?") >= 0) || (ref.search("www.googleadservices.com") >= 0) || (ref.search("gclid?") >= 0) ) { ref_string += 'googleppc'; last_source = 'googleppc'; if(getParam('gclid')) { ref_string += ',gclid_'+getParam('gclid'); ref_string += ',lp_'+object_type+'_'+object_id; last_source_token = getParam('gclid'); } } else if ( ( ref.search("google.") >= 0) ) { if(getParam('gclid')) { ref_string += 'googleppc'; ref_string += ',gclid_'+getParam('gclid'); ref_string += ',lp_'+object_type+'_'+object_id; last_source_token = getParam('gclid'); last_source = 'googleppc'; } else { ref_string += 'googleorganic'; last_source = 'googleorganic'; ref_string += ',lp_'+object_type+'_'+object_id; // last_source_token = ''; } } else if ( ref.search("yahoo") >= 0 ) { ref_string += 'yahooorganic'; last_source = 'yahooorganic'; } else if ( ref.search("bing") >= 0 ) { ref_string += 'bingorganic'; ref_string += ',lp_'+object_type+'_'+object_id; last_source = 'bingorganic'; } else if ( ref.search("facebook.com") >= 0 ) { last_source = 'facebook'; ref_string += 'facebook.com'; if(getParam('fbclid')) { last_source_token = getParam('fbclid'); } } var utm_source = getParam('utm_source'); var utm_medium = getParam('utm_medium'); var utm_campaign = getParam('utm_campaign'); var utm_term = getParam('utm_term'); var utm_content = getParam('utm_content'); if(utm_source) ref_string += ',utmsource_'+utm_source; if(utm_medium) ref_string += ',utmmedium_'+utm_medium; if(utm_campaign) ref_string += ',utmcampaign_'+utm_campaign; if(utm_term) ref_string += ',utmterm_'+utm_term; if(utm_content) ref_string += ',utmcontent_'+utm_content; ref_string = ref_string.replace("-", "_"); if(last_source.length > 1) setCookie('session_last_source', last_source, 1); if(last_source_token.length > 1) setCookie('session_last_source_token', last_source_token, 1); if(ref_string.length > 1) setCookie('session_source', ref_string, 1); setCookie('session_last_source_date', Date.now(), 1); } } } function check_login_hash() { if (window.location.hash) { if (window.location.hash.indexOf('login') == 1) { if(is_logged_in) return false; show_login_form(); } } } check_login_hash(); jQuery('.toggle_show_more').click(function(){ jQuery('.category_description ').removeClass('collapse-offset'); jQuery('.category_description ').html(jQuery('#template-description-full').html()); jQuery('.toggle_show_more').remove(); return false; }); if(load_more_button_listing >= 1) { function go_to_idp_hash() { if (window.location.hash) { if (window.location.hash.indexOf('idp') == 1) { var idp = window.location.hash.replace("#idp_", ""); window.location.hash = ''; history.pushState("", document.title, window.location.pathname+ window.location.search); setTimeout(function(){ var element_top = $('a.product_img_link[idp="' + idp + '"]').offset().top- 20; jQuery(window).scrollTop(element_top); setTimeout(function(){ var element_top = $('a.product_img_link[idp="' + idp + '"]').offset().top - 20; jQuery(window).scrollTop(element_top); }, 300); }, 300); } } } go_to_idp_hash(); jQuery(document).on('click', '.ias-trigger-prev', function(){ /* var idp = jQuery('.product_list .product_img_link:eq(0)').attr('idp'); if(idp) { if(history.pushState) { history.pushState(null, null, '#idp_'+idp); } else { location.hash = '#idp_'+idp; } } */ }); //if(jQuery('.pagination_right').length >= 1) //{ var ias = jQuery.ias({ container: '.product_list', item: '.ajax_block_product', pagination: '.bottom_pagination .pagination', next: '.bottom_pagination .pagination_right', prev: '.bottom_pagination .pagination_left' }); ias.extension(new IASSpinnerExtension({src: SITE_URL+'/img/loading.gif'})); if(load_more_button_listing == 1) ias.extension(new IASTriggerExtension({ text: load_next, textPrev: load_prev, offset: 1})); else ias.extension(new IASTriggerExtension({ text: load_next, textPrev: load_prev, offset: 99999})); ias.extension(new IASNoneLeftExtension({text: load_more_end })); ias.extension(new IASPagingExtension()); ias.extension(new IASHistoryExtension({prev: '.bottom_pagination .pagination_left'})); ias.on('rendered', function(items) { var total_products = jQuery('.product_list .ajax_block_product').length; jQuery('.current_viewd_load').text(total_products); jQuery('._2hirsSG').attr('value', total_products); }); ias.on('rendered', function(event) { go_to_idp_hash(); }) jQuery('#center_column').on('click', '.ajax_block_product .product_img_link, .ajax_block_product .product-name', function(){ var idp = jQuery(this).attr('idp'); /* if(idp) { if(history.pushState) { history.pushState(null, null, '#idp_'+idp); } else { location.hash = '#idp_'+idp; } } */ }); // } } if(newsletter_pop_up === 1) { var time_interval_true = false; var page_browsed_true = false; if(newsletter_pop_pages > 0) { var pages_browsed = 1; if(getCookie('pages_browsed')) { pages_browsed = parseInt(getCookie('pages_browsed')) + 1; setCookieHours('pages_browsed', pages_browsed, 2); } else { setCookieHours('pages_browsed', 1, 2); } if(pages_browsed > newsletter_pop_pages) page_browsed_true = true; } else { page_browsed_true = true; } if(newsletter_pop_delay > 0) { var time_spent = 0; var time_interval = setInterval(function(){ time_spent++; if(time_spent == newsletter_pop_delay) { time_interval_true = true; if(page_browsed_true) { display_newsletter(0, true); } clearInterval(time_interval); } }, 1000); } else { time_interval_true = true; if(page_browsed_true) { display_newsletter(0, true); } } if( (time_interval_true == false || page_browsed_true == false) && newsletter_exit_intent == 1) { jQuery('#quick_register_overlay').removeClass('db'); jQuery('.quick_register').addClass('closed_subscription'); display_newsletter(1, false); } } if(direct_link === 1) { setTimeout(function(){ jQuery('body').on('click','.product_img_link', function(){ var idp = parseInt(jQuery(this).attr('idp')); if(idp > 0) { add_to_recently_viewed(idp); if(has_ga) { gtag('event', 'go_to_shop_listing', {'product': idp}); } if (owidth > 980) window.open( SITE_URL+'/external.php?id='+idp , '_blank'); else window.location = SITE_URL+'/external.php?id='+idp; return false; } }); }, 100); } if(fb_float == 1) { if(owidth > 760) { if(fb_float_page.length > 10) { jQuery('body').prepend('
'); setTimeout(function() { document.getElementById('fb-like-box-fixed-iframe')['src'] = 'https://www.facebook.com/plugins/like.php?href='+encodeURI(fb_float_page)+'&locale=ro_RO&width&layout=box_count&action=like&show_faces=false&share=false&height=65&appId=653348031526002'; }, 5); } } } $('.star_content').rating(); if(jQuery('.product-reviews-global').length > 0) { setTimeout(function(){ var total_comments = jQuery('#total_comments').val(); var current_comments = jQuery('.comment').length; if(current_comments < total_comments) { var answer = ajax_call( { action: 'load_comments_global', token: TOKEN, offset: current_comments, id_lang: ID_LANG }, false); if(answer.error == 0) { var html = ''; answer.error_msg.forEach(function(entry) { var stars = ''; for(i = 1; i<= entry.rating; i++) stars += '
'; for(i = 1; i<= (5 - entry.rating); i++) stars += '
'; html += '
'+ stars+'
'+entry.date_format+'

'+entry.title+'

'+entry.comment+'

'; }); jQuery('#global_comments').append(html); current_comments = jQuery('.comment').length; if(current_comments >= total_comments) { jQuery('.load_more_comments_global').remove(); } } } }, (4000)); } jQuery('#load_more_comments_global').click(function(){ var total_comments = jQuery('#total_comments').val(); var current_comments = jQuery('.comment').length; if(current_comments < total_comments) { var answer = ajax_call( { action: 'load_comments_global', token: TOKEN, offset: current_comments, id_lang: ID_LANG }, false); if(answer.error == 0) { var html = ''; answer.error_msg.forEach(function(entry) { var stars = ''; for(i = 1; i<= entry.rating; i++) stars += '
'; for(i = 1; i<= (5 - entry.rating); i++) stars += '
'; html += '
'+ stars+'
'+entry.date_format+'

'+entry.title+'

'+entry.comment+'

'; }); jQuery('#global_comments').append(html); current_comments = jQuery('.comment').length; if(current_comments >= total_comments) { jQuery('.load_more_comments_global').remove(); } } } else { jQuery('.load_more_comments').remove(); } }); jQuery('#submitReviewGlobal').click(function(){ var rating = 4; var comment_title = jQuery('#comment_title').val(); var comment_content = jQuery('#comment_content').val(); var customer_name = jQuery('#customer_name').val(); if(comment_title.length == 0 || comment_content.length == 0 || customer_name.length == 0) { display_error('All fields are mandatory'); return false; } rating = parseFloat($(".stars .star.fullStar").last().attr('title')); var answer = ajax_call( { action: 'add_comment_global', comment_title: comment_title, comment_content: comment_content, customer_name: customer_name, token: TOKEN, rating: rating, id_lang: ID_LANG }, false); if(answer.error == 0) { jQuery('#id_new_comment_form').html('
'+answer.error_msg+'
'); } return false; }); if(parseInt(display_category_image_overlay ) == 1) { if(jQuery('.category_overlay_load_ajax').length == 1) { setTimeout(function(){ var response_u = $.ajax({ url: SITE_URL + '/ajaxCall.php' , type: "POST", data: { action: 'load_display_category_image_overlay', token: TOKEN, id_lang: ID_LANG }, async:true }).done(function(response_u) { obj = JSON.parse(response_u); if(obj.categories) { jQuery('.categories_overlay_top_Wrapper').html(obj.categories); if(outerWidth >= 1199) { $('.sslider').on('init', function(event, slick, direction){ jQuery(this).removeClass('ohweb'); }).slick({ slidesToShow: 7, slidesToScroll: 3, dots: true, infinite: false, cssEase: 'linear', swipeToSlide: true }); } } else { jQuery('.category_overlay_load_ajax').remove(); } }); }, ( 200)); } else { if(outerWidth >= 1199) { $('.sslider').on('init', function(event, slick, direction){ jQuery(this).removeClass('ohweb'); }).slick({ slidesToShow: 7, slidesToScroll: 3, dots: true, infinite: false, cssEase: 'linear', swipeToSlide: true }); } } } if(parseInt(AJAX_LOAD ) == 1) { setTimeout(function(){ var response_u = $.ajax({ url: SITE_URL + '/ajaxCall.php' , type: "POST", data: { action: 'load_filters', token: TOKEN, id_lang: ID_LANG }, async:true }).done(function(response_u) { obj = JSON.parse(response_u); jQuery('#left_column .timeline-wrapper').remove(); if(obj.categories) { var rel = ''; if(category_rel == 1) rel = ' rel="nofollow" '; var category_li = ''; var manuf_search = ''; if(obj.categories.length > 0) { for (var i = 0, len = obj.categories.length; i < len; i++) { var selected = ''; if(obj.selected_category) { if( obj.categories[i].id_category == obj.selected_category ) selected = ' class="selected" '; } var small_b = ''; if(obj.categories[i].product_count) small_b = ' '+obj.categories[i].product_count+''; category_li += '
  • '+obj.categories[i].category_name+small_b+'
  • '; } } total_categories = obj.categories.length; if(obj.categories.length > 12) manuf_search = '
    '; var categorys_html = '
    '+manuf_search+'
      '+category_li+'
    '; jQuery('#categories_block_left').html(categorys_html); jQuery('#categories_block_left').addClass('block tree_block'); } if(obj.manufacturers) { var rel = ''; if(manufacturer_rel == 1) rel = ' rel="nofollow" '; var manufacturer_li = ''; var manuf_search = ''; if(obj.manufacturers.length > 0) { for (var i = 0, len = obj.manufacturers.length; i < len; i++) { var selected = ''; if(obj.selected_manufacturer) { if( obj.manufacturers[i].id_manufacturer == obj.selected_manufacturer ) selected = ' class="selected" '; } var small_b = ''; if(obj.manufacturers[i].product_count) small_b = ' '+obj.manufacturers[i].product_count+''; manufacturer_li += '
  • '+obj.manufacturers[i].manufacturer_name+small_b+'
  • '; } } total_manufacturers = obj.manufacturers.length; if(obj.manufacturers.length > 12) manuf_search = '
    '; var manufacturers_html = '
    '+manuf_search+'
      '+manufacturer_li+'
    '; jQuery('#manufacturers_block_left').html(manufacturers_html); jQuery('#manufacturers_block_left').addClass('block tree_block'); ajax_manuf_scroll(); } if(obj.suppliers) { var rel = ''; if(supplier_rel == 1) rel = ' rel="nofollow" '; var supplier_li = ''; var sup_search = ''; if(obj.suppliers.length > 0) { for (var i = 0, len = obj.suppliers.length; i < len; i++) { var selected = ''; if(obj.selected_supplier) { if( obj.suppliers[i].id_supplier == obj.selected_supplier ) selected = ' class="selected" '; } var small_b = ''; if(obj.suppliers[i].product_count) small_b = ' '+obj.suppliers[i].product_count+''; supplier_li += '
  • '+obj.suppliers[i].supplier_name+small_b+'
  • '; } } if(obj.suppliers.length > 12) sup_search = '
    '; var suppliers_html = '
    '+sup_search+'
      '+supplier_li+'
    '; jQuery('#suppliers_block_left').html(suppliers_html); jQuery('#suppliers_block_left').addClass('block tree_block'); } if(obj.colors) { var rel = ''; if(color_rel == 1) rel = ' rel="nofollow" '; var color_li = ''; if(obj.colors.length > 0) { for (var i = 0, len = obj.colors.length; i < len; i++) { var selected = ''; if(obj.selected_color) { if( obj.colors[i].id_color == obj.selected_color ) selected = 'selected_color'; } var small_b = ''; if(obj.colors[i].product_count) small_b = ' '+obj.colors[i].product_count+''; color_li += ''; } } var colors_html = '
    '+color_li+'
    '; jQuery('#color_block_left').html(colors_html); jQuery('#color_block_left').addClass('block tree_block'); } if(obj.min_discount) { var rel = ''; if(disc_rel == 1) rel = ' rel="nofollow" '; var min_li = ''; if(obj.min_discount.length > 0) { for (var i = 0, len = obj.min_discount.length; i < len; i++) { var selected = ''; if(obj.selected_min_discount) { if( obj.min_discount[i].value2 == obj.selected_min_discount ) selected = ' class="selected" '; } if(obj.min_discount[i].value2 == 1) var disc_name = min_disc_1; else var disc_name = min_disc_rest + ' '+obj.min_discount[i].value2+'%'; var small_b = ''; if(obj.min_discount[i].product_count) small_b = ' '+obj.min_discount[i].product_count+''; min_li += '
  • '+disc_name+ small_b +'
  • '; } } var min_disc_html = '
    '; jQuery('#discount_block_left').html(min_disc_html); jQuery('#discount_block_left').addClass('block tree_block'); } }); }, ( AJAX_TIME_DELAY * 1000)); } jQuery('.open-comment-form-global').click(function(){ jQuery('#show_comment_form').fadeIn(); $([document.documentElement, document.body]).animate({ scrollTop: $("#show_comment_form").offset().top }, 300); return false; }); jQuery('#newsletterform').submit(function(){ var email = jQuery('#newsletter-input').val(); var answer = ajax_call( { action: 'newsletter_submit', email: email, token: TOKEN, id_lang: ID_LANG }, false); if(answer.error == 0) { jQuery('#newsletter_block_left').html('
    '+answer.error_msg+'
    '); } return false; }); jQuery('body').on('click', '.require_login',function(){ if(is_logged_in == false) { show_login_form(); return false; } }); jQuery('#submitNewsletter').click(function(){ var email = jQuery('#newsletter-input').val(); if(!validateEmail(email)) return false; var answer = ajax_call( { action: 'newsletter_submit', email: email, token: TOKEN, id_lang: ID_LANG }, false); if(answer.error == 0) { jQuery('#newsletter_block_left').html('
    '+answer.error_msg+'
    '); } return false; }); if(jQuery('#manuf_scroll li').length > 0) {ajax_manuf_scroll();} if(jQuery('#manufacturers_block_left .selected').length > 0) { var parent = $('#manuf_scroll'); var item = $('#manuf_scroll a.selected'); scrollToCenter(item, parent, 200); } jQuery('.search_categories').keyup(function(){ var value = jQuery(this).val().toLowerCase(); jQuery('#categories_block_left ul li').hide(); jQuery('#categories_block_left ul a').each(function(){ var text = jQuery(this).text().toLowerCase(); if(value.length == 0) { jQuery('#categories_block_left ul li').show(); //return false; } else { if(text.indexOf(value) !== -1) { jQuery(this).parent().show(); } } }); }); jQuery('.paginationInput').keyup(function(){ var page = jQuery(this).val(); window.location = document.location.pathname + addUrlParam(document.location.search, 'p', page); }); jQuery('.selectProductSort').change(function(){ var page = jQuery(this).val(); window.location = document.location.pathname + addUrlParam(document.location.search, 'sort', page); }); jQuery('body').on('keyup', '.search_suppliers',function(){ var value = jQuery(this).val().toLowerCase(); jQuery('#suppliers_block_left ul li').hide(); jQuery('#suppliers_block_left ul a').each(function(){ var text = jQuery(this).text().toLowerCase(); if(value.length == 0) { jQuery('#suppliers_block_left ul li').show(); //return false; } else { if(text.indexOf(value) !== -1) { jQuery(this).parent().show(); } } }); }); jQuery('body').on('keyup', '.search_manufacturers',function(){ var value = jQuery(this).val().toLowerCase(); jQuery('#manufacturers_block_left ul li').hide(); jQuery('#manufacturers_block_left ul a').each(function(){ var text = jQuery(this).text().toLowerCase(); if(value.length == 0) { jQuery('#manufacturers_block_left ul li').show(); //return false; } else { if(text.indexOf(value) !== -1) { jQuery(this).parent().show(); } } }); }); if($( "#price-range" ).length > 0) { var typingTimer; var doneTypingInterval = 1000; var min_internval = parseInt(jQuery('#min_internval').val()); var max_internval = parseInt(jQuery('#max_internval').val()); var current_min_internval = parseInt(jQuery('#current_min_interval').val()); var current_max_internval = parseInt(jQuery('#current_max_interval').val()); var formated_max_interval = jQuery('#formated_max_internval').val(); $( "#price-range" ).slider({ range: true, min: min_internval, draggable: true, max: max_internval, values: [ parseInt(current_min_internval), parseInt(current_max_internval)], slide: function( event, ui ) { $( "#amount" ).val( ui.values[ 0 ] + " - " + ui.values[ 1 ]); clearTimeout(typingTimer); typingTimer = setTimeout(function(){ price_pattern2 = 'https://' + price_pattern; //console.log( ui.values[1] ); price_pattern2 = price_pattern2.replace("{min-amount}", ui.values[0]); price_pattern2 = price_pattern2.replace("{max-amount}", ui.values[1]); //console.log(price_pattern); window.location = price_pattern2; }, doneTypingInterval); } }); $( "#amount" ).val( $( "#price-range" ).slider( "values", 0 ) + " - " + $( "#price-range" ).slider( "values", 1 ) ); } if(outerWidth > 1199) { $('.bxslider-vertical').bxSlider({ minSlides: 3, mode: 'vertical', maxSlides: 6, moveSlides: 1 , slideWidth: 55, adaptiveHeight: true, slideMargin: 10, pager: false, nextText: '', prevText: '', moveSlides:1, infiniteLoop:false, hideControlOnEnd: true, onSliderLoad: function(){ setTimeout(function(){ $(".lbx").removeClass('lbx'); }, 200); } }); $('.bxslider').bxSlider({ minSlides: 2, maxSlides: 6, slideWidth: 178, slideMargin: 20, pager: false, nextText: '', prevText: '', moveSlides:1, infiniteLoop:false, hideControlOnEnd: true, onSliderLoad: function(){ setTimeout(function(){ $(".lbx").removeClass('lbx'); }, 200); } }); $('.bxslider-full').bxSlider({ minSlides: 1, maxSlides: 1, pager: false, nextText: '', prevText: '', moveSlides:1, infiniteLoop:false, hideControlOnEnd: true, onSliderLoad: function(){ setTimeout(function(){ $(".lbx").removeClass('lbx'); }, 200); } }); } if(jQuery('body').hasClass('detail-products')) { $('.accordion').accordion({ "transitionSpeed": 400, "active": false }); if(outerWidth > 1199) { $('.bxslider').bxSlider({ minSlides: 3, maxSlides: 6, slideWidth: 35, slideMargin: 10, pager: false, nextText: '', prevText: '', moveSlides:1, infiniteLoop:false, hideControlOnEnd: true, onSliderLoad: function(){ setTimeout(function(){ $(".lbx").removeClass('lbx'); }, 200); } }); } } if(jQuery('body').hasClass('product')) { if(outerWidth <= 480) { var float_el = jQuery('.hook_shop_float'); if(float_el.length > 0) { float_el.clone().addClass('gtsf').removeClass('hook_shop_float').prependTo('#buy_block'); } } if(performant_code) { setTimeout(function(){ html = '
    '; html += '
    '+credit_text+' vivacredit.ro
    '; html += '
    • Fără giranți sau garanții
    • Fără adeverință de venit
    • Fără hârtii, totul e online
    '; html += '
    '; $(html).hide().appendTo('.box-cart-bottom').fadeIn(400); }, 2000); } add_to_recently_viewed(jQuery('#product_page_product_id').val()); jQuery('.share_trigger').click(function(){ jQuery('.share_wrap').toggleClass('db'); return false; }); $('.accordion').accordion({ "transitionSpeed": 400 }); jQuery('body').on('click', '#sign_to_price_alert', function(){ var email = jQuery('#email_price_alert').val(); if(!email) { display_error(email_is_not_valid); return false; } var answer = ajax_call( { action: 'create_price_altert', email: email, id_product: jQuery('#product_page_product_id').val(), id_lang: ID_LANG, token: TOKEN }, false); if(answer.error == 0) { jQuery('#price_alert_wrapper').html('
    '+email_price_alert_sign_up+'
    '); } return true; }); jQuery('.advancedwishlist_button_new').click(function(){ var html = '

    '+enter_email+'

    '; $.fancybox( html, { 'autoDimensions' : false, 'width' : 650, 'height' : 'auto', 'transitionIn' : 'none', 'transitionOut' : 'none' } ); return false; }); $('#thumbs_list_frame').bxSlider({mode:'vertical',slideMargin:5,minSlides:3,maxSlides:3,infiniteLoop:false});; jQuery('.load_more_comments').click(function(){ var total_comments = jQuery('#total_comments').val(); var current_comments = jQuery('.comment').length; if(current_comments < total_comments) { var answer = ajax_call( { action: 'load_comments', id_product: jQuery('#id_product_comment_send').val(), token: TOKEN, offset: current_comments, id_lang: ID_LANG }, false); if(answer.error == 0) { var html = ''; answer.error_msg.forEach(function(entry) { var stars = ''; for(i = 1; i<= entry.rating; i++) stars += '
    '; for(i = 1; i<= (5 - entry.rating); i++) stars += '
    '; html += '
    '+ stars+'
    '+entry.date_format+'

    '+entry.title+'

    '+entry.comment+'

    '; }); jQuery('#product_comments_block_tab').append(html); current_comments = jQuery('.comment').length; if(current_comments >= total_comments) { jQuery('.load_more_comments').remove(); } } } else { jQuery('.load_more_comments').remove(); } }); jQuery('.trigger_supplier_description, .trigger_return_policy, .trigger_term_conditions').click(function(){ if(jQuery('.supplier_description').text().length >= 2) return; var id = jQuery(this).attr('rel'); var answer = ajax_call( { action: 'get_supplier_description', id_supplier: id, token: TOKEN, id_lang: ID_LANG }, false); if(answer.error == 0) { jQuery('.supplier_description').html(answer.info.shipping.replace(/\\/g, '')); jQuery('.return_policy').html(answer.info.return_policy.replace(/\\/g, '')); jQuery('.term_conditions').html(answer.info.term_conditions.replace(/\\/g, '')); } return false; }); jQuery('#submitReview').click(function(){ var rating = 4; var comment_title = jQuery('#comment_title').val(); var comment_content = jQuery('#comment_content').val(); var customer_name = jQuery('#customer_name').val(); var id_product = jQuery('#id_product_comment_send').val(); if(comment_title.length == 0 || comment_content.length == 0 || customer_name.length == 0) { display_error('All fields are mandatory'); return false; } rating = $(".star_comment[type='radio']:checked").val(); var answer = ajax_call( { action: 'add_comment', comment_title: comment_title, comment_content: comment_content, customer_name: customer_name, id_product: id_product, token: TOKEN, rating: rating, id_lang: ID_LANG }, false); if(answer.error == 0) { jQuery('#id_new_comment_form').html('
    '+answer.error_msg+'
    '); } return false; }); if(has_ga) { jQuery('.go_to_shop').click(function(){ gtag('event', 'go_to_shop_single', {'product': jQuery(this).attr('pn')}); }); } jQuery('.open-comment-form').click(function(){ jQuery('#show_comment_form').fadeIn(); $([document.documentElement, document.body]).animate({ scrollTop: $("#show_comment_form").offset().top }, 300); return false; }); } jQuery('body').on('click','.like-element', function(){ like_product(this); }); jQuery('body').on('click','.save-element', function(){ save_product(this); }); jQuery('body').on('click','.collection_submit', function(){ add_to_collection(this); }); jQuery('body').on('click','#create_collection', function(){ create_collection(); }); jQuery('body').on('keypress','#new_collection_name', function(e){ if(e.keyCode == 13) { create_collection(); } }); jQuery('body').on('click','#close_global_pop, #global_pop_overlay', function(e){ jQuery('#global_pop').fadeOut(); if(outerWidth <= 480) { jQuery('#global_pop_overlay').hide(); } setTimeout(function(){ jQuery('#global_icon').fadeIn(); }, 400); setCookie('hook_cookie',1,1); }); jQuery('body').on('click','.close_detailed', function(e){ jQuery('.active_li').removeClass('active_li').removeClass('loaded_li'); jQuery('.loaded_jax_pi').remove(); window.history.pushState('', '', load_url); return false; }); jQuery('body').on('click','.ajax_load_pi', function(e){ var el = jQuery(this) jQuery('.active_li').removeClass('active_li').removeClass('loaded_li'); jQuery('.loaded_jax_pi').remove(); jQuery('.loading_li').remove(); el.closest('.ajax_block_product').addClass('active_li'); jQuery('.ajax_block_product.active_li').prepend('
    '); var per_row = 3; if(jQuery('#center_column').hasClass('per_row_4')) per_row = 4; var current_pos = parseInt($(".desktopHover .ajax_block_product").index($(".desktopHover .ajax_block_product.active_li"))) + 1; var current_dif = current_pos % per_row; window.history.pushState('', '', el.attr('href')); if(current_dif > 0) var pos = current_pos + ( per_row - (current_dif % per_row)) - 1 ; else var pos = current_pos - 1 ; if(pos >= $(".ajax_block_product").length) pos = $(".ajax_block_product").length - 1; $.ajax({ url: el.attr('href'), type:'GET', success: function(data){ var date_html = $(data).find('.product_detailed_parent').html(); $('.desktopHover').children('.ajax_block_product:eq('+pos+')').after('
  • '+date_html+'
  • '); jQuery('.loading_li').remove(); jQuery('.ajax_block_product.active_li').addClass('loaded_li'); $([document.documentElement, document.body]).animate({ scrollTop: $(".ajax_block_product.active_li").offset().top - 100 }, 200); } }); return false; }); jQuery('body').on('click','#global_icon', function(e){ jQuery('#global_pop').fadeIn(); MagicScroll.start(); remove_trial(); jQuery('#global_icon').hide(); if(outerWidth <= 480) { jQuery('#global_pop_overlay').show(); } setCookie('hook_cookie',1,-1); }); if(!hook_cookie || hook_cookie == 'false') { if(outerWidth <= 480) { setTimeout(function(){ jQuery('#global_icon').fadeIn(); }, 1000); } else { setTimeout(function(){ jQuery('#global_pop').fadeIn(); remove_trial(); }, 1000); } } else { setTimeout(function(){ jQuery('#global_icon').fadeIn(); }, 1000); } if(FB_APP_IP && FB_LOGIN) { (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); window.fbAsyncInit = function() { FB.init({ appId : FB_APP_IP, // Set YOUR APP ID channelUrl : SITE_URL, // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); /* FB.Event.subscribe('auth.authResponseChange', function(response) { if (response.status === 'connected') { } }); */ }; } });