$(document).ready(function () {

    $("#shopNav .shopNavBottom ul li a").last().css("color","#C00004");
	
    $(".cartSmall").css("width", $(".scDetails p").width() + $(".scPrice").width() + 87 + "px");
							
    Cufon.replace('.cms .title, .kat-name, .boxRight h3, #content-left, #content-left-prod .opis h2, #shopNav .shopNavTop .searchForm h3, '
        +'.userAccountForm h3, .cartSmall h3, .shopNavBottom, .leftBox h2, h1, .newsletterBox h4, '
        +' #content #rightContent .gridItems ul li .prodOrder', {
            hover: true
        });
	
	// .catTitle z Cufona wywalony
    $(".favTopicsGrid li a, #shopNav .shopNavTop .searchForm input[type='submit'], #bottomBoxes .newsletterBox input[type='submit']").hover(function () {
        $(this).fadeTo("fast", .5)
    }, function () {
        $(this).fadeTo("fast", 1)
    });
    $(".otherBoxesLeft").css("height", $(".otherBoxes").height() - 9 + "px");
    $("#content #rightContent .homePageGrid .gridItems ul li .prodOrder").each(function (i) {
        $(this).append(i + 1);
        if (i > 4) {
            $(this).parent().parent().css("borderBottom", "none")
        }
        if (i == 4 || i == 9 || i == 14) {
            $(this).parent().parent().css({
                "borderRight": "none",
                "padding": "0 5px 0 5px"
            })
        }
    });
    $("#content #rightContent .categoryListContent .gridItems ul li").each(function (i) {
        if (i == 4 || i == 9 || i == 14) {
            $(this).css({
                "borderRight": "none",
                "padding": "0 5px 0 5px"
            })
        }
    });
    $(".leftBox.oppSelect ul li a").click(function (event) {
        $(".leftBox.oppSelect ul li a").removeClass('selCB');
        $(this).toggleClass("selCB")
    });
	
    $(".categoryList li:even").addClass("evenCat");
});

$(window).load(function() {
    // produkty
    /*setTimeout(function() {
        $("ul li a.prodPic img").each(function(index, domEle) {
            var imgHeight = $(domEle).height() / 2;
            $(domEle).css("top", 75 - imgHeight + "px");
            var imgWidth = $(domEle).width() / 2;
            $(domEle).css("left", 69 - imgWidth + "px");
        });
    }, 300);*/
    // producenci
    setTimeout(function() {
        $("ul.favTopicsGrid img").each(function(index, domEle) {
            var imgHeight = $(domEle).height() / 2;
            $(domEle).css("top", 15 - imgHeight + "px");
        });
    }, 300);
});

function centerGridItem(domEle) {
	var imgHeight = $(domEle).height() / 2;
	$(domEle).css("top", 75 - imgHeight + "px");
	var imgWidth = $(domEle).width() / 2;
	$(domEle).css("left", 69 - imgWidth + "px");
	$(domEle).next().css("display","none");
}

function PoliczRate(bogus, nr_sklepu_zagiel) {
    var koszyk = $('.scPrice').html();
    window.open('https://www.zagiel.com.pl/kalkulator/index_smart.php?action=getklientdet_si_rata&shopNo='+nr_sklepu_zagiel+'&goodsValue='+koszyk, 'Policz_rate',
        'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}

