<?php
/*
if (!isset($_SESSION['nazwa'])) {
		header('Location: login.php');
		exit();
	}
	*/
?>

<!DOCTYPE html 
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Platforma Wirtualny asystent</title>
	<meta name="description" content="Wirtualny asystent" />
    <meta name="keywords" content="asystent, niepełnosprawny intelektualnie, pomoc" />
	<script src="js/jquery.js"></script>
	<script src="js/jquery_e.js"></script>
	<script src="js/color_animation.js"></script>
	<script src="js/buzz.js"></script>
</head>

<style>
#audio_but1, #audio_but2, #audio_but3 {
	width: 28px;
	height: 60px;
	white-space: normal;
	word-break: break-all;
	background: #f8f8f8;
	padding: 0;
	margin: 2px 2px;
	float: left;
}

#audio_but2 {
	width: 24px;
	background: #080808;
	color: #FFF;
	margin: 2px 4px;
}

#audio_but3 {
	background: none;
	border: none;
}

#audio_tlo_klawisze {
	width: 705px;
	height: 130px;
	background: #566;
	padding: 5px 10px;
	margin: 10px auto;
}

#audio_tlo_klawisze1, #audio_tlo_klawisze2 {
	width: 705px;
	height: 64px;
	background: #none;
}

#audio_tlo_klawisze2 {
	background: none;
	position: relative;
	left: 15px;
	top: 20px;
	border: 1px ridge #f00;
}

</style>

<body>

	<div id="audio_tlo_klawisze">	
		<div id="audio_tlo_klawisze2">
			<input type="button" id="audio_but2" class="audio_nut1s" Title="Gis" value="2">
			<input type="button" id="audio_but2" class="audio_nut2s" Title="As" value="3">
			<input type="button" id="audio_but3" value="">			
			<input type="button" id="audio_but2" class="audio_nut4s" Title="Cis" value="5">
			<input type="button" id="audio_but2" class="audio_nut5s" Title="Dis" value="6">
			<input type="button" id="audio_but3" value="">	
			<input type="button" id="audio_but2" class="audio_nut7s" Title="Fis" value="8">
			<input type="button" id="audio_but2" class="audio_nut8s" Title="Gis" value="9">
			<input type="button" id="audio_but2" class="audio_nut9s" Title="As" value="0">
			<input type="button" id="audio_but3" value="">			
			<input type="button" id="audio_but2" class="audio_nut11s" Title="Cis" value="=">
			<input type="button" id="audio_but2" class="audio_nut12s" Title="Dis" value="A">
			<input type="button" id="audio_but3" value="">	
			<input type="button" id="audio_but2" class="audio_nut14s" Title="Fis" value="D">
			<input type="button" id="audio_but2" class="audio_nut15s" Title="Gis" value="F">
			<input type="button" id="audio_but2" class="audio_nut16s" Title="As"  value="G">
			<input type="button" id="audio_but3" value="">			
			<input type="button" id="audio_but2" class="audio_nut18s" Title="Cis" value="J">
			<input type="button" id="audio_but2" class="audio_nut19s" Title="Dis" value="K">
			<input type="button" id="audio_but3" value="">	
			<input type="button" id="audio_but2" class="audio_nut21s" Title="Fis" value=";">
		</div>
		<div id="audio_tlo_klawisze1">
			<input type="button" id="audio_but1" class="audio_nut1" Title="G" value="Q">
			<input type="button" id="audio_but1" class="audio_nut2" Title="A" value="W">
			<input type="button" id="audio_but1" class="audio_nut3" Title="H" value="E">
			<input type="button" id="audio_but1" class="audio_nut4" Title="C" value="R">
			<input type="button" id="audio_but1" class="audio_nut5" Title="D" value="T">
			<input type="button" id="audio_but1" class="audio_nut6" Title="E" value="Y">
			<input type="button" id="audio_but1" class="audio_nut7" Title="F" value="U">
			<input type="button" id="audio_but1" class="audio_nut8" Title="G" value="I">
			<input type="button" id="audio_but1" class="audio_nut9" Title="A" value="O">
			<input type="button" id="audio_but1" class="audio_nut10" Title="H" value="P">
			<input type="button" id="audio_but1" class="audio_nut11" Title="C" value="[">
			<input type="button" id="audio_but1" class="audio_nut12" Title="D" value="]">
			<input type="button" id="audio_but1" class="audio_nut13" Title="E" value="Z">
			<input type="button" id="audio_but1" class="audio_nut14" Title="F" value="X">
			<input type="button" id="audio_but1" class="audio_nut15" Title="G" value="C">
			<input type="button" id="audio_but1" class="audio_nut16" Title="A" value="V">
			<input type="button" id="audio_but1" class="audio_nut17" Title="H" value="B">
			<input type="button" id="audio_but1" class="audio_nut18" Title="C" value="N">
			<input type="button" id="audio_but1" class="audio_nut19" Title="D" value="M">
			<input type="button" id="audio_but1" class="audio_nut20" Title="E" value=",">
			<input type="button" id="audio_but1" class="audio_nut21" Title="F" value=".">
			<input type="button" id="audio_but1" class="audio_nut22" Title="G" value="/">
			
		</div>	
	</div>
	<input type="text" id="audio_tb1" value="00:00">
	<input type="button" id="audio_but1" class="audio_graj" value="Graj">
