
		$(document).ready(
				function()
				{
					$('.lightbox').lightbox({
						fileLoadingImage: '/images/loading.gif',
						fileBottomNavCloseImage: '/images/closelabel.gif'
					});
					$("#addReviewLink").click(
						function()
						{
						$("#addReview").toggle();
						}).toggle(function() { $(this).text('-schowaj formularz'); }, function() { $(this).text("+dodaj własną recenzję"); });
					
					$("#addPhotosLink").click(
						function()
						{
						$("#photosSection").toggle();
						}).toggle(function() { $(this).text('-urkyj'); }, function() { $(this).text("+dodaj zdjęcia"); });
					
					
					
					jQuery.validator.setDefaults({ 
		    			
		    			errorElement: "div", 
		    			errorClass: "formError"
		    		}
					);
					
					$("#reviewForm").validate({
						rules: {
							review: "required",
							guestName: { 
								required: "#guestRadio:checked",
								minLength: 2 
							}, 
							login: { 
								required: "#registrationRadio:checked"
							}, 
							email: { 
								required: "#registrationRadio:checked",
								email: true
							}, 
							password: {
								required: "#registrationRadio:checked",
								minlength: 6 
							},
							repeatPassword: {
								required: "#registrationRadio:checked",
								equalTo: "#password" 
								
							},
							dateBirth: {
								dateISO: "#registrationRadio:checked"
								
							},
							avatar: {
								accept: "jpg|jpeg|png|gif"
							},
							photo1: {
								accept: "jpg|jpeg|png|gif"
							},
							photo2: {
								accept: "jpg|jpeg|png|gif"
							},
							photo3: {
								accept: "jpg|jpeg|png|gif"
							},
							userLogin: { 
								required: "#loginRadio:checked",
								minLength: 2 
							}, 
							userPassword: { 
								required: "#loginRadio:checked"
							}, 
							termsAndConditions: {
								required: "#registrationRadio:checked"
							}, 
							antiBot: {
								required: true, 
								range: [4,4]
							}
							
						},
						messages: {
							review: {
								required: "Wpisz recenzję (przynajmniej kilka słów...)"
							},
							password: {
								
								required: "Musisz podać hasło",
								minlength: "Hasło musi mieć conajmniej 6 znaków"
							}, 
							repeatPassword: {
								required: "Powtórz hasło",
								minlength: "Hasło musi mieć conajmniej 6 znaków", 
								equalTo: "Podane hasła muszą się zgadzać"
							}, 
							avatar: "Nieprawidłowy format pliku. Dopuszczalne rozszerzenia: jpg, gif, png...", 
							dateBirth: "Nieprawidłowy format daty", 
							userLogin: "Musisz podać nazwę użytkownika", 
							userPassword: "Musisz podać hasło", 
							login: {
								required: "Musisz podać login"
								
							},  
							email: {
								required: "Musisz podać e-mail", 
								email: "Nieparwidłowy adres e-mail"
							}, 
							guestName: {
								required: "Podaj jakiś identyfikator", 
								minlength: "Nazwa musi mieć conajmniej 2 znaki..."
							}, 
							antiBot: {
								required: "Wpisz 4 ;-)", 
								range: "2+2=4 ;-)"
							}, 
							termsAndConditions: "Jeżeli się rejestrujesz musisz zaakceptować regulamin...", 
							registrationRadio: "aaaaaaaa"
						}
					});	
					$("#advantages").focus(function () {
		         		$(this).text("");
		    		});
		    		$("#disadvantages").focus(function () {
		         		$(this).text("");
		    		});
		    		$("#review").focus(function () {
		         		$(this).text("");
		    		});
	
				});
