$(document).ready(function(){
        $('a[href*=gotoShopBot]').each(function(){
            var href = $(this).attr('href');
            var hrefreplaced = href.replace('/gotoShopBot/', '/gotoShop/');
            $(this).attr('href',hrefreplaced);
            $(this).click(function(){ 
                // śledzenie w GA
                _gaq.push(['_trackEvent', 'Wychodzace', 'ImportedProduct']);
                window.open(this.href);
                return false;
                });
        });
        $('a[href*=gotoproviderbot]').each(function(){
            var href = $(this).attr('href');
            var hrefreplaced = href.replace('/gotoproviderbot/', '/gotoprovider/');
            $(this).attr('href',hrefreplaced);
            $(this).click(function(){
                // śledzenie w GA
                _gaq.push(['_trackEvent', 'Wychodzace', 'ServiceProvider']);
                window.open(this.href);
                return false;
                });
        });
        var main_search_box = $('input#main_search_box');
        if (main_search_box.length) {
            main_search_box.autocomplete('/search-autocomplete/', { 
                    matchContains: true,
                    selectFirst: false,
                    max:20,
                    cacheLength: 1,
                    matchSubset: false
            });
        }
    });

function main_page_next_tab(selector)
{
    var tabselem = $(selector);
    var cur = tabselem.activeTab();
    var size = $('ul.tabs-nav>li', tabselem).size();
    
    if(cur != size) {
        //tabselem.triggerTab(cur+1); // triggerTab(0 psuje pod chrome :/
        $('ul.tabs-nav li:eq('+cur+') a', tabselem).click()
    }
    else {
        //tabselem.triggerTab();
        $('ul.tabs-nav li:eq(0) a', tabselem).click()
    }
}





