jQuery.noConflict();
jQuery(document).ready(function() {
    //hide related
    var relatedartsImg = jQuery("#addartcontent img").size();
    var relatedartsBoxSize = jQuery(".related li").size();

    if ((relatedartsBoxSize + relatedartsImg) > 0) {
        jQuery("#addartcontent").show();
    }

    if (relatedartsBoxSize > 0) {
        jQuery("#addArtTextBox, .addArtText").show();
    }

    // obsluga tabs2
    jQuery(".secondTabs > .tabsBox > .tabB").click(function() {
        jQuery(".secondTabs > .tabBox").addClass("hidden");
        jQuery(".secondTabs .tabsBox > .tabB").removeClass("active");
        jQuery(this).addClass("active");
    });

    jQuery(".secondTabs > .tabsBox > .tabB:eq(0)").click(function() {
        jQuery(".secondTabs > .tabBox:eq(0)").removeClass("hidden");
    });

    jQuery(".secondTabs > .tabsBox > .tabB:eq(1)").click(function() {
        jQuery(".secondTabs > .tabBox:eq(1)").removeClass("hidden");
    });

    // obsluga tabs
    jQuery(".firstTabs > .tabsBox > .tabB").click(function() {
        jQuery(".firstTabs > .tabBox").addClass("hidden");
        jQuery(".firstTabs .tabsBox > .tabB").removeClass("active");
        jQuery(this).addClass("active");
    });

    jQuery(".firstTabs > .tabsBox > .tabB:eq(0)").click(function() {
        jQuery(".firstTabs > .tabBox:eq(0)").removeClass("hidden");
    });

    jQuery(".firstTabs > .tabsBox > .tabB:eq(1)").click(function() {
        jQuery(".firstTabs > .tabBox:eq(1)").removeClass("hidden");
    });

    var textSize = jQuery("#addartcontent").children().size();
    if (textSize == 0) {
        jQuery("#addartcontent").hide();
    };

    /* weather */
    jQuery("#cityCurrent").mouseover(function() {
        jQuery("#cityList").addClass("show");
    });

    var setCity;

    jQuery("#cityCurrent").mouseout(function() {
        setCity = setTimeout('jQuery("#cityList").removeClass("show");', 2000);
    });

    jQuery("#cityList").mouseover(function() {
        clearTimeout(setCity);
    });

    jQuery("#cityList").bind("mouseleave", function() {
        jQuery("#cityList").removeClass("show");
    });

    // usuwa element "tagsBottom" jesli pod artykułem nie ma żadnych tagów

    if (jQuery("#tagsBottom > #listTags > div > a").size() == 0) {
        jQuery("#tagsBottom").css({ display: "none" });
    }
    // dodaje przecinek w tagach pod artykułem
    jQuery("#listTags > div > a > span").append(', ');
    var lastSpan = jQuery("#listTags > div > a > span:last").text();
    var lengS = lastSpan.substring(0, lastSpan.length - 2);

    jQuery("#listTags > div > a > span:last").text(lengS);

});