$(document).ready(function()
{
    $('.accordion').each(function()
    {
        var container = this;
        var $sections = $(container).find('hr')
        var panel = document.createElement('div');
        var first = true;
        $sections.each(function()
        {
            var $contents = $(this).nextUntil('hr');
            var title = document.createElement('h3');
            $(title).css({
                'outline-style': 'none',
                '-moz-outline-style': 'none'
            });
            if (first)
            {
                first = false;
            }
            else
            {
                $(title).css({
                    'border-top': '2px solid #b6d0d3',
                    'padding-top': '10px'
                });
            }
            $(title).append('<a href="#" style="margin-left: 24px; outline-style: none; -moz-outline-style:none;">' + $contents.first().html() + '</a>');
            $(panel).append(title);
            $(title).find('*').css({
                'text-decoration': 'none',
                'font-weight': 'bold',
                'color': 'auto',
                'text-align': 'left',
                'font-family': 'arial',
                'color': 'rgb(0, 158, 224)',
                'font-size': '12pt'
            });
            var content = document.createElement('div');
            $(content).append($contents);
            $(content).children().first().remove();
//            $(content).append('<hr />');
            $(panel).append(content);
        });
        $(container).html('');
        $(container).append(panel);
        $(panel).accordion({
            autoHeight: false,
            collapsible: true,
            active: false
        });
        $(container).css({
            'border-bottom': '2px solid #b6d0d3'
        });
    });
});

