var interval = 10000;
var numberOfPhotos=0;
var currentPhotoShown=0;

$(document).ready(function() {
		
	var test = getElementsByClass('frontpageImage');
	numberOfPhotos = test.length;
	currentPhotoShown = 0;
	var t=setTimeout("fadeOutPictures()",5000);
});

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
	node = document;
	if ( tag == null )
	tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function fadeOutPictures(){
		$('#img'+(currentPhotoShown)).fadeOut('slow');
		$('#img'+(currentPhotoShown+1)).fadeIn('slow');
		$('#img'+(currentPhotoShown)).attr("id","img"+(currentPhotoShown+numberOfPhotos));
		currentPhotoShown++;
		var t=setTimeout("fadeOutPictures()",5000);
}




