/*
 * jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
 *
 * Copyright (c) 2009 jQuery HowTo
 *
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 *
 * URL:
 *   http://jquery-howto.blogspot.com
 *
 * Author URL:
 *   http://me.boo.uz
 *
 */
(function($){$.extend({jGFeed:function(url,fnk,num,key){if(url==null){return false;}var gurl="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;if(num!=null){gurl+="&num="+num;}if(key!=null){gurl+="&key="+key;}$.getJSON(gurl,function(data){if(typeof fnk=="function"){fnk.call(this,data.responseData.feed);}else{return false;}});}});})(jQuery);
jQuery(document).ready(function(){
	$(function () {
		$.ajax({
			url: 'https://graph.facebook.com/USACompetitions/feed?limit=4&callback=?&access_token=103020646466198|5VQUpYj-T3F5y_XNdcFvFKmldAI',
			dataType: 'json',
			success: function(result){
				var feed_template = '<div id="feed"><span class="black11"><strong><a href="{link}" target="_blank">{title}</a></strong><br/><a href="{link}">{description}</a></span></div><div class="clear"></div>';
				var len = 150;
				$.each(result.data, function (i, item) {
					var feed_template2 = feed_template.replace('{title}',item.from.name);
					if(item.message.length>len) item.message = item.message.substr(0,len)+"...";
					feed_template2 = feed_template2.replace('{description}',item.message);
					feed_template2 = feed_template2.replace(/{link}/gi,'http://www.facebook.com/USACompetitions');
					$('.fb-feeds').append(feed_template2);
				});
			}
		});
	});
});
