$(document).ready( function () {
	
	var img = new Image();
	img.src = "/images/logo-mjf-hover.png";
	
	$('a._blank').bind('click', function(event) {
		event.preventDefault();
		window.open($(this).attr('href'));
	});
	
	$('#lMJF>a>img').hover(
		function () {
			this.src = this.src.replace(".png","-hover.png");
		},
		function () {
			this.src = this.src.replace("-hover.png",".png");
		}
	);
	
	
	
	var addThis = $('<div id="lFacebook" class="addthis_toolbox addthis_32x32_style addthis_default_style"><a class="addthis_button_facebook_follow" addthis:userid="DJSRUSAdelaide"></a> <a class="addthis_button_facebook_follow lTextOnly" addthis:userid="DJSRUSAdelaide"><span>Follow us on Facebook</span></a></div>');
	$('#lSocialPlacement').prepend(addThis);
	
	
	
	var time = 5; // time in seconds
	
	var features = $('#lSlideshow');
	var toShow = features.children('li').length;
	var nowShow = 1;
	var nextShow = 0;
	
	if (toShow > 1)
	{
		// process feature function
		// increments to the "next" slide
		function processFeature()
		{
			nextShow = nowShow + 1;
			if (nextShow > toShow)
			{
				nextShow = 1;
			}
			
			changeFeature();
		}
		
		// change feature function
		// actually does the fade in/fade out
		function changeFeature()
		{
			if (nextShow > 0)
			{
				features.children('li:nth-child('+nowShow+')').fadeOut();
				features.children('li:nth-child('+nextShow+')').fadeIn();
				
				nowShow = nextShow;
				nextShow = 0;
			}
		}
		
		var interval = window.setInterval(processFeature, time * 1000);
	}
	
	
});
