			Cufon.replace('h1'); 
			Cufon.replace('h3'); // Works without a selector engine
			Cufon.replace('.special_font'); 
			Cufon.replace('h2 a', {
			hover: true
		}); 
			Cufon.replace('h2'); 
			Cufon.replace('#navigation a', {
			hover: true
		}); // Requires a selector engine for IE 6-7, see above
		
$(window).load(function() 
{
        $('#slider').nivoSlider();
        
});
    
$(function() {
	
		$('.gallery a, .gallery_div a').lightBox({
			imageLoading: '/application/assets/images/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon
			imageBtnPrev: '/application/assets/images/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image
			imageBtnNext: '/application/assets/images/lightbox-btn-next.gif', // (string) Path and the name of the next button image
			imageBtnClose: '/application/assets/images/lightbox-btn-close.gif', // (string) Path and the name of the close btw
			imageBlank: '/application/assets/images/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel)
			txtImage:'Obrazek',
			txtOf:'z'
}); 
		
	
		
});

$(document).ready(function() {
	
		// NEWSLETTER	
$("#newsletter-form").validate({
		   meta: "validate",
errorPlacement: function (error, element) {
            element.addClass("error");
},
success: function(element){
        element.removeClass("error");
},
                  submitHandler: function(form) {
                  
 $.ajax ({
            type: 'post',
            url : '/index.php/main/subscribe',
            data: $('#newsletter-form').serialize(),
            
            beforeSend: function() {
     		$('.newsletter-submit').attr('disabled',true);
 			 },
                
            success: function() {
            	$('#thx').slideUp(function() {
            		$(this).removeClass().addClass('thx_newsletter');
            		$(this).text('Dziękujemy.');
            		Cufon.replace(this);
            	});
            	$('#thx').slideDown(500);
            	$('.newsletter-submit').text('Dodano.');
            	$('.newsletter-submit').attr('disabled',false);
               }

            }).error(function() { 
            	
            	$('#thx').slideUp(function() {
            		$(this).text('Jesteś już naszym subskrybentem.');
                	$(this).removeClass().addClass('thx_error');
            		Cufon.replace(this);
            	});
            	$('#thx').slideDown(500);
            	$('.newsletter-submit').attr('disabled',false);
            	
            	
            	});
			return false;			


		   }
	});	
	
$('#newsletter-email').focus(function() {
	
	$('.newsletter-submit').text('Zatwierdź');
	
});
//-> Newsletter End;

// SEND MAIL

$("#send-mail-form").validate({
		   meta: "validate",
errorPlacement: function (error, element) {
            element.addClass("error");
},
success: function(element){
        element.removeClass("error");
},
                  submitHandler: function(form) {
                  
 $.ajax ({
            type: 'post',
            url : '/index.php/kontakt/send_mail',
            data: $('#send-mail-form').serialize(),
            
            beforeSend: function() {
     		$('.submit_button').attr('disabled',true);
 			 },
                
            success: function() {
            	$('#thx').slideUp(function() {
            		$(this).removeClass().addClass('thx_mail');
            		$(this).text('Dziękujemy za wiadomość.');
            		Cufon.replace(this);
            	});
            	$('#thx').slideDown(500);
            	$('.submit_button').text('Wysłano.');
            	$('.submit_button').attr('disabled',false);
               }

           });
			return false;			

 
		   }
	});	


//-> Send MAIL End;

//-> Survey

$("#survey").validate({
		   meta: "validate",
errorPlacement: function (error, element) {
            element.addClass("error");
},
success: function(element){
        element.removeClass("error");
},
                  submitHandler: function(form) {
                  
 $.ajax ({
            type: 'post',
            url : '/index.php/main/add_vote',
            data: $('#survey').serialize(),
            
            beforeSend: function() {
     		$('.submit_button').attr('disabled',true);
 			 },
                
            success: function(responded) {
            	if (responded == 'ok') 
            	{
            		$('#thx_survey').slideUp(function() {
            		$(this).removeClass().addClass('thx_mail');
            		$(this).text('Dziękujemy za głos.');
            		Cufon.replace(this);
            		});         		
            	} else
            	{
            		$('#thx_survey').slideUp(function() {
            		$(this).removeClass().addClass('thx_mail');
            		$(this).text('Już głosowałeś.');
            		Cufon.replace(this);
            		});            		
            	};
            	
            	$('#thx_survey').slideDown(500);
            	$('.submit_button').text('OK');
            	$('.submit_button').attr('disabled',false);
               }

           });
			return false;			

 
		   }
	});	
//


//-> Children animate Start;

// Children jumps after refresh

$("#dziecko7").animate({
    top: '-=50',
  }, 500, function() {
    $("#dziecko7").animate({
    top: '+=50',
  }, 300, function() {
$("#dziecko2").animate({
    top: '-=50',
  }, 500, function() {
    $("#dziecko2").animate({
    top: '+=50',
  }, 300, function() {
$("#dziecko3").animate({
    top: '-=50',
  }, 500, function() {
    $("#dziecko3").animate({
    top: '+=50',
  }, 300, function() {
  				});
  			});
  		});
  	});
  });
});

// Children move on mouseover

$(".do-jump").mouseover(function() {
  
   $(this).animate({
    top: '-=50',
  	}, 500, function() {
   $(this).animate({
    top: '+=50',
  	}, 300, function() {
  	});
  });
  
});

$("#motylek").mouseover(function() {

	$(this).animate({
    left: '-=50',
    top: '-=50',
  }, 3000, function() {
    $(this).animate({
    left: '+=200',
    top: '+=50',
  }, 3000, function() {
    // Animation complete.
  });
  });

});
//-> Children animate End;
	
});


