Cufon.replace('#htd2 ul li', {
	color: '-linear-gradient(#fff, #aaa)',
	hover: {
		
		color: '-linear-gradient(#fff, #fff)'
	}	
});

Cufon.replace('.motto');

Cufon.replace('h1, h2', {
	color: '-linear-gradient(#fff, #aaa)'
});

Cufon.replace('.hprodukty', {
	color: '-linear-gradient(#333, #000)'
});

Cufon.replace('.hkatalog_fefco', {
	color: '-linear-gradient(#333, #000)'
});

Cufon.replace('.fefco', {
	color: '-linear-gradient(#333, #000)'
});

Cufon.replace('#f1', {
	color: '-linear-gradient(#ccc, #fff)'
});

Cufon.replace('.sns', {
	color: '-linear-gradient(#333, #555)'
});




function slideSwitchPrev() {
    var $active = $('.gallery SPAN.active');

    if ( $active.length == 0 ) $active = $('.gallery SPAN:last');

    // use this to pull the images in the order they appear in the markup
	
	//if($active.prev().length == 0) 
	
    var $next =  $active.prev().length ? $active.prev()
        : $('.gallery SPAN:last');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 700, function() {
            $active.removeClass('active last-active');
        });
}



function slideSwitchNext() {
    var $active = $('.gallery SPAN.active');

    if ( $active.length == 0 ) $active = $('.gallery SPAN:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.gallery SPAN:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 700, function() {
            $active.removeClass('active last-active');
        });
}



$(document).ready(function() {	
						   
						   




//var intervalID = setInterval("slideSwitchNext()", 5000);


$('.next').click(function() {
  slideSwitchNext();
  
 // clearInterval(intervalID);
});


$('.prev').click(function() {
  slideSwitchPrev();
  
   // clearInterval(intervalID);
  
});

 $(".next").mouseenter(
 function()
 {
    $(this).fadeTo("slow", 0.6);


 });
 
  $(".next").mouseleave(
 function()
 {
	$(this).fadeTo("slow", 1.0);


 });
  
  
   $(".prev").mouseenter(
 function()
 {
    $(this).fadeTo("slow", 0.3);


 });
 
  $(".prev").mouseleave(
 function()
 {
	$(this).fadeTo("slow", 1.0);


 });


						   
						   
						   
	
	
slideShow();			   
						   
						   
$('.submit').click(function() {
							
  $('#szukaj').submit();
});		   
						   
						   
$("#kon").validate({  
        rules: {		
			imie: {
                required: true,
                },
				
			ulica: {
                required: true,
                },
				
			tel: {
                required: true,
                },

            email: {
                required: true,
                email: true
                },
			rodzaj: {
                required: true,
                },
			od: {
                required: true,
                },
			doo: {
                required: true,
                }

				
				
            },
        messages: {
       
			
			
			imie:{
                required: "Pole  nie może być puste!",
            },
			ulica:{
                required: "Pole  nie może być puste!",
            },
			tel:{
                required: "Pole  nie może być puste!",
            },
            email:{
                required: "Pole  nie może być puste!",
                email: "Nieprawidłowy adres!"
                },
			rodzaj:{
                required: "Pole  nie może być puste!",
            },
			od:{
                required: "Pole  nie może być puste!",
            },
			doo:{
                required: "Pole  nie może być puste!",
            },
				

			

        },
		success: function(label) {
			label.html("&nbsp;").addClass("sprawdzony");
		}

  });	


$("a[rel=group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});			
	
	
});


jQuery(function ($) {
	$('#basic-modal .mapa').click(function (e) {
		$('#basic-modal-content').modal();
		
		  return false;
	});
});



 
 function slideShow() {

	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#gallery .caption').css({opacity: 0.9});

	//Resize the width of the caption according to the image width
	$('#gallery .caption').css({width: 1000});
	
	//Get the caption of the first image from REL attribute and display it

	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',6000);
	
}

function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#gallery .caption').animate({opacity: 0.9},100 ).animate({height: '76px'},500 );
	
	//Display the content
	$('#gallery .content').html(caption);
	
	
}





