$(document).ready(function() {
				
            $("#obr").jCarouselLite({
                btnNext: "#next",
                btnPrev: "#prev",
                visible: 2,
                easing: "easeOutBounce",
                speed: 1300
                });

		$("a#single_image").fancybox({
			'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack',
		'speedIn':500,
		'speedOut':300
			});
        $("#obr li a").fancybox({
		   'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack',
		'speedIn':500,
		'speedOut':300
			});
			
		$("a.proj").fancybox({
			'hideOnContentClick': false,
			'frameWidth':820,
			'frameHeight':620,
			'centerOnScroll':false,
			'overlayShow': true,
			'overlayOpacity':0.7
		});
        
        $("a.kontakt").fancybox({
			'width':620,
			'height':400,
           'hideOnContentClick': false,
           'autoScale': true,
		   'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack',
		'speedIn':500,
		'speedOut':300
        });
        
        $("#k_dalej, #k_dalej2").click(function(){
            $("div#prawy_tekst").find("div#dane_kontaktowe").hide(1500);
            $("div#prawy_tekst").find("div#w_formularz").show(1500);
        });
            $("#k_wczesniej").click(function(){$("div#prawy_tekst").find("div#dane_kontaktowe").show(1500);
            $("div#prawy_tekst").find("div#w_formularz").hide(1500);
            });
        

	$("#menu").jFlow({
		slides: "#strony",
		controller: ".korof", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "aktywna",  // just pure text, no sign
        easing: "easeOutElastic",
		duration: 1500
	});
	
    $("#adr").append("korn");
    $("#adr").append("acki@kor");
    $("#adr").append("of.com");

    $('#email').example('Twój adres e-mail');
    $('#area_mail').example('Wpisz treść swojej wiadomości');
	
	$('#email').blur(function() {
      $.get('spr_mail.php', { email: $(this).val() },
        function(data){
        
         if (data == 'error') {
           $("#email").next("span").show(500);
		   $("#wyslij").hide(500);

        } else {
			$("#email").next("span").hide(500);
			$("#wyslij").show(500);
			}
     })
	}    
	);
	
	$('#wyslij').click(function() {
		$.get('mail.php', { tresc: $('#area_mail').val(), email: $('#email').val() }, 
			  function(data){
				if (data == 'blad') {
					alert('Wystąpił błąd. Spróbuj jeszcze raz!');
				} else {
				$("div#prawy_tekst").find("div#dane_kontaktowe").show(1500);
            $("div#prawy_tekst").find("div#w_formularz").hide(1500);
			$('#wyslano_mail').show();
				}
				});
	}
	);
	 
      var $curr = $("#nr");
   var $liczba = 1;
   var $max_liczba = 4;
   $(".poprz_projekt").hide();
    $(".nast_projekt").click(function () {
		$curr = $("#nr"+$liczba);
		$curr.hide(400);
		if ($liczba<=$max_liczba){ 
		$liczba=$liczba+1;
		};
		if ($liczba==$max_liczba){
			$(".nast_projekt").hide(400);
		};
		if ($liczba>1) {
		$(".poprz_projekt").show(400);
		}
      
    });
	
	$(".poprz_projekt").click(function () {
		if ($liczba>1) {
		$liczba=$liczba-1;
		};
		if ($liczba==1){
		$(".poprz_projekt").hide(400);
		};
		$curr = $("#nr"+$liczba);
		$curr.show(400);
		if ($liczba<$max_liczba){
			$(".nast_projekt").show(400);
		}
	  
    });
    
    $("#accordion").accordion();


});
new Image().src='gfx/prev.jpg';
new Image().src='gfx/next.jpg'
;new Image().src='lib/fancybox/fancy_closebox.png';
new Image().src='lib/fancybox/fancy_progress.png';