</body>
</html>
<script type="text/javascript">

$(document).ready(function(){
	var nuta_G0 = new buzz.sound("audio/Nuty/G0.mp3");
	var nuta_Gs0 = new buzz.sound("audio/Nuty/Gs0.mp3");
	var nuta_A0 = new buzz.sound("audio/Nuty/A0.mp3");
	var nuta_As0 = new buzz.sound("audio/Nuty/As0.mp3");
	var nuta_H0 = new buzz.sound("audio/Nuty/H0.mp3");
	var nuta_C1 = new buzz.sound("audio/Nuty/C1.mp3");
	var nuta_Cs1 = new buzz.sound("audio/Nuty/Cs1.mp3");
	var nuta_D1 = new buzz.sound("audio/Nuty/D1.mp3");
	var nuta_Ds1 = new buzz.sound("audio/Nuty/Ds1.mp3");
	var nuta_E1 = new buzz.sound("audio/Nuty/E1.mp3");
	var nuta_F1 = new buzz.sound("audio/Nuty/F1.mp3");
	var nuta_Fs1 = new buzz.sound("audio/Nuty/Fs1.mp3");
	var nuta_G1 = new buzz.sound("audio/Nuty/G1.mp3");
	var nuta_Gs1 = new buzz.sound("audio/Nuty/Gs1.mp3");
	var nuta_A1 = new buzz.sound("audio/Nuty/A1.mp3");
	var nuta_As1 = new buzz.sound("audio/Nuty/As1.mp3");
	var nuta_H1 = new buzz.sound("audio/Nuty/H1.mp3");
	var nuta_C2 = new buzz.sound("audio/Nuty/C2.mp3");
	var nuta_Cs2 = new buzz.sound("audio/Nuty/Cs2.mp3");
	var nuta_D2 = new buzz.sound("audio/Nuty/D2.mp3");
	var nuta_Ds2 = new buzz.sound("audio/Nuty/Ds2.mp3");
	var nuta_E2 = new buzz.sound("audio/Nuty/E2.mp3");
	var nuta_F2 = new buzz.sound("audio/Nuty/F2.mp3");
	var nuta_Fs2 = new buzz.sound("audio/Nuty/Fs2.mp3");
	var nuta_G2 = new buzz.sound("audio/Nuty/G2.mp3");
	var nuta_Gs2 = new buzz.sound("audio/Nuty/Gs2.mp3");
	var nuta_A2 = new buzz.sound("audio/Nuty/A2.mp3");
	var nuta_As2 = new buzz.sound("audio/Nuty/As2.mp3");
	var nuta_H2 = new buzz.sound("audio/Nuty/H2.mp3");
	var nuta_C3 = new buzz.sound("audio/Nuty/C3.mp3");	
	var nuta_Cs3 = new buzz.sound("audio/Nuty/Cs3.mp3");
	var nuta_D3 = new buzz.sound("audio/Nuty/D3.mp3");
	var nuta_Ds3 = new buzz.sound("audio/Nuty/Ds3.mp3");
	var nuta_E3 = new buzz.sound("audio/Nuty/E3.mp3");
	var nuta_F3 = new buzz.sound("audio/Nuty/F3.mp3");
	var nuta_Fs3 = new buzz.sound("audio/Nuty/Fs3.mp3");
	var nuta_G3 = new buzz.sound("audio/Nuty/G3.mp3");
	
	var grupa = new buzz.sound([
    "audio/Nuty/C2.mp3", "audio/Nuty/D2.mp3", "audio/Nuty/E2.mp3"
	]);
	
	var gama1 = [nuta_G0, nuta_Gs0, nuta_A0, nuta_As0, nuta_H0, nuta_C1, nuta_Cs1, nuta_D1, nuta_Ds1, nuta_E1, 
				 nuta_F1, nuta_Fs1, nuta_G1, nuta_Gs1, nuta_A1, nuta_As1, nuta_H1, nuta_C2, nuta_Cs2, nuta_D2, 
				 nuta_Ds2, nuta_E2,  nuta_F2, nuta_Fs2, nuta_G2, nuta_Gs2, nuta_A2, nuta_As2, nuta_H2, nuta_C3,
				 nuta_Cs3, nuta_D3,  nuta_Ds3, nuta_E3, nuta_F3, nuta_Fs3, nuta_G3
	];
	var czas1 = [350, 250, 250, 250, 350, 250, 250, 1000, 350, 250, 250, 350, 250, 250, 1500,
	             350, 250, 250, 250, 350, 250, 250, 750, 350, 250, 250, 350, 250, 250, 1000,
				 350, 250, 250, 250, 350, 250, 250, 750, 350, 250, 250, 350, 250, 250, 2000];
	var utwor2 = [24, 21, 22, 24, 26, 24, 24, 21, 24, 21, 22, 24, 26, 24, 28,
				  28, 28, 28, 28, 26, 28, 26, 24, 26, 26, 26, 26, 24, 22, 21,
				  28, 28, 28, 28, 26, 28, 26, 24, 26, 26, 26, 26, 24, 22, 21];
	var utwor1 = [12, 9, 10, 12, 14, 12, 12, 9, 12, 9, 10, 12, 14, 12, 16,
				  16, 16, 16, 16, 14, 16, 14, 12, 14, 14, 14, 14, 12, 10, 9,
				  16, 16, 16, 16, 14, 16, 14, 12, 14, 14, 14, 14, 12, 10, 9];		
	var audio_lp=0;
	var stan_klawiszy = [];
	audioStart();
	//----------------------------------------------------------------------------------
	
	
	function audioStart() {
		for (i=0; i<37; i++) {
			stan_klawiszy[i]=true;
		}
	}
	
	$('.audio_graj').click (function() {
		 audio_lp=0;
		odtwarzaj(45);
	});

	//Klawisze - klik
	$('.audio_nut1').click (function() {
		nuta_G0.stop();
		nuta_G0.play();
		
		//grupa.play();
		
		//klawiatura1[2].play();
		//audio_lp=0;
		//odtwarzaj(10);
	});
	
	$('.audio_nut2').click (function() {
		nuta_A0.stop();
		nuta_A0.play();
	});
	
	$('.audio_nut3').click (function() {
		nuta_H0.stop();
		nuta_H0.play();
	});
	
	$('.audio_nut4').click (function() {
		nuta_C1.stop();
		nuta_C1.play();
	});
	
	$('.audio_nut5').click (function() {
		nuta_D1.stop();
		nuta_D1.play();
	});
	
	$('.audio_nut6').click (function() {
		nuta_E1.stop();
		nuta_E1.play();
	});
	
	$('.audio_nut7').click (function() {
		nuta_F1.stop();
		nuta_F1.play();
	});
	
	$('.audio_nut8').click (function() {
		nuta_G1.stop();
		nuta_G1.play();
	});
	
	$('.audio_nut9').click (function() {
		nuta_A1.stop();
		nuta_A1.play();
	});
	
	$('.audio_nut10').click (function() {
		nuta_H1.stop();
		nuta_H1.play();
	});
	
	$('.audio_nut11').click (function() {
		nuta_C2.stop();
		nuta_C2.play();
	});
	
	$('.audio_nut12').click (function() {
		nuta_D2.stop();
		nuta_D2.play();
	});
	
	$('.audio_nut13').click (function() {
		nuta_E2.stop();
		nuta_E2.play();
	});
	
	$('.audio_nut14').click (function() {
		nuta_F2.stop();
		nuta_F2.play();
	});
	
	$('.audio_nut15').click (function() {
		nuta_G2.stop();
		nuta_G2.play();
	});
	
	$('.audio_nut16').click (function() {
		nuta_A2.stop();
		nuta_A2.play();
	});
	
	$('.audio_nut17').click (function() {
		nuta_H2.stop();
		nuta_H2.play();
	});
	
	$('.audio_nut18').click (function() {
		nuta_C3.stop();
		nuta_C3.play();
	});
	
	$('.audio_nut19').click (function() {
		nuta_D3.stop();
		nuta_D3.play();
	});
	
	$('.audio_nut20').click (function() {
		nuta_E3.stop();
		nuta_E3.play();
	});
	
	$('.audio_nut21').click (function() {
		nuta_F3.stop();
		nuta_F3.play();
	});
	
	$('.audio_nut22').click (function() {
		nuta_G3.stop();
		nuta_G3.play();
	});
	
	//Nuty podwyzszone o pol tonu
	$('.audio_nut1s').click (function() {
		nuta_Gs0.stop();
		nuta_Gs0.play();
	});
	
	$('.audio_nut2s').click (function() {
		nuta_As0.stop();
		nuta_As0.play();
	});
	
	$('.audio_nut4s').click (function() {
		nuta_Cs1.stop();
		nuta_Cs1.play();
	});
	
	$('.audio_nut5s').click (function() {
		nuta_Ds1.stop();
		nuta_Ds1.play();
	});
	
	$('.audio_nut7s').click (function() {
		nuta_Fs1.stop();
		nuta_Fs1.play();
	});
	
	$('.audio_nut8s').click (function() {
		nuta_Gs1.stop();
		nuta_Gs1.play();
	});
	
	$('.audio_nut9s').click (function() {
		nuta_As1.stop();
		nuta_As1.play();
	});
	
	$('.audio_nut11s').click (function() {
		nuta_Cs2.stop();
		nuta_Cs2.play();
	});
	
	$('.audio_nut12s').click (function() {
		nuta_Ds2.stop();
		nuta_Ds2.play();
	});
	
	$('.audio_nut14s').click (function() {
		nuta_Fs2.stop();
		nuta_Fs2.play();
	});
	
	$('.audio_nut15s').click (function() {
		nuta_Gs2.stop();
		nuta_Gs2.play();
	});
	
	$('.audio_nut16s').click (function() {
		nuta_As2.stop();
		nuta_As2.play();
	});
	
	$('.audio_nut18s').click (function() {
		nuta_Cs3.stop();
		nuta_Cs3.play();
	});
	
	$('.audio_nut19s').click (function() {
		nuta_Ds3.stop();
		nuta_Ds3.play();
	});
	
	$('.audio_nut21s').click (function() {
		nuta_Fs3.stop();
		nuta_Fs3.play();
	});	
	//-----------------------------------------------------
	
	/*
	function odtworzNute(n, d) {
		n.stop();
		n.play().fadeOut(d);
	}
	*/
	$(window).bind("keyup", function(Event){	
		var klawkey = event.which;
		switch(klawkey) {
				case 81:  //Q
					stan_klawiszy[0]=true;
					break;
				case 50:  //2
					stan_klawiszy[1]=true;
					break;
				case 87:   //W
					stan_klawiszy[2]=true;
					break;
				case 51:   //3
					stan_klawiszy[3]=true;
					break;	
				case 69:   //E
					stan_klawiszy[4]=true;
					break;
				case 82:   //R
					stan_klawiszy[5]=true;
					break;
				case 53:   //5
					stan_klawiszy[6]=true;
					break;	
				case 84:   //T
					stan_klawiszy[7]=true;
					break;
				case 54:   //6
					stan_klawiszy[8]=true;
					break;	
				case 89:   //Y
					stan_klawiszy[9]=true;
					break;
				case 85:   //U
					stan_klawiszy[10]=true;
					break;
				case 56:   //8
					stan_klawiszy[11]=true;
					break;	
				case 73:   //I
					stan_klawiszy[12]=true;
					break;
				case 57:   //9
					stan_klawiszy[13]=true;
					break;	
				case 79:   //O
					stan_klawiszy[14]=true;
					break;
				case 48:   //0
					stan_klawiszy[15]=true;
					break;	
				case 80:   //P
					stan_klawiszy[16]=true;
					break;
				case 219:   //[
					stan_klawiszy[17]=true;
					break;
				case 187:   //=
					stan_klawiszy[18]=true;
					break;	
				case 221:   //]
					stan_klawiszy[19]=true;
					break;
				case 65:   //A
					stan_klawiszy[20]=true;
					break;
				case 90:   //Z
					stan_klawiszy[21]=true;
					break;	
				case 88:   //X
					stan_klawiszy[22]=true;
					break;
				case 68:   //D
					stan_klawiszy[23]=true;
					break;	
				case 67:   //C
					stan_klawiszy[24]=true;
					break;
				case 70:   //F
					stan_klawiszy[25]=true;
					break;
				case 86:   //V
					stan_klawiszy[26]=true;
					break;
				case 71:   //G
					stan_klawiszy[27]=true;
					break;
				case 66:   //B
					stan_klawiszy[28]=true;
					break;
				case 78:   //N
					stan_klawiszy[29]=true;
					break;	
				case 74:   //J
					stan_klawiszy[30]=true;
					break;
				case 77:   //M
					stan_klawiszy[31]=true;
					break;	
				case 75:   //K
					stan_klawiszy[32]=true;
					break;
				case 188:   //,
					stan_klawiszy[33]=true;
					break;	
				case 190:   //.
					stan_klawiszy[34]=true;
					break;
				case 186:   //;
					stan_klawiszy[35]=true;
					break;
				case 191:   ///
					stan_klawiszy[36]=true;
					break;	
		}
    });
	
	$(window).bind("keydown", function(Event){	
		var klawkey = event.which;
		var czy_grac = true;
		var nrd = 0;
		switch(klawkey) {
				case 81:  //Q
					nrd=0;   //G0
					break;
				case 50:  //2
					nrd=1;     //Gis0
					break;
				case 87:   //W
					nrd=2;     //A0
					break;
				case 51:   //3
					nrd=3;     //As0
					break;	
				case 69:   //E
					nrd=4;     //H0
					break;
				case 82:   //R
					nrd=5;     //C1
					break;
				case 53:   //5
					nrd=6;     //Cis1
					break;	
				case 84:   //T
					nrd=7;     //D1
					break;
				case 54:   //6
					nrd=8;     //Dis1
					break;	
				case 89:   //Y
					nrd=9;     //E1
					break;
				case 85:   //U
					nrd=10;     //F1
					break;
				case 56:   //8
					nrd=11;     //Fis1
					break;	
				case 73:   //I
					nrd=12;     //G1
					break;
				case 57:   //9
					nrd=13;     //Gis1
					break;	
				case 79:   //O
					nrd=14;     //A1
					break;
				case 48:   //0
					nrd=15;     //As1
					break;	
				case 80:   //P
					nrd=16;     //H1
					break;
				case 219:   //[
					nrd=17;     //C2
					break;
				case 187:   //=
					nrd=18;     //Cis2
					break;	
				case 221:   //]
					nrd=19;     //D2
					break;
				case 65:   //A
					alert('a');
					nrd=20;     //Dis2
					break;
				case 90:   //Z
					nrd=21;     //E2
					break;	
				case 88:   //X
					nrd=22;     //F2
					break;
				case 68:   //D
					nrd=23;     //Fis2
					break;	
				case 67:   //C
					nrd=24;     //G2
					break;
				case 70:   //F
					nrd=25;     //Gis2
					break;
				case 86:   //V
					nrd=26;     //A2
					break;
				case 71:   //G
					nrd=27;     //As2
					break;
				case 66:   //B
					nrd=28;     //H2
					break;
				case 78:   //N
					nrd=29;     //C3
					break;	
				case 74:   //J
					nrd=30;     //Cis3
					break;
				case 77:   //M
					nrd=31;     //D3
					break;	
				case 75:   //K
					nrd=32;     //Dis3
					break;
				case 188:   //,
					nrd=33;     //E3
					break;	
				case 190:   //.
					nrd=34;     //F3
					break;
				case 186:   //;
					nrd=35;     //Fis3
					break;
				case 191:   ///
					nrd=36;     //G3
					break;
				default:
				   czy_grac=false;
				   break;	
		}
		if (czy_grac) {
			if (stan_klawiszy[nrd]==true) {
				gama1[nrd].stop();
				gama1[nrd].play();
				stan_klawiszy[nrd]=false;
			}
		}
		event.preventDefault();
    });
	
	function odtwarzaj(lp) {
		var ln = lp;
		var czas = 0;
		if (audio_lp<ln) {
			gama1[utwor1[audio_lp]].stop();
			gama1[utwor1[audio_lp]].play();
			czas = parseInt(czas1[audio_lp]*1.3);
			setTimeout(function(){odtwarzaj(ln);}, czas);
			audio_lp++;
		}
	}
	
});
</script>

	