$(function(){
    var CssToAdd = new Object();
    $.getJSON('http://pipes.yahoo.com/pipes/pipe.run?_id=9e80ad9c788c107d5a8ebe0a3a0cee73&_render=json&_callback=?',
    function(data){        
        $.each(data.value.items, function(i,item){
            var domain = ((typeof(item['feedburner:origLink'])!='undefined') ? item['feedburner:origLink'] : item.link);
                domain = domain.replace(/(http:\/\/.*?\/).*/i,'$1');
            
            CssToAdd[domain.replace(/[^a-z]/ig,'_')] = domain;         
         
            //parse location from description
                var descLocation = item.description.lastIndexOf("Location - ");
                var descSolution = item.description.lastIndexOf(" | Solution - ");
                if (descSolution > -1) {
                    var descEnd = descSolution;}
                else var descEnd = item.description.length;
                if (descLocation > -1) {
                  var descLocationOutput = item.description.substring(descLocation+11,descEnd);}
                else    var descLocationOutput = "";          
            
            var str =       '<tr>';
                str = str + '<td><a href="' + item.link + '" title="' + item.description.substring(0, 250) + '...' + '">' + item.title + '</a></td>';
                str = str + '<td>' + descLocationOutput + '</td>';
                str = str + '</tr>';
            
            $(str).appendTo('#output');
                
                
            //$('<tr>').appendTo('#output');
            //$('<a>').attr('href',item.link).attr('title',item.description.substring(0,250)+'...').text(item.title).appendTo('#output');
            //$('<td>'+descLocationOutput+'</td></tr>').appendTo('#output');
        });
        //$('#output a').wrap('<td>');
    });
});
