
$(function()
	{
            var counter = 0;
		function replace(left, top){
			$this.animate({
					left: "-=" + left,
					top: "-=" + top
				});
				$(' .wyraz', this).fadeOut(0);
				$(' .napis', this).css({
					"margin-top": "55px",
					"font-size": "50px"
				});
		}
		$('.gwizdka').click(function(){
                    if (counter < 3){
                        var x = $(this).data('value');
                    
			var $this = $(this);
                        if ((x < 1)||(x > 3)){
                        $(this).animate({
                                top: "-=60"
                        }).delay(50).animate({
                                top: "+=60"
                        });$('#jplayer_wrong').jPlayer('play');
                        }
                    }
                });
		$('.gwizdka').one("click", function(){
			var x = $(this).data('value');
			var $this = $(this);
                        
			if (x === 1) {
				replace(700, 50);$('#jplayer_well').jPlayer('play');counter++;
			}
			else if (x === 2) {
				replace(373, -378);$('#jplayer_well').jPlayer('play');counter++;
			}
			else if (x === 3) {
				replace(350, -118);$('#jplayer_well').jPlayer('play');counter++;
			}
		
				
			function replace(left, top){
				$this.animate({
						left: "-=" + left,
						top: "-=" + top
				});
				$(' .wyraz', $this).fadeOut(0);
				$(' .napis', $this).css({
					"margin-top": "55px",
					"font-size": "50px"
				});
			}
		});
	});
