// Replace recycling symbols with something else
var shouldReplaceRecycling = function() {
    // Replace on Windows and Mobile Safari, since they can't show the recycling symbol by default
    var isWindows = navigator.platform.indexOf("Win") != -1;
    var isMobileSafari = navigator.userAgent.indexOf("Mobile") != -1 && navigator.userAgent.indexOf("Safari") != -1;
    return isWindows || isMobileSafari;
};

if (shouldReplaceRecycling()) {
    $(function() {
        $(':contains(' + String.fromCharCode(9851) + ')').filter(function() {
            return $(this).children().length == 0
        }).each(function() {
            var elem = $(this);
            var html = elem.html();
            var re = new RegExp(String.fromCharCode(9851), 'g');
            var height = elem.height();
            var replacement = '<img src="/files/images/favicon.png" height="' + height + 'px" width="' + height + 'px" style="vertical-align: bottom"/>';
            elem.html(html.replace(re, replacement));
        });
    });
}


// Initiate hyphenation
Hyphenator.config({
        selectorfunction: function() {
                return $('.asset, .widget-content');
            },
        intermediatestate: 'visible',
        onerrorhandler: function(e) {}
    });
Hyphenator.run();
