Мир Мото - Мотоциклы и мототехника из Японии
        
        
 ');
                } else {
                        var href = a.attr('href');
                        
                        if (href != null && href != 'undefined') {
                                if (/product_id=[0-9]*/.test(href)) {
                                        var matches = href.match (/product_id=([0-9]*)/);
                                        
                                        if (matches != null && matches != 'undefined') {
                                                products_id += '&id[' + index + ']=' + matches[1];
                                                
                                                $(element).wrap('
');
                                        }
                                } else if (/\/[a-zA-Zа-яА-ЯёЁ0-9\-\_\%]*[\.]{0,1}[a-zA-Z]{0,}\?|$/.test(href)) {
                                        var matches = href.match (/\/([a-zA-Zа-яА-ЯёЁ0-9\-\_\%]*)[\.]{0,1}[a-zA-Z]{0,}(?:\?|$)/);
                                        
                                        if (matches != null && matches != 'undefined') {
                                                products_url_alias += '&ua[' + index + ']=' + encodeURIComponent (matches[1]);
                                                
                                                $(element).wrap('
');
                                        }
                                }
                        }
                }
        });
        $.ajax({
                url: 'index.php?route=module/astickers/getAStickers',
                type: 'POST',
                data: products_id + products_url_alias,
                dataType: 'json',
                cache: false,
                success: function(json) {
                        var hidden_content = [], id = '';
                        
                        $('.htabs a').each(function(index, element) {
                                id = $(element).attr('href');
                                
                                if ($(id).css('display') == 'none') {
                                        $(id).css({'display':'block'});
                                        
                                        hidden_content.push (id);
                                }
                        });
                        
                        $.each(json, function(index, data) {
                                var image = $('.image a div.astickers_' + index + ' img');
                                
                                var image_width = parseInt (image.css('width'));
                                var image_height = parseInt (image.css('height'));
                                
                                var width = image_width + parseInt (image.css('padding-left')) + parseInt (image.css('padding-right'));
                                var height = image_height + parseInt (image.css('padding-top'))  + parseInt (image.css('padding-bottom'));
                                
                                var margin_top = parseInt (image.css('margin-top')) + parseInt (image.css('border-top-width'));
                                
                                if (image.css('text-align') == 'center') {
                                        var left = '50%';
                                        var margin_left = -(image_width / 2);
                                } else {
                                        var left = 0;
                                        var margin_left = parseInt (image.css('margin-left')) + parseInt (image.css('border-left-width'));
                                }
                                
                                if (data && image_width > '10' && image_height > '10') {
                                        image.before(data);
                                        
                                        var astickers = $('.image a div.astickers_' + index + ' div.asticker');
                                        
                                        astickers.css({'width':width, 'height':height, 'margin-top':margin_top, 'margin-left':margin_left, 'left':left});
                                        
                                        
                                        
                                        astickers.show('pulsate', {}, 1000);
                                        
                                        
                                        
                                        
                                } else {
                                        image.unwrap();
                                }
                        });
                        
                        if (hidden_content.length) {
                                $(hidden_content.join (', ')).css({'display':'none'});
                        }
                }
        });
        };
        $(document).ready(function(e) {
        if (typeof doFilter != 'function') {
                setTimeout ('getAStickers()', 500);
        }
        });
        //-->