(function ($){		$.fn.rssReader = function(_c) {		var clss = this, obj = $(this), c = _c, isLoading=0, items=[], limitPerChanngel=0, holder;						var __construct = function() {			if (c.parser===undefined) throw new('rssReader: parser is required for proxy.');			if (c.feeds===undefined || c.feeds.length==0 || typeof(c.feeds)!='object') throw new('rssReader: feeds should be provides as an array with at least one item.');						c.limit				= (c.limit!==undefined) ? c.limit : 10 ;			c.descrLength		= (c.descrLength!==undefined) ? c.descrLength : 150 ;						limitPerChanngel = Math.floor(c.limit/c.feeds.length);						clss.load(c.feeds);					};			clss.load = function(feeds) {			var feedlist = (typeof(feeds)=='object') ? feeds : [feeds] ;			$.each(feedlist, function(i, feed) {				isLoading++;				if (feed.url===undefined || feed.url==null) return;				$.ajax({					url: c.parser, // + '?url=' + encodeURIComponent(feed.url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'),					data: {'url' : feed.url},					dataType: 'json',					cache: false,										success: function(data) {						isLoading--;						feedItems = [];						$.each(data.items, function(i,item){							feedItems.push({								title: item.title,								description: item.description,								link: item.link,								image: item.image,								pubdate: item.pubDate							});						});						items.push({							title: '',							description: '',							language: '',							copyright: '',							lastBuildDate: '',							items: feedItems,							icon: feed.icon						});						if (isLoading==0) display();					}				});			});		}				var display = function() {			obj.children().remove();			var holder = $('<ul class="rsslist"/>').appendTo(obj);			if (items.length==0) throw new('rssReader: No items found.');			var sorted_items = {};			var counter = 0;			$.each(items, function(i, channel) {				$.each(channel.items, function(j, item) {					var rand = Math.floor(Math.random()*10).toString().substr(0,1);					sorted_items[item.pubdate.toString() + rand] = item;				});			});						//ini_set('phpjs.strictForIn', false);			sorted_items = ksort(sorted_items, 'SORT_STRING');						var sorted_itemsNew = [];			$.each(sorted_items, function(i, item) {				sorted_itemsNew.unshift(item);			});						$.each(sorted_itemsNew, function(i, item) {				if (counter>=c.limit) return;				var date = new Date(item.pubdate);				var html = 	'<li><a title="' + item.title + '" href="' + item.link + '" target="_blank"><img class="rss_image" src="' + item.image + '" alt="" width="67" align="left" />' + item.title + '</a></li>';				$(html).appendTo(holder);				counter++;			});		};				__construct();		return clss;	};	})(jQuery);
