$(document).ready(function() {

	$('.menu .link').mouseover( function() {
		$(this).children('.drop').show();	
	}).mouseout( function() {
		$(this).children('.drop').hide();		
	});

	$('#fotoselectie').css('cursor', 'pointer')
	  .click( function() {
		$.get('imagescroller/' + $('.fotoselectie').attr('id') + '/' + $('.fotoselectie').attr('title') + '/' + $('#fotoselectie').attr('class'), 
			function( data ) {	
				$('#fotoselectie').fadeOut();
				setTimeout( function() { $('#fotoselectie').html( data ); $('#fotoselectie').fadeIn(); }, 400 );
				//
		});												
	});
	  
	$('#chooseTennis').click( function() {
		$('#tennisTR').show();
		$('#squashTR').hide();
	});
	
	$('#chooseSquash').click( function() {
		$('#squashTR').show();	
		$('#tennisTR').hide();
	});
	
	$('#nieuwjaars').submit( function() {
		var params = {}; 
		$("input[@checked], input[@type='text'], input[@type='hidden'], input[@type='password'], option[@selected], textarea")
		.filter(":enabled") 
		.each(function() { 
			params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value; 
		}); 
		$.post('formulieren/nieuwjaarshappening', params, function( data ) { 
			var array = data.split(',');
			var string = '';
			var j = 0;
			for( i in array )
			{
				string += array[i] + '\n';
				j++;
			}			
			if( j > 1 )
				alert( string );
			else
				window.location = 'http://www.nieuwesloot.nl/formulieren/bedankt/Nieuwjaarshappening';
		});
	});
	
	$('#scholieren').submit( function() {
		var params = {}; 
		$("input[@checked], input[@type='text'], input[@type='hidden'], input[@type='password'], option[@selected], textarea")
		.filter(":enabled") 
		.each(function() { 
			params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value; 
		}); 
		$.post('formulieren/scholierentoernooi', params, function( data ) { 
			var array = data.split(',');
			var string = '';
			var j = 0;
			for( i in array )
			{
				string += array[i] + '\n';
				j++;
			}			
			if( j > 1 )
				alert( string );
			else
				window.location = 'http://www.nieuwesloot.nl/formulieren/bedankt/Scholierentoernooi';
		});
	});
});

