$(function() {

	$('a.button').hover(
		function(ev) {
			this.getElementsByTagName('img')[0].src = this.getElementsByTagName('img')[0].src.replace(/off/,'on');
		},
		function(ev) {
			this.getElementsByTagName('img')[0].src = this.getElementsByTagName('img')[0].src.replace(/on/,'off');	
	});

//	$.getJSON('http://www.njstatelib.org/includes/rssRelay/?url=http://newsletter.njstatelib.org/feed/&format=JSON',function(data) {
	

		/* remove the blank list item from the front of the list */
		$('#sideBar ol li').remove();

//		for each(var item in data) {
		for (var i = 0; i < data.length; i++) {
			
			var newsItem = document.createElement('li');
			newsItem.innerHTML = unescape(data[i].title) + ' <a href="' + data[i].link + '">More</a>';
			
			$('#sideBar ol').append(newsItem);
		}
		
		/* once we have all the entries, start the scroller */
		$('#sideBar ol').cycle({
			fx:		'scrollUp',
			timeout: 	3000,
			speed:		1000,
			sync:		1,
			pause:		1
		});
		
//	});
	

});
