
$(document).ready(function () {

    var advSearch = $("#AdvancedSearch");
    $("#ContentContainer_DIV").prepend(advSearch);

    $(".vareliste_desc table").removeAttr("style");

    //Forside
    $("#brand_logos_fp a").each(
        function (intIndex) {
            if ((intIndex + 1) % 6 != 0) {
                $(this).css("margin-right", "5px");
            }
        });

    //Kurv
    var basket = $("#ShopLayOut_Basket_TD table:first");
    $("#customBasket1").append(basket);
    $("#ShopLayOut_Basket_TD").parent().css('display', 'none');
    $("#ShopLayOut_Search_TD").parent().css('display', 'none');

    //Varekort
    if ($("#Canvas").length) {
        var itemname = $("#itemName").text();
        if (itemname.length > 0)
            $(".BreadCrumb_ProductInfo:last").append("  » " + itemname);

        //        if ($("#Canvas").html() == "") {
        //            var img = $("#Canvas").parent().find("img:first");
        //            $(img).removeAttr("onclick");
        //            $("#Canvas").append(img);
        //        }
        $("#Canvas").removeAttr("style");
        $("#Canvas").css("style", "width:320px;height:355px;");

        $("#Selector img").click(function () {
            $("#Canvas img").delay(0).removeAttr("onmousedown").removeAttr("onclick");
            //initCustomLightBox();
        });
        //initCustomLightBox();

        $(".VariantGroup").removeAttr("cellpadding").removeAttr("cellspacing");
        $(".VariantGroupLabel").parent().css("display", "none");
        var variantText = $(".VariantGroupLabel:first").text();
        if (variantText != '') {
            $("#avCombo0 option:first").text(variantText);
        }

        $("#amount").parent().next().css("display", "none");

        var vatToggle = $("#itemVat2 a:first");
        if (vatToggle.length) {
            $(".price_now:last").append(vatToggle);
        }

        if ($("#priceBefore").text() != '')
            $("#priceBefore").addClass("priceBeforeActive");

        //lightbox
        //$("#Canvas a").lightBox();

    }
    //Vareliste
    $("#vareliste_container .item_container").each(
        function (intIndex) {
            if ((intIndex + 1) % 3 == 0) {
                $(this).addClass("lastinrow");
            }
        });

    setPrices();


    //var tr = $("#ProductList_TD tr:not(.Prices_Custom_TBL tr), .Related_Custom_TBL tr, .Frontpage_Custom_TBL tr");

    //    $(tr).each(
    //        function (intIndex) {
    //            var headlineCells = $(this).find(".item_name");
    //            var h = 0;
    //            $(headlineCells).each(
    //            function (intIndex) {
    //                if ($(this).height() > h)
    //                    h = $(this).height();
    //            });
    //            $(this).find("td:not(.Prices_Custom_TBL td, .CmsPageStyle td)").each(
    //                function (intIndex) {
    //                    $(this).find(".item_name").css("height", h);
    //                });

    //        }
    //    );

});


