
/*
	Function to fade the images in folder
*/

function simpleFader(jump) {
	if(!$('#folderImage.fade').length) {return'';}
	var activeElement = $('#folderImage img.active');
	var activeIndex = activeElement.index();

	if(typeof jump == "undefined") {
		if(activeIndex+1>=$('#folderImage img').length) {nextIndex = 0;}
		else {nextIndex = activeIndex+1;}
	}
	else {
		nextIndex = jump-1;
		clearTimeout(handler);
	}
	
	activeElement.animate({opacity:0}, 1000, function() {
		activeElement.removeClass('active');	
	});


	var nextElement = $('#folderImage img').get(nextIndex);
	$('#folderJumper .list a.active').removeClass('active');
	var nextJumper = $('#folderJumper .list a').get(nextIndex);
	$(nextJumper).addClass('active');
	
	$(nextElement).animate({opacity:1}, 1000, function() {
			$(nextElement).addClass('active');
			handler = window.setTimeout("simpleFader()",timeout);
	});

}

/*
	Function to jump to tab on team site
*/

function tabify(x){
		var targ = x.attr('href');
		$('.teamsub a.active').removeClass('active');
		x.addClass('active');
		$('.teamtab.visible').removeClass('visible');
		$(targ).addClass('visible');
		$.scrollTo('.teamsub',800);
		
		if(x.attr('href') == "#extern") {
			initialize();
		}
}
