function HP_loadTab(number)
{
    //$('.categories').fadeOut();
    $('.age li a').removeClass();
    $('#categories_option' + parseInt(number)+' a').attr('class', 'selected');
    $(".categories").empty();
    $('#categories' + parseInt(number)).children().clone().appendTo(".categories");
    
	$('#content .categories > div').bind( 'mouseover', function(){ $('#content .categories > div.active').removeClass('active');$(this).addClass('active') } )
    //$('.categories').fadeIn();   
}

function flashMsg(message, status) {
    $(".flashMessenger").text(message);
    if (status == 0)
        $(".flashMessenger").addClass("info");
    else
        $(".flashMessenger").addClass("error");

    $("#flashMessenger").fadeIn('fast');


    $("#flashMessenger").fadeOut(10000);

}

function addToFavorites(nodes_id) {
    $.ajax({
        type: "POST",
        url: "/Documents/Services/Favorites.asmx/Add",
        data: "{Nodes_Id: " + parseInt(nodes_id) + "} ",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {
            flashMsg(data.d.Message,0);
            //flashMsg(data.d.Message, data.d.Status);
        }
    });

}

function removeFromFavorites(nodes_id) {
    $.ajax({
        type: "POST",
        url: "/Documents/Services/Favorites.asmx/Remove",
        data: "{Nodes_Id: " + parseInt(nodes_id) + "} ",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {

            flashMsg(data.d.Message, data.d.Status);
            $('#node-' + parseInt(nodes_id)).hide();
document.location =document.location;
        }
    });

}

function addToAbuse(nodes_id) {
    $.ajax({
        type: "POST",
        url: "/Documents/Services/AbuseList.asmx/Add",
        data: "{Nodes_Id: " + parseInt(nodes_id) + "} ",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {

            flashMsg(data.d.Message, data.d.Status);
        }
    });

}
   
 function lock(nodes_id, enabled) {
    $.ajax({
        type: "POST",
        url: "/Documents/Services/Nodes.asmx/Lock",
        data: "{Nodes_Id: " + parseInt(nodes_id) + ", enabled: "+ ((parseInt(enabled) == 1)? 'false':'true') + "} ",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {

            flashMsg(data.d.Message, data.d.Status);
        }
    });

}

function browserAddToFavorites() { if (window.external) { window.external.AddFavorite("http://ekooszczedni.pl/","Ekooszczedni.pl") 
} else { alert("Twoja przeglądarka nie obsługuje tej funkcji!"); 
} } // --></script>

function tg(div)
{
}

$(document).ready(function() {

    $.each($(".page_content0 .text img"), function() {
        if ($(this).parent().attr("href") == "undefined")
            $(this).wrap($('<div>').css("float", $(this).css("float")));
        else
            $(this).parent().attr("title", $(this).attr("alt")).wrap($('<div>').css("float", $(this).css("float")));
    });

    $.each($(".page_content0 .text a img"), function() {
        $(this).parent().addClass('thickbox');
    });

    $.each($(".page_content0 .text a"), function() {
        hrefAttr = $(this).attr('href');
        if (hrefAttr.indexOf("ekooszczedni.pl") == -1 && hrefAttr.substr(0, 1) != "/") {
            $(this).attr('target', '_blank');
        }
    });
});