<?php
require_once("config_sql.php");
$kamer_id = $_GET['id'];
$kamer_naam = halen("SELECT naam FROM kamers WHERE id='".$_GET['id']."';");
$kamer_eigenaar = strtolower(halen("SELECT eigenaar FROM kamers WHERE id='".$_GET['id']."';"));
$kamer_soort = halen("SELECT soort FROM kamers WHERE id='".$_GET['id']."';");
$kamer_vloer = halen("SELECT vloer FROM kamers WHERE id='".$_GET['id']."';");
$kamer_muur = halen("SELECT muur FROM kamers WHERE id='".$_GET['id']."';");
$kamer_type = halen("SELECT type FROM kamers WHERE id='".$_GET['id']."';");
$kamer_views = halen("SELECT views FROM kamers WHERE id='".$_GET['id']."';");
$kamer_views++;
mysql_query("UPDATE kamers SET views = '".$kamer_views."' WHERE id='".$_GET['id']."';");
if ($kamer_eigenaar == $_GET['jouwnaam'])
{
	$versie = 2;
}
else
{
	$versie = 1;
}
?>

<div id="backgound" onclick="geklikt('')" style="position:absolute; background-color: black; left:0; top:0; overflow:auto; width:720; height:549;"></div>

<?php
$divgedoe = "";
if ($kamer_eigenaar == $_GET['jouwnaam'])
{
	$csql = "SELECT * FROM `items` WHERE eigenaar='".$_GET['jouwnaam']."' AND forsale='0' AND kamerused='".$kamer_id."' OR kamerused='' AND forsale='0' AND eigenaar='".$_GET['jouwnaam']."'";
	$cres = mysql_query($csql);
	if (mysql_num_rows($cres) >= 1)
	{
	    while ($row = mysql_fetch_array($cres))
	    {
		    $prijslijst = halen_array("SELECT * FROM prijslijst WHERE cat='".$row['cat']."' AND catnr='".$row['catnr']."';");
		    $hoeken = $prijslijst['afb'];
		    $actie = $prijslijst['actie'];
		    $item_naam = $prijslijst['naam'];
		    $item_desc = $prijslijst['omschrijf'];
		    $item_soort = $prijslijst['soort'];
		    $handstatus = "nee";
		    $scriptnaam = $row['nr'];
		    if ($row['actie'] == "ja")
		    {
			    $imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/".$row['h']."b.gif";
		    }
		    else
		    {
			    $imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/".$row['h'].".gif";
		    }
	    	if ($row['kamerused'] == $kamer_id)
	    	{
		    	$handstatus = "nee";
		    	$divgedoe .= "<div id='".$scriptnaam."' style='position: absolute; top: ".$row['y']."px; left: ".$row['x']."px; z-index: ".$row['z']."; display:;'>";
			}
	    	elseif ($row['kamerused'] == 0)
	    	{
		    	$handstatus = "ja";
		    	$imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/icon.gif";
		    	if ($row['z'] < 1)
		    	{
			    	$row['z'] = 2;
		    	}
		    	$divgedoe .= "<div id='".$scriptnaam."' style='position: absolute; top: ".$row['y']."px; left: ".$row['x']."px; z-index: ".$row['z']."; display: none;'>";
	    	}
	    	if ($item_soort == "tele")
		    {
			   	$doel = halen("SELECT kamerused FROM items WHERE tele='".$row['tele']."' AND nr != '".$row['nr']."';");
				if (($doel != $kamer_id) and ($doel != 0) and ($doel != ""))
				{
					$doel_naam = halen("SELECT naam FROM kamers WHERE id = '".$doel."';");
					$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='document.getElementById(\"extraatje\").innerHTML = \"Deze tele gaat naar: ".$doel_naam."\";' onmouseout='document.getElementById(\"extraatje\").innerHTML = \"\";' onmousedown='geklikt(".$scriptnaam.")' class='item_solid' ondblclick='tele(\"$doel\", \"src".$scriptnaam."\", \"".$row['cat']."\", \"".$row['catnr']."\", \"".$row['h']."\");'>";
				}
				else
				{
					$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' class='item_solid'>";
				}
			}
			else
			{
	    		if ($actie == "ja")
	    		{
			    	$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' ondblclick='actieklik(".$row['cat'].", ".$row['catnr'].", ".$row['nr'].");' class='item_solid'>";
	    		}
	    		else
	    		{
		    		if ($item_soort == "geld")
	    			{
		    			$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' ondblclick='geldklik(".$row['cat'].", ".$row['catnr'].", ".$row['nr'].");' class='item_solid'>";
	    			}
	    			elseif ($item_soort == "kado")
	    			{
		    			$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' ondblclick='kado_show(".$scriptnaam.", \"".$row['intext']."\");' class='item_solid'>";
	    			}
	    			else
	    			{
						$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' class='item_solid'>";
					}
				}
			}
			$divgedoe .= "</div>";
		}
	}
	echo "<div id='kamer_meubels'>".$divgedoe."</div>";
}
else
{
	$csql = "SELECT * FROM `items` WHERE kamerused='".$kamer_id."' OR kamerused='' AND forsale='0' AND eigenaar='".$_GET['jouwnaam']."';"; 
	$cres = mysql_query($csql); 
	if (mysql_num_rows($cres) >= 1) 
	{ 
	    while ($row = mysql_fetch_array($cres)) 
	    {
		    $hoeken = halen("SELECT afb FROM prijslijst WHERE cat='".$row['cat']."' AND catnr='".$row['catnr']."';");
			$item_naam = halen("SELECT naam FROM prijslijst WHERE cat='".$row['cat']."' AND catnr='".$row['catnr']."';");
			$item_desc = halen("SELECT omschrijf FROM prijslijst WHERE cat='".$row['cat']."' AND catnr='".$row['catnr']."';");
			$item_soort = halen("SELECT soort FROM prijslijst WHERE cat='".$row['cat']."' AND catnr='".$row['catnr']."';");
			$scriptnaam = $row['nr'];
			if ($row['actie'] == "ja")
		    {
			    $imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/".$row['h']."b.gif";
		    }
		    else
		    {
			    $imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/".$row['h'].".gif";
		    }
			if ($row['kamerused'] == $kamer_id)
	    	{
		    	$handstatus = "nee";
		    	$divgedoe .= "<div id='".$scriptnaam."' style='position: absolute; top: ".$row['y']."px; left: ".$row['x']."px; z-index: ".$row['z']."; display:;'>";
			}
	    	elseif ($row['kamerused'] == 0)
	    	{
		    	$handstatus = "ja";
		    	$imagenaam = "images/items/".$row['cat']."/".$row['catnr']."/icon.gif";
		    	if ($row['z'] < 1)
		    	{
			    	$row['z'] = 2;
		    	}
		    	$divgedoe .= "<div id='".$scriptnaam."' style='position: absolute; top: ".$row['y']."px; left: ".$row['x']."px; z-index: ".$row['z']."; display: none;'>";
	    	}
	    	if ($item_soort == "tele")
		    {
			   	$doel = halen("SELECT kamerused FROM items WHERE tele='".$row['tele']."' AND nr != '".$row['nr']."';");
				if (($doel != $kamer_id) and ($doel != 0) and ($doel != ""))
				{
					$doel_naam = halen("SELECT naam FROM kamers WHERE id = '".$doel."';");
					$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='document.getElementById(\"extraatje\").innerHTML = \"Deze tele gaat naar: ".$doel_naam."\";' onmouseout='document.getElementById(\"extraatje\").innerHTML = \"\";' onmousedown='geklikt(".$scriptnaam.")' class='item_solid' ondblclick='tele(\"$doel\", \"src".$scriptnaam."\", \"".$row['cat']."\", \"".$row['catnr']."\", \"".$row['h']."\");'>";
				}
				else
				{
		    		$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' class='item_solid'>";
				}
			}
			else
			{
				if ($item_soort == "kado")
	    		{
		    		$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' ondblclick='kado_show(".$scriptnaam.", \"".$row['intext']."\");' class='item_solid'>";
	    		}
	    		else
	    		{
		    		$divgedoe .= "<img id='src".$scriptnaam."' src='".$imagenaam."' onmouseover='item_nr_over(".$row['cat'].",".$row['catnr'].")' onmouseout='item_out()' onmousedown='geklikt(".$scriptnaam.")' class='item_solid'>";
	    		}
			}
			$divgedoe .= "</div>";
		}
	}
	echo "<div id='kamer_meubels'>".$divgedoe."</div>";
}
?>
<div id='about' style='position:absolute; left:552; top:367; z-index:3;'>
<img src="kamers/podium.gif"><br>
<div id='aboutnaam' class='clientfont' style='position:absolute; left:8; top:46; z-index:1; width:145px; height:13px;'>
</div>
<div id='omschrijf' class='clientfont' style='position:absolute; left:8; top:63; z-index:1; width:145px; height:26px;'>
</div>
<div id='icon' style='position:absolute; left:94; top:8; z-index:1; width:38px; height:38px;'>
</div>
</div>
<div id='knoppen' style='position:absolute; left:0; top:456; z-index:2; width:712px; height:17px;' align='right'>
</div>

<div id='hand' style='position:absolute; left:453; top:0; z-index:140;'>
<img id='room_hand' src='kamers/hand.gif' style='display:none;'>
</div>

<a onclick="hand_go_back()"><img src='kamers/hand_back.gif' id='hand_back' border="0" onmousedown="hand_back_down()" onmouseup="hand_back_up()" style='position:absolute; left:538; top:2; z-index:141; display: none; cursor: default;' class='knop_trans'></a>
<a onclick="hand_go_next()"><img src='kamers/hand_next.gif' id='hand_next' border="0" onmousedown="hand_next_down()" onmouseup="hand_next_up()" style='position:absolute; left:588; top:2; z-index:141; display: none; cursor: default;' class='knop_trans'></a>
<a onclick="room_set_hand('close')"><img src='kamers/hand_close.gif' id='hand_close' border="0" onmousedown="hand_close_down()" onmouseup="hand_close_up()" style='position:absolute; left:636; top:2; z-index:141; display: none; cursor: default;'></a>

<div id='extraatje' class='roomfont' style='position:absolute; left:10; top:510; z-index:3;'></div>
<div id='kamerinfo' class='roomfont' style='position:absolute; left:16; top:454; z-index:3;' onclick="geklikt('')">
Kamer: <?php echo $kamer_naam; ?><br>Eigenaar: <?php if($kamer_type != "openbaar") { echo $kamer_eigenaar; } ?>
</div>
<div id='kado_kaartje_layer' style='position:absolute; left:130; top:200; z-index:200; width:145px; height:13px; display: none;'>
<div class="handle" onmousedown="dragStart(event, 'kado_kaartje_layer')">
<img src='kamers/kado.gif'>
<img id='kado_strikje' src='kamers/strikje.gif' style='position:absolute; left:38; top:23;'>
<img id='kado_icon' src='images/transp.gif' style='position:absolute; left:49; top:34; display: none;'>
<div class='clientfont' id='k_message' style='position:relative; left:103; top:-80; width:137px; height:56px;'>
</div>
<div id='gift_openknop' style='position:absolute; left:101; top:77; border: 0px; display: none;'>
<a onclick='kado_open()'><img id='gift_open' src='images/knoppen/gift_open.gif' border='0' onmousedown='button_down("gift_open")' onmouseup='button_up("gift_open")' style='cursor: default;'></a>
</div>
<div id='kruisknop' style='position:absolute; left:224; top:77; border: 0px;'>
<a onclick='kado_kaartje_sluit()'><img id='kruis' src='images/knoppen/kruis.gif' border='0' onmousedown='button_down("kruis")' onmouseup='button_up("kruis")' style='cursor: default;'></a>
</div>
</div>
</div>

<div id='schim' style='position: absolute; display: none;'>
<img id='srcschim' src='images/blank.gif' class='item_trans'>
</div>

<div id='tegel_licht' style='position: absolute; z-index:2; display: none;'>
<img src='images/tegel_licht.gif' onclick="geklikt('')">
</div>

<div id='kamer_image_div' style='position:absolute; left:0; top:0; height: 412px; width: 590px; z-index: 1; border: 0px;'>
<img src='kamers/kamer<?php echo $kamer_soort; ?>.gif' onclick="geklikt('')">

<div id='vloer' style='position:absolute; left:0; top:0; height: z-index: 2; border: 0px;'>
<?php
$vloersoort = $kamer_vloer;
$muursoort = $kamer_muur;
require_once("kamers/kamers/".$kamer_soort.".php");
?>
</div>

</div>

<img id='poppetje' src='images/test.gif' onclick="geklikt('')" style='position:absolute; left:0; top:0; z-index: 1; border: 0px;'>

<div style='display:none; position:absolute; left:49; top:6; height: 10px; width: 10px; z-index: 1; background-color: #A5A8B6; border: 0px;'>
</div>

<div id='kamermenu_div' style='position:absolute; left:0; top:491; height: 50px; width: 720px; z-index:2; border: 0px;'>
<table height='50' width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td style="background: url('kamers/kamermenu.gif') repeat-x;" class="clientfont" align="right">
<a onclick="document.getElementById('console').style.zIndex = ((get_top())*1)+1; ReverseContentDisplay('console');"><img id='console_icon2' src="images/icon1.gif" onmouseover='item_over("Console, vrienden en berichten")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
<a onclick="document.getElementById('navigator').style.zIndex = ((get_top())*1)+1; ReverseContentDisplay('navigator');"><img src="images/icon3.gif" onmouseover='item_over("Navigator, navigeer door het hotel")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
<a onclick="document.getElementById('portemonnee').style.zIndex = ((get_top())*1)+1; ReverseContentDisplay('portemonnee');"><img src="images/icon2.gif" onmouseover='item_over("Portemonnee, beheer je Credits")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
<a onclick="document.getElementById('catalogus').style.zIndex = ((get_top())*1)+1; ReverseContentDisplay('catalogus');"><img src="images/icon4.gif" onmouseover='item_over("Catalogus, richt je kamer in")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
<a onclick="room_set_hand('reverse');"><img src="images/icon5.gif" onmouseover='item_over("Hand, je voorraad")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
<a onclick="leave_room();"><img src="images/exit.gif" onmouseover='item_over("Verlaat de kamer")' onmouseout='item_out()' border="0" style="cursor: pointer;" align="middle"></a>
&nbsp;&nbsp;&nbsp;
</td>
</tr>
</table>
</div>