var numNewsBox = 0;
var curNewsBox = 0;

$(document).ready(function() {
	setInterval(swap100pct,2000);
	
	numNewsBox = $('div.newsbox').length;
	if (numNewsBox>0) {
		swapNewsBox();
		curNewsBox = 1;
		setInterval(swapNewsBox,5000);
	}
});

function swapNewsBox() {
	var old = curNewsBox;
	curNewsBox++;
	if (curNewsBox>numNewsBox) {
		curNewsBox = 1;
	}
	if (old>0) {
		$('#newsbox-'+old).fadeOut(function() {$('#newsbox-'+curNewsBox).fadeIn()});
	} else {
		$('#newsbox-'+curNewsBox).fadeIn();
	}
}

var num100pctImage = 2;
var cur100pctImage = num100pctImage;

function swap100pct() {
	$('#img-100pct-'+cur100pctImage).fadeOut();
	cur100pctImage++;
	if (cur100pctImage>num100pctImage) {
		cur100pctImage = 1;
	}
	$('#img-100pct-'+cur100pctImage).fadeIn();
}
