//TBD: Löschen vorm live gehen
if(typeof(console) == "undefined"){
	function DummyConsole(){
		this.log = function(input){
			//do nothing
		}
	}
	console = new DummyConsole();
}


function showBanner(name){
	$('#'+name+' .hiddenBanners').slideToggle("slow");
}

$(document).ready(function(){
	lockButtons = false;

	$("#leftButton").click(function(){
		if (!lockButtons) {
			prevClub();
		}else{
			//
		}
	});
	$("#rightButton").click(function(){
		if (!lockButtons) {
			nextClub();
		}else{
			//
		}
	});
	/*
	$(".paul").one("mouseover", function(){
		$(".paul .inviteLink").removeAttr("target").attr("href", "javascript:paulInvite()");
		
	});*/
});


function nextClub(){
	lockButtons = true;
	if(typeof(clubs) != "undefined"){
		active = $(".activeInfo").attr("id");
		index = $.inArray(active.replace(/_info/, ''), clubs);
		newIndex = index+1;
		$("#"+active).removeClass("activeInfo").fadeOut("fast", function(){
			if(newIndex <= clubs.length-1){
				$("#"+clubs[newIndex]+"_info").addClass("activeInfo").fadeIn("slow");
			}else if(newIndex > clubs.length-1){
				$("#"+clubs[0]+"_info").addClass("activeInfo").fadeIn("slow");
			}
			lockButtons = false;			
		});
	}else{
		alert("keine clubs");
	}
}

function prevClub(){
	lockButtons = true;
	if(typeof(clubs) != "undefined"){
		active = $(".activeInfo").attr("id");
		index = $.inArray(active.replace(/_info/, ''), clubs);
		newIndex = index-1;
		$("#"+active).removeClass("activeInfo").fadeOut("fast", function(){
			if(newIndex >= 0){
				$("#"+clubs[newIndex]+"_info").addClass("activeInfo").fadeIn("slow");
			}else if(newIndex < 0){
				$("#"+clubs[clubs.length-1]+"_info").addClass("activeInfo").fadeIn("slow");
			}
			lockButtons = false;			
		});
	}else{
		alert("keine clubs");
	}
}

function paulInvite(){
	$("#paulInvite").slideToggle("slow");
}


