$(function() {
		
		// The Tooltips
		row = $("form .row");
		row.find("input").focus(
			function () {
				$(this).parent().find(".tooltip").fadeIn("slow");
		  	}
		);
		row.find("input").blur(
		  	function () {
				$(this).parent().find(".tooltip").fadeOut("fast");
		  	}
		);
		
		
		// Validation		
		//$("#registration").validate({
		//	submitHandler: function(form) {
		//	form.submit();
 		//	}
		//});
		
		
		$("#registration").validate({
			rules: {
				firstname: "required",
				surname: "required",
				clubposition: {
					required: true,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				},
				emailconfirm: {
					required: true,
					email: true,
					equalTo: "#email"
				},
				terms: "required"
			},
			messages: {
				firstname: "Please enter your first name",
				surname: "Please enter your last name",
				clubposition: {
					required: "Please tell us how you are affiliated with the club",
					minlength: "Your username must consist of at least 2 characters"
				},
				email: "Please enter a valid email address",
				emailconfirm: {
					required: "Please enter a valid email address",
					equalTo: "Please enter the same email as above"
				},
				terms: "You must agree to our Terms &amp; Conditions and Privacy Statement to proceed."
			},
			submitHandler: function(form) {
				form.submit();
 			}
		});

	});

	// Alphanumeric password fields
	$('#password').alphanumeric();
	
	
	function opendomains(){
				var thingy="/community/signup/club/team_selector.pl?number_of_teams=" + document.myform.numberofteams.selectedIndex;
 			
				mywindow=window.open(thingy,'new','height=600,width=409,scrollbars=yes'); 
				mywindow.focus();
		
			}	