function blurAnchors(){
if(document.getElementsByTagName) {
var a = document.getElementsByTagName("a");
for(var i = 0; i < a.length; i++){
a[i].onfocus = function(){this.blur();};
}
}
}

window.onload = blurAnchors;

$(document).ready(function(){

	// ułatwienie przy animacji
	jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
		return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); 
	};	

	// obsługa formularza dodawania gości
	var validator7 = $("#formdodajgoscia").validate({
	rules: {
		'email'  		: { required: true, email: true },
		'nick'  		: "required",		
		'tresc'  		: "required"	
	},
	messages: {
		'email'  : "Proszę podać prawidłowy e-mail.",
		'nick'  : "Proszę podać imię lub nick.",	
		'tresc'  : "Proszę uzupełnić treśc wpisu."			
	},

	errorPlacement: function(error, element) {
			error.appendTo( element.parent() );
	},
	
	submitHandler: function() { 
	
		$.post("/parser/dodajgoscia.php",{ email:$('#email').val(),nick:$('#nick').val(),tresc:$('#tresc').val(),rand:Math.random() } , function(data) {
		
			if (jQuery.trim(data) == 'ok') {
				window.location = "/goscie";
			} else {
				$("#message").removeClass().addClass('red').html('Wystąpił nieoczekiwany błąd!').fadeIn("slow").animate({opacity: 1.0}, 3000).fadeOut("slow");
			}
			
		});

	}
		
	});		
	
	$("a.foto").lightBox({
		'imageLoading': "/img/lightbox-ico-loading.gif",
		'imageBtnClose': "/img/lightbox-btn-close.gif",
		'imageBtnPrev': "/img/lightbox-btn-prev.gif",		
		'imageBtnNext': "/img/lightbox-btn-next.gif",		
		'imageBlank': "/img/lightbox-blank.gif",
		'txtImage': 'Obraz',
		'txtOf': 'z'
	});	

});


