<?php
	error_reporting(E_ALL);
	ini_set('display_errors', TRUE);
	ini_set('display_startup_errors', TRUE);	
	$theme = "default";
	include "themes/$theme/main.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<title>mmFire</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<meta name="generator" content="Geany 1.36" />
</head>

<style>

<?php 
	include_css();
	//include "$theme.css"; 
?>

</style>

<script>	
	function openFrame(SEL) {
		document.getElementById("DIVCLIENT").style.display = 'none';		
		document.getElementById("CLIENT").style.display = 'block';
		//document.getElementById("MAINFRAME").style.display = 'block';				
		document.getElementById("teste").innerHTML = "URL: "+SEL;
		document.getElementById('MAINFRAME').src = SEL;				
	}
	function openViewer(viewer) 
	{	
		var URL = viewer;
		document.getElementById("CLIENT").style.display = 'none';
		//document.getElementById("MAINFRAME").style.display = 'none';		
		document.getElementById("DIVCLIENT").style.display = 'block';	
		document.getElementById("teste").innerHTML = "Viewer: "+viewer;
		document.getElementById("DIVCLIENT").innerHTML = "<br><br><br><center>Loading informations: !!!!!<br>Please wait</center>";
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.onreadystatechange = function() {
			if (this.readyState == 1) {	
				document.getElementById("DIVCLIENT").innerHTML = "<br><br><br><center>OPENED</center>";
			}					
			if (this.readyState == 2) {	
				document.getElementById("DIVCLIENT").innerHTML = "<br><br><br><center>HEADERS_RECEIVED<br><br>"+URL+"</center>";
			}		
			if (this.readyState == 3) {	
				document.getElementById("DIVCLIENT").innerHTML = "<br><br><br><center>Carregando informoçoes<br>"+URL+"<br>Por favor agarde!!<br></center>";
			}						
			if (this.readyState == 4 && this.status == 200) {	
				document.getElementById("DIVCLIENT").innerHTML = this.responseText;
			}
		};
		xmlhttp.open("GET",URL,true);
		xmlhttp.send();		
	}	
	<?php include "sys/lib.js"; ?>
</script>


<?php
	//$url = "";
	//if(isset($_GET["u"])) {
		//$url=$_GET["u"];
	//}		
	//if($url=="") $url="error.php";	
?>


<body ID="HTMLBODY">
	
	<div class="BACKGROUND">
		
		<div id="DIVCLIENT"></div>
		
		
		<div class="LOGO">

			<div class="LEFTBAR">
			<img src="sys/mmfired.png">
			</div>					

			<div class="RIGHTBAR">
				<ul>
					<li onclick="openViewer('error.php')"><div>Home</div></li>
					<li onclick="openViewer('videos.php')"><div>Vídeos</div></li>			
					<li onclick="openViewer('music.php')"><div>Musicas</div></li>	
					<li onclick="openViewer('teste.php')"><div>TesteView</div></li>														
					<li onclick="openFrame('http://localhost:9091/')"><div>Torrent</div></li>
					<li onclick="openViewer('about.php')"><div>Sobre</div></li>					
				</ul>	
			</div>

		</div>

		<div id="CLIENT">
			<iframe id="MAINFRAME" src="" class="FRAME" title=""></iframe>
		</div>
		
		<div id="teste" style="position:fixed;top:0;right:0;color:white">Teste: </div>	
					
		<?php //echo $url?>
		<div id="FRAMEAREA">
			<iframe id="WAFRAME" src="" class="FRAME" title=""></iframe>
			<div class="CloseButton" onclick="hideFrame()">
				<img width="100%" height="100%" src="sys/c3.png">
			</div>			
		</div>

		<div id="VIEWER-AREA">
			<div id="VIEWER-CLIENT" style="border: 3px solid black;" ></div>
			
			<div class="FButton" style="right:8%;top:5%;" onclick="hideViewer()">
				<img width="100%" height="100%" src="sys/c3.png">
			</div>			

		</div>		
		
	</div>
	
<script>
	openViewer('error.php');
</script>	
	
	
</body>

</html>
