/*  
 * Zaznaczanie checkboxow w multilistach
 */
function multipleSelectCheck(div_id,input_name){
    var count = $("input[name='"+input_name+"']:checked").length;
    if ( count == 0 ){
        $("#"+div_id+" input[readonly]").attr("value", "wybierz");
    }else {
        $("#"+div_id+" input[readonly]").attr("value", "wybrano ("+count+")");
    }
}

//
var timer = null
changeTab = function() {
    var el = $('.polecamy li.active').eq(0);
    var next = el.next().length ? el.next() : el.parent().children('li:first-child')
    next.find('a').click()
}



$(document).ready(function(){
    timer = window.setTimeout('changeTab()', 10000)

    $('.polecamy li a').click(function(){
        window.clearTimeout(timer);
        timer = window.setTimeout('changeTab()', 10000)
    })
/*
	$('#menu li').mouseover(function(){
		$('#menu li').removeClass('hover').removeClass('active');
		$(this).addClass('hover')
	})
*/
})

$(document).ready(function(){
    $("#menu .sub li").each(function() {
        $(this).click(function() {
            var l = $(this).find("a:not('.nolink')").attr("href");
            window.location = l;
        });
    });
    $("#menu .sub li li").each(function() {
        $(this).click(function() {
            var l = $(this).find("a:not('.nolink')").attr("href");
            window.location = l;
        });
    });    
    $("#menu .sub .nolink").click(function() {
        return false;
    })
});

$(document).ready(function() {
    if(typeof document.body.style.maxHeight === "undefined") {
        $("#menu .dropdown_menu li li").css("width", "210px");
        $(".dropdown_menu ul li").hover(function() {
            $(this).children("ul").show();
        }, function() {
            $(this).children("ul").hide();
        });
        $("ul.sub").each(function() {
            var w =  $(this).parent().children("a").width();
            $(this).width(w);
        });
        $(".dropdown_menu > li > a").hover(function() {
            $(this).css("background-position", "left -37px");
        }, function() {
            $(this).css("background-position", "left top");
        });
    }
});
$(document).ready(function() {
    if ($("#menu").is(".en") ) {
        $(".business-financing").addClass("finansowanie-biznesu");
        $(".business-financing").addClass("finansowanie-biznesu");
        $(".projects-and-investors").addClass("projekty-i-inwestorzy");
        $(".company-finance").addClass("finanse-firmy");
        $(".legal-support").addClass("wsparcie-prawne");
        $(".guides").addClass("poradniki");
    }
});
    
$(document).ready(function() {
    if($("div.polecane_w_serwisie").is(".box"))  {
        var polecaneDiv = $("div.polecane_w_serwisie div[id*=\"polecamy\"] img")
        var i = polecaneDiv.position();
        var h = polecaneDiv.height();
        var w = polecaneDiv.width();
//        var top = i.top + h - 40;
//
//        $(".polecane_w_serwisie .menuf.polecamy").css({
//            "top": top
//        });
    }
    $('.step_back').each(function() {
        $(this).attr("tabindex", "-1")

    })
    $('.js-enable-parent-radio').click(function() {
        $(this).parents(".js-enable-parent").find(".js-enable-radio").attr("checked", true);
    })
    $(".js-clear-parent-checboxes").click(function(){
        $(this).parents(".js-clear-checkbox-parent").find(".js-clear-checkbox").attr("checked", false);
    })


    //banner
    $('.banner_conetnt').each(function(){
       var banner_width = $(this).width();
       $(this).find('a').width(banner_width);
    });
});



