function nastav_pozici_priznaku(priznaky, identifikator, parent_container) {
    var img_position = $(identifikator).offset();
    var img_width = $(identifikator).width();
    var img_height = $(identifikator).height();
    var top = img_position.top;
    var left = img_position.left;
    if (parent_container) {
        top -= $(parent_container).offset().top;
        left -= $(parent_container).offset().left;
    }

    $(priznaky).css("width", "0px");
    $(priznaky).css("height", "0px");
    $(priznaky).css("top", top +  "px").css("left", left + "px");
    $(priznaky).css("display", "block");

    // presun ruznych typu priznaku
    $(priznaky + " div.topleft").css("top", "1px").css("left", "1px");
    $(priznaky + " div.topright").css("top", "1px").css("left", (img_width - $(priznaky + " div.topright").width() - 1) + "px");
    $(priznaky + " div.bottomleft").css("top", (img_height - $(priznaky + " div.bottomleft").height() - 1) + "px").css("left", "1px");
    $(priznaky + " div.bottomright").css("top", (img_height - $(priznaky + " div.bottomright").height() - 1) +"px").css("left", (img_width - $(priznaky + " div.bottomright").width() - 1) + "px");
}


$(document).ready(function() {
     refreshPriznaky();
});

function refreshPriznaky() {
    $("div.priznaky_ready").each(function(){
        var priznaky = $(this).attr("id");
        var identifikator = $(this).find("div.identifikator").html();
        var parent_container = $(this).find("div.parent_container").html();
        nastav_pozici_priznaku("#" + priznaky, identifikator, parent_container);
    });
}
