$(document).ready(function() {

	var t = setTimeout('resizes()', 100);
	
	$(window).resize(function() {
		resizes();
		//t = setTimeout('setHomeFrame()', 50);
	});
	
	//	Navigatie klikbaar maken.
	$("#homeLink").click(function() {
		window.location.href = "../index.html";
	});
	$("#deelnemersLink").click(function() {
		window.location.href = "../deelnemers.html";
	});
	$("#multimediaLink").click(function() {
		window.location.href = "../multimedia.html";
	});
	$("#sponsorLink").click(function() {
		window.location.href = "../sponsors.html";
	});
	$("#inschrijvenLink").click(function() {
		window.location.href = "../inschrijven.php";
	});
	$("#contactLink").click(function() {
		window.location.href = "../contact.php";
	});
	
	//	Slider op homepage inschakelen.
	if($("body.home").length == 1) {
		$("#homeSlider").cycle({
			speed: 2000,
			timeout: 10000
		});
		//t = setTimeout('setHomeFrame()', 150);
	}
	$("#sponsorSlider").cycle({
		random: '1',
		speed: 5000
	});
	
	if($("body.submedia").length == 1) {
		$("#controls img").click(function() {
			//alert("../" + $(this).attr("src"));
			$("#slideshow").css("backgroundImage", "url('" + $(this).attr("src") + "')");
		});		
	}
	
	if($("body.inschrijven").length == 1) {
		$("#cbOverig").click(function() {
			if($("#txtDiscipline:hidden").length == 1) {
				$("#txtDiscipline").fadeIn();
			}
			else if($("#txtDiscipline:hidden").length == 0) {
				$("#txtDiscipline").fadeOut();
			}
		});
		$("#btnSubmit").click(function() {
			$("#tblInschrijven").fadeOut(function() {
				$("#patience").fadeIn();
			});
		});
		t = setTimeout('$("#inschrijfFormulier").css("left", $("#inschrijven").offset().left)', 500);
	}
	
	$("input[type='text']").click(function(){
		//$(this).val("");
		$(this).select();
	});
	$("textarea").focus(function() {
		$(this).html("");
	});
	
	/*
	**		Functionaliteiten deelnemers pagina
	*/
	if($("body.deelnemers").length == 1) {
		//$("#accordion").accordion();
		
		$("#btnAlle").click(function(){
			$("#artistList ul li span.artist").fadeIn();
			if($("#btnAdressen.optie.aan").length == 1) {
				$("#artistList ul li span.small").fadeIn();
			}
			$("#subCategorien a.active").removeClass("active");
			$("#btnAlle").addClass("active");
		});
		
		$("#btnGlas").click(function(){
			$("#subCategorien a.active").removeClass("active");
			$("#btnGlas").addClass("active");
			$("#artistList ul li:not(.g) span").fadeOut(function() {
			$("#artistList ul li.g span.artist").fadeIn();});
		});
		
		$("#btnFotografie").click(function(){
			$("#subCategorien a.active").removeClass("active");
			$("#btnFotografie").addClass("active");
			$("#artistList ul li:not(.f) span").fadeOut(function() {
			$("#artistList ul li.f span.artist").fadeIn();});
		});
		
		$("#btnBeelden").click(function(){
			$("#subCategorien a.active").removeClass("active");
			$("#btnBeelden").addClass("active");
			$("#artistList ul li:not(.b) span").fadeOut(function() {
			$("#artistList ul li.b span.artist").fadeIn();});
		});
		
		$("#btnSchilderijen").click(function(){
			$("#subCategorien a.active").removeClass("active");
			$("#btnSchilderijen").addClass("active");
			$("#artistList ul li:not(.s) span").fadeOut(function() {
			$("#artistList ul li.s span.artist").fadeIn();});
		});
		
		$("#btnOverig").click(function(){
			$("#subCategorien a.active").removeClass("active");
			$("#btnOverig").addClass("active");
			$("#artistList ul li:not(.o) span").fadeOut(function() {
			$("#artistList ul li.o span.artist").fadeIn();});
		});
		
		$("#btnAdressen").click(function() {
			var selectorString = "#artistList ul li";
			if($("#btnGlas").hasClass("active")) {
				selectorString += ".g";
			}
			if($("#btnFotografie").hasClass("active")) {
				selectorString += ".f";
			}
			if($("#btnBeelden").hasClass("active")) {
				selectorString += ".b";
			}
			if($("#btnSchilderijen").hasClass("active")) {
				selectorString += ".s";
			}
			if($("#btnOverig").hasClass("active")) {
				selectorString += ".o";
			}
			selectorString = selectorString + " span.small";
			if($("#artistList ul li span.small:visible").length < $(selectorString).length) {
				$(selectorString).fadeIn();
				$("#btnAdressen").addClass("aan");
			}
			else {
				$("#artistList ul li span.small").fadeOut();
				$("#btnAdressen").removeClass("aan");
			}
		});
		initialize();
	}
});

function resizes() {
	//	Container hoogte toekennen.
	var windowHeight = $(window).height();
	var headerHeight = $("header").height();
	var footerHeight = $("footer").height();
	var containerMinHeight = windowHeight - headerHeight - footerHeight;
	
	if($("#container").height() < containerMinHeight) {
		$("#container").height(containerMinHeight);
	}
	
	if($("body.inschrijven").length == 1) {
		if($("#container").height() < 688) {
			$("#container").height(690);
		}
	}
	
	$("#container").css("marginLeft", (($(document).width() - 1024) / 2) + "px");
	$("#headerPush, #headerPull, #footerPush, #footerPull").width(($(document).width() - 1024) / 2);
	$("html, body").height($("#wrapper").height());
}




















