(function($){
	$.fn.rssReader=function(j){
	var k=$.extend({
		targeturl: "feed://www.norfolkfa.com/rss/News/rss.xml", items: 4, Maxlength: 80, loadingImg: '/assets/35-1.gif'
	},j);
	if(!j.targeturl)return false;var l=$.extend(k,j);
	
	var m=($.browser.msie);
	if(m){
		$('#newsfeed').ajaxStart(function(){
			$("#newsfeed").css({'z-index':90,'opacity':0.4});
			$('<img id="loading" src="'+l.loadingImg+'" alt="loading..." />').css({'opacity':1}).appendTo('#newsfeed')});
			$("#newsfeed").ajaxError(function(){$(this).append("<strong>Error requesting page</strong>")});
			$.get(l.targeturl,function(f){
				$('#newsfeed img').remove();$("#newsfeed").css({'opacity':1});
				var i=0;
				var g=j.items;
				function h(e){
					$(f).find('item').each(function(i){
						if(i>e-1)return;
						var a=$(this).find('title').text();
						var b=$(this).find('pubDate').text();
						var c=$(this).find('link').text();
						var d=$(this).find('description').text();
						$('<h5>'+a+'</h5>').html(a).appendTo('#newsfeed');
//						$('<p class="date">'+b+'</p>').html(b).appendTo('#newsfeed');
						$('<p class="description">'+o(d,j.Maxlength)+'</p>').html(o(d,j.Maxlength)).appendTo('#newsfeed');
//						$('#newsfeed .description p img').remove();
						$('<p class="link"><a href="'+c+'" title="read more" target="_blank">read more &raquo;</a>').appendTo('#newsfeed');
					}
				)}
			return h(g)
		})

	} else { 

		var n="xml";
		$.ajax({
			type:"get",url:l.targeturl,dataType:n,processData:false,beforeSend:function(){
				$("#newsfeed").css({'z-index':90,'opacity':0.4});
				$('<img id="loading" src="'+l.loadingImg+'" alt="loading..." />').css({'opacity':1}).appendTo('#newsfeed')},success:function(f){
					$("#newsfeed").css({'opacity':1});
					$('#newsfeed img').remove();
					var i=0;
					var g=j.items;
					function h(e){
						$(f).find('item').each(function(i){
							if(i>e-1)return;
							var a=$(this).find('title').text();
							var b=$(this).find('pubDate').text();
							var c=$(this).find('link').text();
							var d=$(this).find('description').text();
			
							$('<h5>'+a+'</h5>').html(a).appendTo('#newsfeed');
//							$('<p class="date">'+b+'</p>').html(b).appendTo('#newsfeed');
							$('<p class="description">'+o(d,j.Maxlength)+'</p>').html(o(d,j.Maxlength)).appendTo('#newsfeed');
//							$('#newsfeed .description p img').remove();
							$('<p class="link"><a href="'+c+'" title="read more" target="_blank">read more &raquo;</a>').appendTo('#newsfeed');
						}
					)}
				return h(g)
				}
			}
		)}
	};
	
	function o(a,b){
		var c=a.split(/\s/); 
		if(c.length<=b)return a; 
		var d=''; 
		for(var i=0;i<b;i++){
			d+=c[i]+' '
		}
	return d
	}
})
(jQuery);