<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/font-awesome.min.css" />
		<link rel="stylesheet" href="css/animate.min.css" />
		<link rel="stylesheet" href="css/styles.css" />
		<link rel="stylesheet" href="css/jquery-ui.min.css" />
		<!--[if lt IE 9]>
			<script src="/js/html5shiv.js" type="text/javascript"></script>
			<script src="/js/respond.min.js" type="text/javascript"></script>
		<![endif]-->
		<!--script sourcing -->
              <script src="js/jquery.min.js"></script>
              <script src="js/bootstrap.min.js"></script>
              <script src="js/scripts.js"></script>
              <script src="js/jquery-ui.min.js"></script>
              <script src="js/jquery.ui.touch-punch.min.js"></script>
		<title>Panasonic BTT196 Remote</title>
		<meta name="description" content="Remote Control..." />
	</head>
	<body>
		<?php
			// Settings
			$sndHost = "192.168.101.226";
			// Shortened variables
			$cmdCurl = "curl -s -A MEI-LAN-REMOTE-CALL ";
			// Get array of sound settings and explode into variables for display.
			exec("$cmdCurl -d cCMD_GET_SOUND.x=100 -d cCMD_GET_SOUND.y=100 http://$sndHost/WAN/dvdr/dvdr_ctrl.cgi",$cursndres);
			list($curVol,$curSrc,$curEfx,$curSfx,$curStv,$curEq,$curSub,$curHba,$curWhi,$curCfo) = explode(",", $cursndres[1]);
		?>
		<h3>Sound Settings</h3>
		<div class="container">
			<div class="row">
				<label for="newVol">Volume:</label>
				<input type="text" id="newVol" readonly style="border:0; font-weight:bold;" value="<?php echo $curVol;?>">
				<label for="swVol" class="control-label input-group">Master Volume</label>
				<div id="slideVol"></div>
			</div>
		</div>
		<div class="container">
			<div class="row">
				<label for="swSrc" class="control-label input-group">Source</label>
				<div class="btn-group" data-toggle="buttons" id="swSrc">
					<label class="btn btn-default<?php if ($curSrc==0):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="DISC" value="0"<?php if ($curSrc==0):echo " checked=\"\"";endif;?>>DISC
					</label>
					<label class="btn btn-default<?php if ($curSrc==1):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="SD" value="1"<?php if ($curSrc==1):echo " checked=\"\"";endif;?>>SD
					</label>
					<label class="btn btn-default<?php if ($curSrc==2):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="USB" value="2"<?php if ($curSrc==2):echo " checked=\"\"";endif;?>>USB
					</label>
					<label class="btn btn-default<?php if ($curSrc==3):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="iPod" value="3"<?php if ($curSrc==3):echo " checked=\"\"";endif;?>>iPod
					</label>
					<label class="btn btn-default<?php if ($curSrc==4):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="Radio" value="4"<?php if ($curSrc==4):echo " checked=\"\"";endif;?>>Radio
					</label>
					<label class="btn btn-default<?php if ($curSrc==5):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="AUX" value="5"<?php if ($curSrc==5):echo " checked=\"\"";endif;?>>AUX
					</label>
					<label class="btn btn-default<?php if ($curSrc==6):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="ARC" value="6"<?php if ($curSrc==6):echo " checked=\"\"";endif;?>>ARC
					</label>
					<label class="btn btn-default<?php if ($curSrc==7):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="D-IN" value="7"<?php if ($curSrc==7):echo " checked=\"\"";endif;?>>D-IN
					</label>
					<label class="btn btn-default<?php if ($curSrc==8):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="HDMI-1" value="8"<?php if ($curSrc==8):echo " checked=\"\"";endif;?>>HDMI-1
					</label>
					<label class="btn btn-default<?php if ($curSrc==9):echo " active";endif;?>">
						<input type="radio" name="swSrc" id="HDMI-2" value="9"<?php if ($curSrc==9):echo " checked=\"\"";endif;?>>HDMI-2
					</label>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="row">
				<label for="swEq" class="control-label input-group">EQ</label>
				<div class="btn-group" data-toggle="buttons" id="swEq">
                    <label class="btn btn-default<?php if ($curEq==0):echo " active";endif;?>">
                        <input type="radio" name="swEq" id="Flat" value="0"<?php if ($curEq==0):echo " checked=\"\"";endif;?>>Flat
					</label>
                    <label class="btn btn-default<?php if ($curEq==1):echo " active";endif;?>">
                        <input type="radio" name="swEq" id="Heavy" value="1"<?php if ($curEq==1):echo " checked=\"\"";endif;?>>Heavy
					</label>
                    <label class="btn btn-default<?php if ($curEq==2):echo " active";endif;?>">
                        <input type="radio" name="swEq" id="Soft" value="2"<?php if ($curEq==2):echo " checked=\"\"";endif;?>>Soft
					</label>
                    <label class="btn btn-default<?php if ($curEq==3):echo " active";endif;?>">
                        <input type="radio" name="swEq" id="Clear" value="3"<?php if ($curEq==3):echo " checked=\"\"";endif;?>>Clear
					</label>
				</div>
			</div>
		</div>
        <div class="container">
            <div class="row">
                <label for="swHba" class="control-label input-group">H.Bass</label>
                <div class="btn-group" data-toggle="buttons" id="swHba">
                    <label class="btn btn-default<?php if ($curHba==0):echo " active";endif;?>">
                        <input type="radio" name="swHba" id="Off" value="0"<?php if ($curHba==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curHba==1):echo " active";endif;?>">
                        <input type="radio" name="swHba" id="On" value="1"<?php if ($curHba==1):echo " checked=\"\"";endif;?>>On
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swWhi" class="control-label input-group">Whisper Surround</label>
                <div class="btn-group" data-toggle="buttons" id="swWhi">
                    <label class="btn btn-default<?php if ($curWhi==0):echo " active";endif;?>">
                        <input type="radio" name="swWhi" id="Off" value="0"<?php if ($curWhi==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curWhi==1):echo " active";endif;?>">
                        <input type="radio" name="swWhi" id="On" value="1"<?php if ($curWhi==1):echo " checked=\"\"";endif;?>>On
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swCfo" class="control-label input-group">Center Focus</label>
                <div class="btn-group" data-toggle="buttons" id="swCfo">
                    <label class="btn btn-default<?php if ($curCfo==0):echo " active";endif;?>">
                        <input type="radio" name="swCfo" id="Off" value="0"<?php if ($curCfo==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curCfo==1):echo " active";endif;?>">
                        <input type="radio" name="swCfo" id="On" value="1"<?php if ($curCfo==1):echo " checked=\"\"";endif;?>>On
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swEfx" class="control-label input-group">Effects</label>
                <div class="btn-group" data-toggle="buttons" id="swEfx">
                    <label class="btn btn-default<?php if ($curEfx==0):echo " active";endif;?>">
                        <input type="radio" name="swEfx" id="Off" value="0"<?php if ($curEfx==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curEfx==1):echo " active";endif;?>">
                        <input type="radio" name="swEfx" id="Cinema Surround" value="1"<?php if ($curEfx==1):echo " checked=\"\"";endif;?>>Cinema Surround
                    </label>
                    <label class="btn btn-default<?php if ($curEfx==2):echo " active";endif;?>">
                        <input type="radio" name="swEfx" id="Virtual Surround" value="2"<?php if ($curEfx==2):echo " checked=\"\"";endif;?>>Virtual Surround
                    </label>
                    <label class="btn btn-default<?php if ($curEfx==3):echo " active";endif;?>">
                        <input type="radio" name="swEfx" id="Stereo" value="3"<?php if ($curEfx==3):echo " checked=\"\"";endif;?>>Stereo
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swSub" class="control-label input-group">Sub Level</label>
                <div class="btn-group" data-toggle="buttons" id="swSub">
                    <label class="btn btn-default<?php if ($curSub==0):echo " active";endif;?>">
                        <input type="radio" name="swSub" id="Off" value="0"<?php if ($curSub==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curSub==1):echo " active";endif;?>">
                        <input type="radio" name="swSub" id="Low" value="1"<?php if ($curSub==1):echo " checked=\"\"";endif;?>>Low
                    </label>
                    <label class="btn btn-default<?php if ($curSub==2):echo " active";endif;?>">
                        <input type="radio" name="swSub" id="<Medium" value="2"<?php if ($curSub==2):echo " checked=\"\"";endif;?>>Medium
                    </label>
                    <label class="btn btn-default<?php if ($curSub==3):echo " active";endif;?>">
                        <input type="radio" name="swSub" id="High" value="3"<?php if ($curSub==3):echo " checked=\"\"";endif;?>>High
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swSfx" class="control-label input-group">Surround Effect</label>
                <div class="btn-group" data-toggle="buttons" id="swSfx">
                    <label class="btn btn-default<?php if ($curSfx==0):echo " active";endif;?>">
                        <input type="radio" name="swSfx" id="Off" value="0"<?php if ($curSfx==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curSfx==1):echo " active";endif;?>">
                        <input type="radio" name="swSfx" id="Multi Channel" value="1"<?php if ($curSfx==1):echo " checked=\"\"";endif;?>>Multi Channel
                    </label>
                    <label class="btn btn-default<?php if ($curSfx==2):echo " active";endif;?>">
                        <input type="radio" name="swSfx" id="SuperSurround" value="2"<?php if ($curSfx==2):echo " checked=\"\"";endif;?>>SuperSurround
                    </label>
                    <label class="btn btn-default<?php if ($curSfx==3):echo " active";endif;?>">
                        <input type="radio" name="swSfx" id="Dolby Pro II Movie" value="3"<?php if ($curSfx==3):echo " checked=\"\"";endif;?>>Dolby Pro II Movie
                    </label>
                    <label class="btn btn-default<?php if ($curSfx==4):echo " active";endif;?>">
                        <input type="radio" name="swSfx" id="Dolby Pro II Music" value="4"<?php if ($curSfx==4):echo " checked=\"\"";endif;?>>Dolby Pro II Music
                    </label>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <label for="swStv" class="control-label input-group">Tube/Master Effect</label>
                <div class="btn-group" data-toggle="buttons" id="swStv">
                    <label class="btn btn-default<?php if ($curStv==0):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Off" value="0"<?php if ($curStv==0):echo " checked=\"\"";endif;?>>Off
                    </label>
                    <label class="btn btn-default<?php if ($curStv==1):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Crisp" value="1"<?php if ($curStv==1):echo " checked=\"\"";endif;?>>Crisp
                    </label>
                    <label class="btn btn-default<?php if ($curStv==2):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="HiFi" value="2"<?php if ($curStv==2):echo " checked=\"\"";endif;?>>HiFi
                    </label>
                    <label class="btn btn-default<?php if ($curStv==3):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Rich" value="3"<?php if ($curStv==3):echo " checked=\"\"";endif;?>>Rich
                    </label>
                    <label class="btn btn-default<?php if ($curStv==4):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Clear" value="4"<?php if ($curStv==4):echo " checked=\"\"";endif;?>>Clear
                    </label>
                    <label class="btn btn-default<?php if ($curStv==5):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Mid" value="5"<?php if ($curStv==5):echo " checked=\"\"";endif;?>>Mid
                    </label>
                    <label class="btn btn-default<?php if ($curStv==6):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Soft" value="6"<?php if ($curStv==6):echo " checked=\"\"";endif;?>>Soft
                    </label>
                    <label class="btn btn-default<?php if ($curStv==7):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Pop" value="7"<?php if ($curStv==7):echo " checked=\"\"";endif;?>>Pop
                    </label>
                    <label class="btn btn-default<?php if ($curStv==8):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Jazz" value="8"<?php if ($curStv==8):echo " checked=\"\"";endif;?>>Jazz
                    </label>
                    <label class="btn btn-default<?php if ($curStv==9):echo " active";endif;?>">
                        <input type="radio" name="swStv" id="Classical" value="9"<?php if ($curStv==9):echo " checked=\"\"";endif;?>>Classical
                    </label>
                </div>
            </div>
        </div>

		<!--script sourcing -->
		<script>
			$( "#slideVol" ).slider({
				range: "false",
				min: 1,
				max: 100,
				value: <?php echo $curVol;?>,
				animate: true,
				change: function( event, ui ) {
					var newVol = ui.value;
					$( "#newVol" ).val( ui.value );
					$.ajax({
						url: "setVol.php",
						type: "post",
						data: "newVol="+newVol
					});
				}
			});
		</script>
		<script>
			$(document).on('change', 'input[name="swWhi"]:radio', function(){
				var newWhi = $(this).val();
				$.ajax({
					url: "setSnd.php",
					type: "post",
					data: {newWhi: newWhi}
				});
			});
		</script>
		<script>
			$(document).on('change', 'input[name="swSrc"]:radio', function(){
				var newSrc = $(this).val();
				$.ajax({
					url: "setSrc.php",
					type: "post",
					data: {newSrc: newSrc}
				});
			});
		</script>
	<!-- footer -->
	</body>
</html>
