var URL = '/';

$(document).ready(function()
{
    unBlurAllLinks();
    setDefaultValue('inputsearchfor', 'zadejte hledaný výraz ...');
    setDefaultValue('inputloginuser', 'zadejte přihlašovací jméno');
    setDefaultValue('inputloginpw', 'zadejte heslo');
    setDefaultValue('addnewsmail', '@');
    
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
    
    $('#topdiscountlist .cyc') 
        .cycle({ 
            fx:     'fade',
            speed:  'slow', 
            timeout: 5000, 
            pager:  '.topdiscountlist .index',
            pause:  1 
    });
    $(".marks .box").jCarouselLite({
        btnNext: ".marks .next",
        btnPrev: ".marks .prev",
        auto:3000,
        speed:3000,
        visible:4//,
        //easing:'easeOutCirc'
    });
    $('.productgallery .cyc') 
        .cycle({ 
            fx:     'fade',
            speed:  'slow', 
            timeout: 5000, 
            pager:  '.index',
            pagerAnchorBuilder: function(idx, slide){
                r = trimRatio($('img', slide).attr('width'), $('img', slide).attr('height'), 32, 35);
                return '<a href="#" class="idx'+idx+'"><span><img src="'+$('img', slide).attr('src')+'" alt="" style="margin-top:'+Math.floor((35-r.y)/2)+'px""></span></a>';
            },
            updateActivePagerLink:function(pager, idx, activeClass){
                $(pager).find('a').removeClass(activeClass+' '+activeClass+'0').filter('a:eq('+idx+')').addClass(idx==0?activeClass+'0':activeClass);
            },
            pause:  1 
    });
	$(".productgallery a[rel='cobox']").colorbox({
            maxWidth    :   800,
            maxHeight   :   600,
            current     :   "foto {current} z {total}",
            next        :   "následující",
            previous    :   "předchozí",
            close       :   "zavřít"
    });
    $('.welcomebox .images').cycle({ 
            fx:     'fade',
            speed:  1000, 
            timeout: 5000 
    });
    
    e=$.ajax({
        type        :   'GET',
        url         :   URL+'stats.php',
        data        :   null,
        success     :   function(data) {
            if (data)
            {
                $('#visit_total_value').text(data.stats.celkem_navstev);
                $('#visit_today_value').text(data.stats.den_navstev);
                $('#products_total_count').text(data.stats.celkem_polozek);
            }
        },
        dataType    :   'json'
    });
    
    $('.popup3d').popupWindow({ 
        height:500, 
        width:800, 
        centerBrowser:1 
    }); 
});

