jQuery(document).ready(function($) {
	
	$(".category-news-feed").each(function() {
		var news = $(this);
		
		resize("object");
		resize("embed");
		resize("iframe");
		
		news.find("entry a").attr("target","_blank");
		
		function resize(tag) {

			items = news.find(tag);
			
			if(tag=='iframe') {
				
				items.each(function() {
				
					var iframe = $(this);
					
					iframe.attr("src",iframe.attr("src").replace("width=600&height=338","width=500&height=281"));
					iframe.attr("src",iframe.attr("src").replace("w=600&%23038;h=337","w=500&%23038;h=281"));
					iframe.attr("src",iframe.attr("src").replace("w=600&%23038;h=400","w=500&%23038;h=333"));
				});
				
			}
			
			items.each(function() {
				
				var resizer = $(this);
				
				if(resizer.attr("width").replace("px","")>500) {
					resizer.attr("height",Math.ceil(500/resizer.attr("width").replace("px","") * (resizer.attr("height").replace("px","")) ) );
					resizer.attr("width",500);
				}
			});
		};
		
	});
	
});
