// A helper function to check if the browser has support for border radius. 
// After all, if the browser doesn&rsquo;t support border radius, 
// there&rsquo;s no point in transforming the image into a div with a background image.
function hasBorderRadius() {
    var d = document.createElement("div").style;
    if (typeof d.borderRadius !== "undefined") return true;
    if (typeof d.WebkitBorderRadius !== "undefined") return true;
    if (typeof d.MozBorderRadius !== "undefined") return true;
    return false;
};

var $j = jQuery.noConflict();
$j(document).ready(function ($) {
    if (hasBorderRadius()) {
        $('.navbar-page #content img, .navbarsidebar-page #content img, .navbarsidebarxl-page #content img').each(function () {
            $(this).wrap('<span class="rounded-border"><span class="rounded-img" style="background:url(\'' + $(this).attr('src') + '\') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />');
            $(this).css('opacity', 0);
        });
    }

    if (!hasBorderRadius() || $.browser.msie) {

        $('div#navbar h4').prepend('<div class="cornerTopLeft"/><div class="cornerTopRight"/><div class="cornerBottomLeft"/><div class="cornerBottomRight"/>');
        $('div#navbar h4').css({ 'border-radius': '0' });
    }
});
