//firebugx
if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}


/** 
 * note: this is just a wrapper for someone else's work.
 * the demo was here: http://jqueryfordesigners.com/ajax-spy/
 */


/**
 * CONFIGURATION
 */

var FEED_URL = 'http://mmducharme.wordpress.com/feed/';

/**
 * DON'T MODIFY PAST HERE
 */

jQuery(function () {

	var $ = jQuery;
	
	var url = 'proxy.php?url=' + FEED_URL;
	
	var $spylist = $('#spy-list');
	
	$.get(url, function (feed) {
	
		var title = $(feed).find('channel title').text();
		var site_url = $(feed).find('channel link:first').text();
		$(feed).find('item').each(function () {
			
			var $item = $(this);
			console.log($item);
			var html = '';
			html += '<li>';
			html += '<a href="'+$item.find('link').text()+'" title="View '+$item.find('title').text()+'" style="height:70px;display:block;float:left;">';
			html += '<img src="'+$item.find('media\\:content:last').attr('url') + '?w=70" title="" />';
			html += '</a>';
			html += '<h5><a href="'+$item.find('link').text()+'" title="View '+$item.find('title').text()+'">'+$item.find('title').text()+'</a></h5>';
			html += '<p class="info">Nov 29th 2008 by <a href="'+site_url+'" title="Visit '+$item.find('dc\\:creator').text()+'\'s site.">'+$item.find('dc\\:creator').text()+'</a></p>';
			html += '<p class="rating none">Not Rated</p>';
			html += '<p class="tags">'+$item.find('category').text()+'</p>';
			html += '</li>';
			
			$spylist.append(html);
			
		});
		
		spy_init();
		
		
	}, 'xml');

})
