<?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_views = halen("SELECT views FROM kamers WHERE id='".$_GET['id']."';");
$kamer_views++;
echo "kamer_id = ".$kamer_id.";";
echo "kamer_eigenaar = '".$kamer_eigenaar."';";
if ($kamer_eigenaar == $_GET['jouwnaam'])
{
	$versie = 2;
}
else
{
	$versie = 1;
}
?>
dragobject = null;
room_hand_status = "nee";
hand_blz = 1;
hand_back_able = "nee";
hand_next_able = "nee";
vloer_eval = "";
vloer_done = false;
dragx = 0;
dragy = 0;
dragwidth = 0;
dragheight = 0;
posx = 0;
posy = 0;
max_x = 0;
max_y = 0;
handstatus = "ja";
instelbeurt = 0;
poppetjes_bezet_teller = 0;
poppetjes_bezet = "";
poppetjes_bezet = new Array();
zet_neer_status = "nee";
open_script("kamers/kamers/<?php echo $kamer_soort; ?>.js");
<?php
$savegedoe = "savegedoe = new Array();";
$arraygedoe = "thismeubi = new Array();";
$arrayteller = 0;
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))
	    {
		    $arraygedoe .= " thismeubi[".$arrayteller."] = ".$row['nr'].";";
		    $arrayteller++;
		    $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";
		    if ($row['kamerused'] == $kamer_id)
	    	{
		    	$handstatus = "nee";
			}
	    	elseif ($row['kamerused'] == 0)
	    	{
		    	$handstatus = "ja";
		    	if ($row['z'] < 1)
		    	{
			    	$row['z'] = 2;
		    	}
	    	}
			$savegedoe .= "savegedoe[".$row['nr']."] = new Array(); ";
			$savegedoe .= "savegedoe[".$row['nr']."]['tegel'] = '".$row['tegel']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['handstatus'] = '".$handstatus."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['cat'] = '".$row['cat']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['catnr'] = '".$row['catnr']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['x'] = '".$row['x']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['y'] = '".$row['y']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['z'] = '".$row['z']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['h'] = '".$row['h']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['actie'] = '".$row['actie']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['stapelnr'] = ".$row['stapelnr']."; ";
		}
	}
	echo $arraygedoe.$savegedoe;
}
else
{
	$csql = "SELECT * FROM `items` WHERE kamerused='".$kamer_id."' OR kamerused='' AND forsale='0' AND eigenaar='".$_GET['jouwnaam']."' 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)) 
	    {
		    $arraygedoe .= " thismeubi[".$arrayteller."] = ".$row['nr'].";";
		    $arrayteller++;
		    $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";
		    if ($row['kamerused'] == $kamer_id)
	    	{
		    	$handstatus = "nee";
			}
	    	elseif ($row['kamerused'] == 0)
	    	{
		    	$handstatus = "ja";
		    	if ($row['z'] < 1)
		    	{
			    	$row['z'] = 2;
		    	}
	    	}
			$savegedoe .= "savegedoe[".$row['nr']."] = new Array(); ";
			$savegedoe .= "savegedoe[".$row['nr']."]['tegel'] = '".$row['tegel']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['handstatus'] = '".$handstatus."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['cat'] = '".$row['cat']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['catnr'] = '".$row['catnr']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['x'] = '".$row['x']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['y'] = '".$row['y']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['z'] = '".$row['z']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['h'] = '".$row['h']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['actie'] = '".$row['actie']."'; ";
			$savegedoe .= "savegedoe[".$row['nr']."]['stapelnr'] = ".$row['stapelnr']."; ";
		}
	}
	echo $arraygedoe.$savegedoe;
}
echo "thismeubi_teller = ".$arrayteller.";";
?>
save_poppetje = new Array();
save_poppetje['tegel'] = "0_0"
get_room(ga_kamer_id);