/**
 * Adds the methods to the corresponding elements inside the given document.
 * The DIVs marked as progress bars should have the attribute isProgressBar
 * set to true.
 * @param doc the document containing the divs considered progressbars
 */
function initializeRoundedCorners(doc) {
    var divs = doc.getElementsByTagName("DIV");
    for (var i = 0; i < divs.length; i++) {
        var div = divs.item(i);
        if (div.className.indexOf("rounded") >= 0) {
            div.innerHTML = 
                    "<div class='tl'><div class='t'><div class='tr'></div></div></div>"
                    + "<div class='l'>"
                    + "<div class='m'>"
                    + "<div class='content'>"
                    + div.innerHTML
                    + "</div>"
                    + "<div class='r'></div>"
                    + "</div></div>"
                    + "<div class='bl'><div class='b'><div class='br'></div></div></div>"
                    ;
        }
    }
}

if (window.attachEvent) {
    window.attachEvent("onload", function() {
        initializeRoundedCorners(document);
    });
} else { 
    window.addEventListener("load", function() {
        initializeRoundedCorners(document);
    }, false);
}
