$(document).ready(function(){

Cufon.replace('#horiz', {hover: true})('#oddzialy')('h1')('h2')('h3');

//lightbox
jQuery.fn.exists = function(){return jQuery(this).length>0;}

if ($(".lightbox").exists()) {

$('.lightbox').fancybox({titlePosition: 'over'});

}


//nav
$('.main #horiz a').hover(function(){
	$(this).stop(true, false).animate({opacity: .7, padding: '5px 15px'}, 'fast');
}, function(){
	$(this).animate({opacity: 1, padding: '3px 15px'}, 'fast');
});

//sub nav
$('.sub #horiz a').hover(function(){
	$(this).stop(true, false).animate({opacity: .7, padding: '4px 8px 7px 8px'}, 'fast');
}, function(){
	$(this).animate({opacity: 1, padding: '2px 8px 4px 8px'}, 'fast');
});

//newsy
$('#news a:last').addClass('last');


if( $('#slides').get(0) ) {
//slideshow
$('#slides').crossSlide({
  fade: 1
}, [

  {
    src:  'js/main1.jpg',
    from: '20% 50% 0.8x',
    to:   '70% 50% 0.6x',
    time: 3
  }, {

    src:  'js/main2.jpg',
    from: '70% 90% 1x',
    to:   '55% 60% 1.2x',
    time: 2

  }, {

    src:  'js/main3.jpg',
    from: '30% 55% 1x',
    to:   '60% 35%  0.7x',
    time: 2
  }, {

    src:  'js/main4.jpg',
    from: '60% 40% 1x',
    to:   '30% 100% 0.5x',
    time: 2
  }
]);
}



//formularz kontaktowy
	if( $('#kontakt').get(0) ) {

	$("form").validator({
		position: 'top left',
		offset: [1, 0],
		message: '<div><em /></div>',
		lang: 'pl'
	});


		$.tools.validator.localize("pl", {
	'*'			: 'Popraw poniższe pole',
	':email'  	: 'Nieprawidłowy adres email',
	':number' 	: 'Dozwolone są tylko liczby',
	':url' 		: 'Podaj prawidłowy adres url',
	'[max]'	 	: 'Za dużo znaków',
	'[min]'		: 'Za mało znaków',
	'[required]': 'To pole jest wymagane'
});


	}


}); //ready

