﻿$(document).ready(function() {
    $('.soktittel input').click(function() {
        var button = $(this);
        var webcontainer = $(button).parent().parent();
        var isShowing = false;
        $(webcontainer).find('#webhit').each(function() {

        if ($(this).attr('style') == "display: none;" || $(this).attr('style') == "DISPLAY: none"
            || $(this).attr('style') == "display: none") {
                $(this).show();
                isShowing = true;
            } else {
                $(this).hide();
            }
        });

        if (isShowing) {
            $(button).attr('src', '/Templates/CoBuilder/Styles/Images/semindre.gif')
        } else {
            $(button).attr('src', '/Templates/CoBuilder/Styles/Images/seflere.gif')
        }
        return false;
    });

    $('#morefilescontainer a').click(function() {
        
        var parent = $(this).parent().parent().parent();
        var repAllDocuments = $(parent).find('#repAllDocuments');
        var moreFilesContainer = $(parent).find('#morefilescontainer');

        if ($(repAllDocuments).attr('style') == "display: none;" || $(repAllDocuments).attr('style') == "DISPLAY: none"
        || $(repAllDocuments).attr('style') == "display: none") {
            $(repAllDocuments).show();
            $(this).parent().attr('style', 'display: none;');
            var mindre = $(moreFilesContainer).find('div.katmindre')
            $(mindre).show();
        } else {
            $(repAllDocuments).hide();
            $(this).parent().attr('style', 'display: none;');
            var flere = $(moreFilesContainer).find('div.katflere')
            $(flere).show();
        }
        return false;
    });
});
