$(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')});
    $("#inputloginuser").defaultValue('přihlašovací jméno');
    $("#inputloginpw").defaultValue('heslo');
    $(".searchbox input[name=s]").defaultValue('hledaný text ...');
    $('.action-products .cycle') 
        .cycle({ 
            activePagerClass: 'active', 
            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>';
            },
            updateActivePagerLink:function(pager, idx, activeClass){
                $(pager).find('a').removeClass(activeClass).filter('a:eq('+idx+')').addClass(activeClass);
            },
            pause:  1, 
            cleartypeNoBg: true 
    });
	$(".productgallery a[rel='cobox']").colorbox({
            maxWidth    :   800,
            maxHeight   :   600,
            current     :   "foto {current} z {total}",
            next        :   "následující",
            previous    :   "předchozí",
            close       :   "zavřít"
    });
    $('a[rel=popup-image]').popupWindow({width:1024,height:800,centerScreen:1,resizable:1,scrollbars:1});
    $('.banners-cycle .cycle') 
        .cycle({ 
            fx:         'fade',
            speed:      500, 
            timeout:    5000,
            delay:      0,
            pause:      1,
            random:     1,
            prev:       '.banners-cycle .prev',
            next:       '.banners-cycle .next',
            cleartypeNoBg: true
    });
});

function base_url()
{
    return resolveUrl(document.location.href);
}

var Vanilla = new function(){
var scriptTags = document.getElementsByTagName("script");
for(var i=0;i<scriptTags.length;i++) {
if(scriptTags[i].src && scriptTags[i].src.match(/js\/default\.js$/)) {
this.baseURL = scriptTags[i].src.replace(/js\/default\.js$/,'');
break;
}
}
this.webRoot = this.baseURL.replace(/^http(s)?:\/\/[^\/]+/, '');
this.httpMethod = document.URL.replace(/^(http|https)(:\/\/).*$/, "$1$2");
if (this.webRoot == this.baseURL){
this.baseURL = this.httpMethod+document.domain+this.webRoot;
}
return this;
};

