var URL = '/';
$(document).ready(function()
{
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
    $(":submit,a").focus(function(){$(this).blur()});
    $(".searchbox input.text").focus(function(){$(this).addClass('active')}).blur(function(){$(this).removeClass('active')});
    $(".searchbox input[name=s]").defaultValue('zadejte hledaný text ...');
    $(".tablogin input[name=username]").defaultValue('uživatelské jméno');
    $(".tablogin input[name=password]").defaultValue('vaše heslo');
    $('.actionitems') 
        .cycle({ 
            fx:     'fade',
            speed:  'slow', 
            timeout: 5000, 
            pause:  1 
    });
    $('.head .text') 
        .cycle({ 
            fx:     'fade',
            speed:  'slow', 
            timeout: 5000 
    });
    $('.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'), 37, 34);
                return '<a href="#" class="idx'+idx+'"><span>'+(idx+1)+'</span></a>';
            },
            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"
    });
    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'
    });
});
