$(document).ready(function(){

	// Random Image for sidebar
    var randomNum = Math.ceil(Math.random()*8); /* Pick random number between 1 and 8 */
	$("#random_image").append("<img src='/graphics/image_0"+randomNum+".jpg' alt='Eiris sidebar image' height='171' width='171' />");
	
	// News Ticker
	$('#js-news').ticker({
		debugMode: true,
		displayType: 'fade',
        titleText: 'EIRIS Blog:&nbsp;',
		pauseOnItems: 3000,
        fadeInSpeed: 600,
        fadeOutSpeed: 300,
		htmlFeed: false,
        ajaxFeed: true,
        feedUrl: 'http://www.eiris.org/blog/?feed=rss',
        feedType: 'xml'
	});
	
	
		
});

// Image Slides on Home Page 
	function slideSwitch() {
		var $active = $('#slideshow a.active');

		if ( $active.length == 0 ) $active = $('#slideshow a:last');

		var $next =  $active.next().length ? $active.next()
			: $('#slideshow a:first');

		$active.addClass('last-active');

		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
		});
	}

	$(function() {
		setInterval( "slideSwitch()", 5000 );
	});
