/*//////////////////////////////////////////////////////////////
//	Supporting JS for banner rotators
/////////////////////////////////////////////////////////////*/

//copy code from thg

function banner_fader() {
	setTimeout(banner_fader_tick, 600);
}

function banner_fader_tick() {
	var current = $('#mainbanner img.current');
	var next = current.next();

	// Restart:
	if (current.get(0) == $('#mainbanner img:last').get(0)) {
		next = $('#mainbanner img:first');
	}
	
	// Fade across:
	next.fadeIn(2000, function() {
		current.fadeOut(2000, function() {
			current.removeClass();
			next.removeClass();
			next.addClass("current");
		});
	});
	banner_fader();
}


$(document).ready(function() {
	
	if ($('#mainbanner img').length >1) {
		$('#mainbanner img:first').addClass("current");
		banner_fader();
	} else {
		$('#mainbanner img').addClass("current");	
	}
});