(function($){
    $.rss = {
        fix: function(){
            $('.weather').find('h4').each(function(i, header){
            
                var $header = $(header);
                
                $header.text(function(){
                    var text = $header.text();
                    return text.replace(/[^a-zA-Z0-9\s\+\-\:()\,\.]/g, '°');
                });
                
                var parts = $header.text().split(',');
                
                var wrapper = $('<div/>', {
                    'class': 'rss_item' // IE is choking when the key isn't quoted, like so
                });
                
                var h4 = $('<h4/>', {
                    'text': parts[0]
                });
            
                var first_p = $('<p/>', {
                    'class': 'max_temp',
                    'text': parts[1]
                });
                
                var second_p = $('<p/>', {
                    'class': 'min_temp',
                    'text': parts[2]
                });
                
                $header.replaceWith(wrapper);
                h4.appendTo(wrapper);
                h4.after(first_p);
                first_p.after(second_p);
            });
        }
    };

    $(function(){
        if($('div.weather').length){
            $.rss.fix();
        }
    });
    
})(window.jQuery);
