$(document).ready(function(){

	

	
	//skorka 3
	$('header nav ul li a').first().css('padding-left', '0');
	$('header nav ul li a').last().css('padding-right', '0');


	
	// ramka w okól obrazka z podsisem z alta
	$('#content img').each(function() {
	    $(this).wrap('<div class="caption" style="' + $(this).attr('style') + '"></div>').after('<div class="imgcaptiontext">' + $(this).attr('alt') + '</div>');
	   
	});
	
	
	
	// ramka w okól obrazka z podsisem z alta
	$('.singleGalleryImages').each(function() {
	    
	    
	    var imagesi = $(this).children().length;

	    
	    if (imagesi==1) { 
			$(this).width(152);
		} else if (imagesi==2) {
			$(this).width(304);
		} else if (imagesi==3) {
			$(this).width(456);
		} else {
			
		}
	    
	});
	
	
	
	
	
	// link na gore strony
	$('a[href=#top]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
	
	
	//tło nagłowków tabeli przyciemnone
	$('table').each(function() {
		$('tr:first', this).css('background-color', '#006eb6');
		$('tr:first', this).css('color', '#fff');
	});
	

	// madanie id naglowka h4 w content-text
	var index = 1;
	$('#content-text h4').each(function() {
	    $(this).attr("id", index);
	    index++;	   
	});


	$('#content-text .imagetiem a').lightBox();


 	
 	
 	$("#contactForm").validate({
   		submitHandler: function(form) {
      
	      	var dataString = $("form#contactForm").serialize();
			//alert (dataString);return false;
			if ($.browser.msie && $.browser.version.substr(0,1)<8) {
	 		 // search for selectors you want to add hover behavior to
			
			} else {
				$(".contaktFormToggle").html("<div id=\"messagesend\"><img src=\"images-ckeditor/ajax-loader.gif\" alt=\"Postęp\" /><br /><p>Trwa wysyłanie.</p></div>");
			}
					
			$("#messagesend")
				.fadeIn(1500, function() {
					$("#messagesend");
				});
			
			$.ajax({
	      		type: "POST",
	      		url: "_wyslij.php",
	      		data: dataString,
	      		success: function() {
					$(".contaktFormToggle").html("<div id=\"message\"></div>");
					$("#message").html("<h2>Wiadomość została wysłana.</h2>")
					.append("<p>Wkrótce otrzymasz odpowiedz.</p>")
					.hide()
					.fadeIn(1500, function() {
					$("#message");
					});
				}
     		});
      
   			form.submit();
   		}	
	})
 	

	Cufon.replace('h1, h2');

	
	Cufon.replace('.headerBigBackgroundIntro h1', {
		textShadow: '#000000 1px 1px'
	});


	

});




