function checkEnter(e, soort)
{
	var characterCode;
	if(e && e.which)
	{
		e = e;
		characterCode = e.which;
	}
	else
	{
		e = event;
		characterCode = e.keyCode;
	}
	if(characterCode == 13)
	{
		if (soort == "navi")
		{
			update_zoek();
			document.getElementById('gezocht').focus();
			return false;
		}
		if (soort == "console")
		{
			console_zoek_jabbo();
			document.getElementById('console_zoeknaam').focus();
			return false;
		}
	}
	return true;
}
function get_top()
{
	z_top++;
	z_top++;
	return(z_top);
}
function change_top(new_z)
{
	if (new_z > z_top)
	{
		z_top = new_z;
	}
}
function get_top_real()
{
	if (document.all)
	{
		topZ = 0;
		for (i = 0; i < document.all.length; i++)
		{
			dit_element = document.all(i);
			topZ = Math.max(dit_element.style.zIndex, topZ);
		}
	}
	else
	{
		alles = new Array();
  		alles = document.getElementsByTagName('*');
  		topZ = 0;
  		for (i = 0; i < alles.length; i++)
  		{
	  		dezeZ = alles[i].style.zIndex;
	  		if (dezeZ == '')
	  		{
		  		dezeZ = 0;
	  		}
     		if (parseInt(dezeZ) > parseInt(topZ))
     		{
	     		topZ = dezeZ;
     		}
		}
	}
	return(topZ);
}
function button_down(button_name)
{
	document.getElementById(button_name).src = "images/knoppen/"+button_name+"2.gif";
}
function button_up(button_name)
{
	document.getElementById(button_name).src = "images/knoppen/"+button_name+".gif";
}
function gaklik(naam, omschrijving, type, safe, van, id, favo, pass)
{
	if (van == jouwnaam)
	{
		show_room(id);
	}
	else
	{
		if (safe == 1)
		{
			show_room(id);
		}
		if (safe == 2)
		{
			if (sessie_functie == "manager" || sessie_functie == "staff")
			{
				show_room(id);
			}
			else
			{
				start_alert("Deze kamer is op slot!");
			}
		}
		if (safe == 3)
		{
			if (sessie_functie == "manager" || sessie_functie == "staff")
			{
				show_room(id);
			}
			else
			{
				document.getElementById("navi_del_text").innerHTML = "<img src='images/navi/icons/6.gif'><br><br><b>"+naam+"</b><br><br>De kamer is afgesloten met een wachtwoord.<br><br><input type='password' size='15' maxlength='15' name='navi_room_pass' id='navi_room_pass' class='clientfont'><br><br><a onclick='stop_enterpass()'><img id='pass_room_cancel' src='images/knoppen/pass_room_cancel.gif' border='0' onmousedown='button_down(\"pass_room_cancel\")' onmouseup='button_up(\"pass_room_cancel\")' style='cursor: default;' align='middle'></a>&nbsp;&nbsp;&nbsp;<a onclick='enterpass("+id+", \""+pass+"\")'><img id='pass_room_ok' src='images/knoppen/pass_room_ok.gif' border='0' onmousedown='button_down(\"pass_room_ok\")' onmouseup='button_up(\"pass_room_ok\")' style='cursor: default;' align='middle'></a>";
				document.getElementById("navi_blanc_layer").style.visibility = 'visible';
				document.getElementById("navi_del_text_div").style.visibility = 'visible';
			}
		}
	}
}
function enterpass(id, pass)
{
	pass_form = document.getElementById("navi_room_pass").value;
	pass_good = pass;
	if (pass_form != "")
	{
		if (pass_form == pass_good)
		{
			show_room(id);
		}
		else
		{
			start_alert("Onjuist, probeer het nog eens.");
			document.getElementById("navi_room_pass").value = "";
		}
	}
}
function stop_enterpass()
{
	pass_form = "";
	pass_good = "";
	document.getElementById("navi_room_pass").value = "";
	document.getElementById("navi_del_text").innerHTML = "";
	document.getElementById("navi_blanc_layer").style.visibility = 'hidden';
	document.getElementById("navi_del_text_div").style.visibility = 'hidden';
}
function maakklik()
{
	topnu = get_top();
	topnu++;
	zback = topnu;
	zmatic = topnu + 1;
	document.getElementById('matic_back').style.zIndex = zback; change_top(zback);
	document.getElementById('matic').style.zIndex = zmatic; change_top(zmatic);
	ShowContent('matic_back');
	ShowContent('matic');
	document.getElementById("matic_1").style.visibility = 'visible';
	document.getElementById("matic_2").style.visibility = 'hidden';
	document.getElementById("matic_2_text").innerHTML = "";
	document.getElementById("matic_3").style.visibility = 'hidden';
	document.getElementById("matic_4").style.visibility = 'hidden';
	document.getElementById("matic_4_text").innerHTML = "";
	document.getElementById("matic_5").style.visibility = 'hidden';
	document.getElementById("matic_6").style.visibility = 'hidden';
	document.getElementById("matic_7").style.visibility = 'hidden';
	document.getElementById("matic_lijn_2").style.visibility = 'hidden';
	document.getElementById("matic_lijn_3").style.visibility = 'hidden';
	document.getElementById("matic_knop_1").style.visibility = 'visible';
	document.getElementById("matic_knop_2").style.visibility = 'visible';
	document.getElementById("matic_knop_3").style.visibility = 'hidden';
	document.getElementById("matic_knop_4").style.visibility = 'hidden';
	document.getElementById("matic_knop_5").style.visibility = 'hidden';
	document.getElementById("matic_knop_6").style.visibility = 'hidden';
	document.getElementById("matic_knop_7").style.visibility = 'hidden';
	document.getElementById("matic_knop_8").style.visibility = 'hidden';
	document.getElementById("matic_name").value = '';
	document.getElementById("matic_desc").value = '';
	document.getElementById("matic_type").value = 1;
	document.getElementById("matic_5_text").innerHTML = "Kamergrootte: 104 tegels";
	document.getElementById("matic_type_image").src = "images/room_maker/roomtype/1.gif";
	document.getElementById("matic_safety_1").checked = true;
	document.getElementById("matic_pass1").value = "";
	document.getElementById("matic_pass2").value = "";
}
function matic_close()
{
	HideContent('matic_back');
	HideContent('matic');
}
function matic_button_2()
{
	document.getElementById("matic_1").style.visibility = 'hidden';
	document.getElementById("matic_2").style.visibility = 'visible';
	document.getElementById("matic_2_text").innerHTML = "<b>Ontwerp je eigen kamer</b><br>Je kunt deze instellingen later aanpassen";
	document.getElementById("matic_3").style.visibility = 'visible';
	document.getElementById("matic_4").style.visibility = 'visible';
	document.getElementById("matic_4_text").innerHTML = "1/3";
	document.getElementById("matic_lijn_2").style.visibility = 'visible';
	document.getElementById("matic_lijn_3").style.visibility = 'visible';
	document.getElementById("matic_knop_1").style.visibility = 'hidden';
	document.getElementById("matic_knop_2").style.visibility = 'hidden';
	document.getElementById("matic_knop_3").style.visibility = 'visible';
	document.getElementById("matic_knop_4").style.visibility = 'visible';
}
function matic_button_3()
{
	if (document.getElementById("matic_name").value == "")
	{
		start_alert("Geef je kamer een naam!");
	}
	else
	{
		document.getElementById("matic_2_text").innerHTML = "Kies het plattegrond van je kamer";
		document.getElementById("matic_4_text").innerHTML = "2/3";
		document.getElementById("matic_3").style.visibility = 'hidden';
		document.getElementById("matic_5").style.visibility = 'visible';
		document.getElementById("matic_knop_3").style.visibility = 'hidden';
		document.getElementById("matic_knop_4").style.visibility = 'hidden';
		document.getElementById("matic_knop_5").style.visibility = 'visible';
		document.getElementById("matic_knop_6").style.visibility = 'visible';
	}
}
function matic_button_4()
{
	document.getElementById("matic_2_text").innerHTML = "<b>Ontwerp je eigen kamer</b><br>Je kunt deze instellingen later aanpassen";
	document.getElementById("matic_4_text").innerHTML = "1/3";
	document.getElementById("matic_3").style.visibility = 'visible';
	document.getElementById("matic_5").style.visibility = 'hidden';
	document.getElementById("matic_knop_3").style.visibility = 'visible';
	document.getElementById("matic_knop_4").style.visibility = 'visible';
	document.getElementById("matic_knop_5").style.visibility = 'hidden';
	document.getElementById("matic_knop_6").style.visibility = 'hidden';
}
function matic_button_5()
{
	document.getElementById("matic_2_text").innerHTML = "Beveiliging";
	document.getElementById("matic_4_text").innerHTML = "3/3";
	document.getElementById("matic_5").style.visibility = 'hidden';
	document.getElementById("matic_6").style.visibility = 'visible';
	document.getElementById("matic_knop_5").style.visibility = 'hidden';
	document.getElementById("matic_knop_6").style.visibility = 'hidden';
	document.getElementById("matic_knop_7").style.visibility = 'visible';
	document.getElementById("matic_knop_8").style.visibility = 'visible';
}
function matic_button_6()
{
	document.getElementById("matic_2_text").innerHTML = "Kies het plattegrond van je kamer";
	document.getElementById("matic_4_text").innerHTML = "2/3";
	document.getElementById("matic_5").style.visibility = 'visible';
	document.getElementById("matic_6").style.visibility = 'hidden';
	document.getElementById("matic_7").style.visibility = 'hidden';
	document.getElementById("matic_knop_5").style.visibility = 'visible';
	document.getElementById("matic_knop_6").style.visibility = 'visible';
	document.getElementById("matic_knop_7").style.visibility = 'hidden';
	document.getElementById("matic_knop_8").style.visibility = 'hidden';
}
function matic_button_7()
{
	matic_check1 = document.getElementById("matic_safety_1").checked;
	matic_check2 = document.getElementById("matic_safety_2").checked;
	matic_check3 = document.getElementById("matic_safety_3").checked;
	if (matic_check1)
	{
		new_safe = 1;
	}
	if (matic_check2)
	{
		new_safe = 2;
	}
	if (matic_check3)
	{
		new_safe = 3;
	}
	if (new_safe == 3)
	{
		matic_pass_check();
	}
	else
	{
		matic_send();
	}
}
function matic_pass_check()
{
	pass1 = document.getElementById("matic_pass1").value;
	pass2 = document.getElementById("matic_pass2").value;
	if ((pass1 != "") && (pass2 != ""))
	{
		if ((pass1.length > 3) && (pass2.length > 3))
		{
			if (pass1 == pass2)
			{
				if (pass1.length <= 15)
				{
					document.getElementById("matic_7").style.visibility = 'hidden';
					matic_send();
				}
				else
				{
					document.getElementById("matic_6").style.visibility = 'hidden';
					document.getElementById("matic_7").style.visibility = 'visible';
					start_alert("Kamerwachtwoord mag maar 15 tekens lang zijn");
				}
			}
			else
			{
				document.getElementById("matic_6").style.visibility = 'hidden';
				document.getElementById("matic_7").style.visibility = 'visible';
				start_alert("Controleer je wachtwoord");
			}
		}
		else
		{
			document.getElementById("matic_6").style.visibility = 'hidden';
			document.getElementById("matic_7").style.visibility = 'visible';
			start_alert("Kamerwachtwoord is te kort");
		}
	}
	else
	{
		if (document.getElementById("matic_7").style.visibility == 'visible')
		{
			document.getElementById("matic_6").style.visibility = 'hidden';
			document.getElementById("matic_7").style.visibility = 'visible';
			start_alert("Niet alles is ingevuld");
		}
		else
		{
			document.getElementById("matic_pass1").value = "";
			document.getElementById("matic_pass2").value = "";
			document.getElementById("matic_6").style.visibility = 'hidden';
			document.getElementById("matic_7").style.visibility = 'visible';
		}
	}
}
function matic_send()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij == "ja")
		{
			new_name = document.getElementById("matic_name").value;
			new_desc = document.getElementById("matic_desc").value;
			new_type = parseInt(document.getElementById("matic_type").value);
			matic_check1 = document.getElementById("matic_safety_1").checked;
			matic_check2 = document.getElementById("matic_safety_2").checked;
			matic_check3 = document.getElementById("matic_safety_3").checked;
			new_pass = "";
			if (matic_check1)
			{
				new_safe = 1;
			}
			if (matic_check2)
			{
				new_safe = 2;
			}
			if (matic_check3)
			{
				new_safe = 3;
			}
			if (new_safe == 3)
			{
				new_pass = document.getElementById("matic_pass1").value;
			}
			ajax_vrij = "nee";
			xmlhttp.open("GET", "matic.php?eigenaar="+jouwnaam+"&naam="+new_name+"&schrijf="+new_desc+"&soort="+new_type+"&safe="+new_safe+"&pass="+new_pass+"&random="+Math.round(9000*Math.random()),true);
		    xmlhttp.onreadystatechange=function()
		    {
			    if (xmlhttp.readyState==4)
		        {
			        if(xmlhttp.status == 200)
		 			{
			 			matic_close();
			        	document.getElementById('list_eigen').innerHTML = xmlhttp.responseText;
			        	start_alert("De kamer is gemaakt.");
		        	}
		        	else if(xmlhttp.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij = "ja";
		        }
		    }
		    xmlhttp.send(null);
	    }
	    else
    	{
	    	setTimeout("matic_send();", 1000);
    	}
    }
}
function matic_pijl_1()
{
	type_nu = document.getElementById("matic_type").value;
	if (parseInt(type_nu) == 1)
	{
		type_ok = 8;
	}
	else
	{
		type_ok = parseInt(type_nu) - 1;
	}
	document.getElementById("matic_type").value = parseInt(type_ok);
	document.getElementById("matic_5_text").innerHTML = "Kamergrootte: "+tegelaantal_db(parseInt(type_ok))+" tegels";
	document.getElementById("matic_type_image").src = "images/room_maker/roomtype/"+parseInt(type_ok)+".gif";
}
function matic_pijl_2()
{
	type_nu = document.getElementById("matic_type").value;
	if (parseInt(type_nu) == 8)
	{
		type_ok = 1;
	}
	else
	{
		type_ok = parseInt(type_nu) + 1;
	}
	document.getElementById("matic_type").value = parseInt(type_ok);
	document.getElementById("matic_5_text").innerHTML = "Kamergrootte: "+tegelaantal_db(parseInt(type_ok))+" tegels";
	document.getElementById("matic_type_image").src = "images/room_maker/roomtype/"+parseInt(type_ok)+".gif";
}
function tegelaantal_db(nr)
{
	if (nr == 1)
	{
		return 104;
	}
	if (nr == 2)
	{
		return 94;
	}
	if (nr == 3)
	{
		return 36;
	}
	if (nr == 4)
	{
		return 84;
	}
	if (nr == 5)
	{
		return 80;
	}
	if (nr == 6)
	{
		return 80;
	}
	if (nr == 7)
	{
		return 80;
	}
	if (nr == 8)
	{
		return 74;
	}
}
function start_alert(message)
{
	document.getElementById("alert_message").innerHTML = "&nbsp;&nbsp;"+message+"&nbsp;&nbsp;";
	start_verstijf();
	document.getElementById("alert").style.zIndex = parseInt(get_top()) + 1; change_top(document.getElementById("alert").style.zIndex);
	ShowContent('alert');
}
function stop_alert()
{
	document.getElementById("alert_message").innerHTML = "";
	stop_verstijf();
	document.getElementById("alert").style.zIndex = 0;
	HideContent('alert');
}
function start_verstijf()
{
	document.getElementById("verstijf").style.zIndex = parseInt(get_top()) + 1; change_top(document.getElementById("verstijf").style.zIndex);
	ShowContent('verstijf');
}
function stop_verstijf()
{
	document.getElementById("verstijf").style.zIndex = 0;
	HideContent('verstijf');
}
function console_zoek()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_zoek.php?zoek="+console_gezocht+"&jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			behandel_console_zoek(xmlhttp3.responseText);
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_zoek();", 1000);
    	}
	}
}
function console_send_vv()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_vv.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&vriend="+console_gezocht+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('console_text_5_text').innerHTML = console_gezocht+"<br>heeft je verzoek<br>ontvangen.<br><br>Hij/zij zal aan jouw<br>vriendenlijst worden<br>toegevoegd als je<br>verzoek wordt<br>geaccepteerd.";
			 			clear_console();
						document.getElementById('console_tab3').src = "images/console/tabs/3b.gif";
			 			ShowContent("console_text_5");
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_send_vv();", 1000);
    	}
	}
}
function console_answer_vv(answer)
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_answer_vv.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&id="+nu_vv_id+"&answer="+answer+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			aantal_vv = aantal_vv - 1;
			 			verwerken2++;
			 			console_verwerk(1);
			 			console_update();
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_answer_vv('"+answer+"');", 1000);
    	}
	}
}
function console_friend_del()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_del_friend.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&friend_id="+console_selected+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			console_update();
			 			click_console_tab2();
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_friend_del();", 1000);
    	}
	}
}
function console_send_message()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_send_message.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&id="+console_write_id+"&message="+document.console_send_message_box.console_send_message_text.value+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			console_write_id = "";
			 			console_write_name = "";
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_send_message();", 1000);
    	}
	}
}
function console_del_message()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "console_del_message.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&id="+nu_m_id+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			console_update();
			 			click_console_tab1();
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("console_send_message();", 1000);
    	}
	}
}
function console_verwerk(mode)
{
	berichten_stukje = "0 Nieuw(e) bericht(en)";
	vv_stukje = "0 Vriendenverzoek(en)";
	if (aantal_berichten != 0 || aantal_vv != 0)
	{
		if(aantal_berichten != 0)
		{
			document.getElementById('console_icon1').src = "images/console2.gif";
			if (in_kamer == "ja")
			{
				document.getElementById('console_icon2').src = "images/icon1_2.gif";
			}
		}
		else
		{
			document.getElementById('console_icon1').src = "images/console3.gif";
			if (in_kamer == "ja")
			{
				document.getElementById('console_icon2').src = "images/icon1_3.gif";
			}
		}
	}
	else
	{
		document.getElementById('console_icon1').src = "images/console.gif";
		if (in_kamer == "ja")
		{
			document.getElementById('console_icon2').src = "images/icon1.gif";
		}
	}
	if (aantal_berichten != 0)
	{
		berichten_stukje = "<a onclick='console_show_main();'><div class='clientfont' style='color: white; cursor: pointer;'><u>"+aantal_berichten+" Nieuw(e) bericht(en)</u></div></a>";
	}
	if (aantal_vv != 0)
	{
		vv_stukje = "<a onclick='console_show_main();'><div class='clientfont' style='color: white; cursor: pointer;'><u>"+aantal_vv+" Vriendenverzoek(en)</u></div></a>";
	}
	document.getElementById('console_link_1').innerHTML = "<a onclick='console_toon_messages();'><div class='consolefont' style='cursor: pointer;'><u>"+aantal_berichten+" Nieuw(e) bericht(en)</u></div></a>";
	document.getElementById('console_link_2').innerHTML = "<a onclick='console_toon_vv();'><div class='consolefont' style='cursor: pointer;'><u>"+aantal_vv+" Vriendenverzoek(en)</u></div></a>";
	document.getElementById('toolbar_console1').innerHTML = berichten_stukje
	document.getElementById('toolbar_console2').innerHTML = vv_stukje;
	vrienden_stukje = "";
	if (aantal_v == 0)
	{
		vrienden_stukje += "<div class='consolefont'>Er staan geen vrienden in je lijst. Je kunt een Vriendenverzoek sturen via de Zoek knop.</div>";
	}
	else
	{
		var x;
		v_array_teller = 0;
		for (x in v_array)
		{
			vriend = v_array[v_array_teller];
			vrienden_stukje += "<div onclick='friends_select("+vriend['id']+", "+v_array_teller+")' style='position:relative; width:200; height:40;'>";
			vrienden_stukje += "<div class='consolefont' style='position:absolute; left:29; top:4; width:170; height:8; font-weight: bold;'>"+vriend['naam']+"</div>";
			if (vriend['online'] == "online")
			{
				vrienden_stukje += "<div style='position:absolute; left:6; top:4;'><img src='images/console/face.gif'></div>";
			}
			vrienden_stukje += "<div class='consolefont' style='position:absolute; left:29; top:14; width:170; height:8;'>"+vriend['online']+"</div>";
			vrienden_stukje += "<div class='consolefont' style='position:absolute; left:29; top:24; width:170; height:8;'>"+vriend['missie']+"</div>";
			vrienden_stukje += "<div style='position:absolute; left:0; top:39;'><img src='images/console/streep2.gif'></div>";
			if(vriend['id'] == console_selected && mode==1)
			{
				vrienden_stukje += "<div id='console_buddy_select_"+vriend['id']+"' style='position:absolute; left:1; top:1;'><img src='images/console/selected.gif'></div>";
			}
			else
			{
				vrienden_stukje += "<div id='console_buddy_select_"+vriend['id']+"' style='position:absolute; left:1; top:1; display:none;'><img src='images/console/selected.gif'></div>";
			}
			vrienden_stukje += "</div>";
			v_array_teller++;
		}
	}
	document.getElementById('console_vrienden').innerHTML = vrienden_stukje;
}
function friends_select(id, v_array_teller)
{
	if(console_selected_name == v_array[v_array_teller]['naam'])
	{
		HideContent('console_buddy_select_'+console_selected);
		console_selected = "";
		console_selected_name = "";
		console_write_button_enable = "nee";
		console_del_button_enable = "nee";
		document.getElementById('console_write').className = 'knop_trans';
		document.getElementById('console_del').className = 'knop_trans';
	}
	else
	{
		if(console_selected != "")
		{
			HideContent('console_buddy_select_'+console_selected);
			console_selected = "";
			console_selected_name = "";
		}
		console_selected = id;
		console_selected_name = v_array[v_array_teller]['naam'];
		console_write_button_enable = "ja";
		console_del_button_enable = "ja";
		ShowContent('console_buddy_select_'+console_selected);
		document.getElementById('console_write').className = 'knop_solid';
		document.getElementById('console_del').className = 'knop_sold';
	}
}
function friend_start_del()
{
	document.getElementById('console_text_8_text').innerHTML = "Weet je zeker dat je<br><br>"+console_selected_name+"<br>wilt verwijderen uit je<br>Vriendenlijst?";
	HideContent("console_text_2");
	ShowContent("console_text_8");
}
function friend_start_write()
{
	console_write_id = console_selected;
	console_write_name = console_selected_name;
	document.getElementById('console_text_9_text').innerHTML = console_write_name;
	HideContent("console_text_2");
	ShowContent("console_text_9");
}
function friend_send_write()
{
	console_send_message();
	click_console_tab2();
}
function console_show_main()
{
	document.getElementById('console').style.zIndex = ((get_top())*1)+1;
	ShowContent("console");
	click_console_tab1();
}
function console_toon_vv()
{
	if (aantal_vv != 0)
	{
		nu_vv_id = vv_array[verwerken2]['id'];
		nu_vv_naam = vv_array[verwerken2]['naam'];
		document.getElementById('console_text_6_text').innerHTML = nu_vv_naam+"<br>wil graag vrienden met<br>je worden.<br><br>Als je dit verzoek<br>accepteert zal hij/zij<br>aan je Vriendenlijst<br>toegevoegd worden.<br>Dan kun je elkaar<br>berichten sturen.";
		clear_console();
		document.getElementById('console_tab1').src = "images/console/tabs/1b.gif";
		ShowContent("console_text_6");
	}
}
function console_toon_messages()
{
	if (aantal_berichten != 0)
	{
		nu_m_id = m_array[verwerken1]['id'];
		nu_m_datum = m_array[verwerken1]['datum'];
		nu_m_van_id = m_array[verwerken1]['van_id'];
		nu_m_van_naam = m_array[verwerken1]['van_naam'];
		nu_m_bericht = m_array[verwerken1]['bericht'];
		document.getElementById('console_text_11_text1').innerHTML = "Afzender: "+nu_m_van_naam;
		document.getElementById('console_text_11_text2').innerHTML = nu_m_datum;
		document.getElementById('console_message_div').innerHTML = nu_m_bericht;
		clear_console();
		document.getElementById('console_tab1').src = "images/console/tabs/1b.gif";
		ShowContent("console_text_11");
	}
}
function console_toon_friends_help()
{
	clear_console();
	document.getElementById('console_tab2').src = "images/console/tabs/2b.gif";
	ShowContent("console_text_7");
}
function console_toon_write_help()
{
	HideContent("console_text_9");
	ShowContent("console_text_10");
}
function console_stop_write_help()
{
	HideContent("console_text_10");
	ShowContent("console_text_9");
}
function clear_console()
{
	console_selected = "";
	console_selected_name = "";
	console_write_id = "";
	console_write_name = "";
	console_voegtoe = "nee";
	console_write_button_enable = "nee";
	console_del_button_enable = "nee";
	document.console_send_message_box.console_send_message_text.value = "";
	document.getElementById('console_write').className = 'knop_trans';
	document.getElementById('console_del').className = 'knop_trans';
	document.getElementById('console_zoek_vv').className = 'knop_trans';
	HideContent("console_vergroot");
	HideContent("console_gevonden_naam");
	HideContent("console_gevonden_missie");
	HideContent("console_gevonden_last_online");
	HideContent("console_gevonden_online_status");
	HideContent("console_text_1");
	HideContent("console_text_2");
	HideContent("console_text_3");
	HideContent("console_text_4");
	HideContent("console_text_5");
	HideContent("console_text_6");
	HideContent("console_text_7");
	HideContent("console_text_8");
	HideContent("console_text_9");
	HideContent("console_text_10");
	HideContent("console_text_11");
	document.getElementById('console_tab1').src = "images/console/tabs/1.gif";
	document.getElementById('console_tab2').src = "images/console/tabs/2.gif";
	document.getElementById('console_tab3').src = "images/console/tabs/3.gif";
	document.getElementById('console_tab4').src = "images/console/tabs/4.gif";
	console_verwerk(2);
}
function click_console_tab1()
{
	clear_console();
	ShowContent("console_text_1");
	document.getElementById('console_tab1').src = "images/console/tabs/1b.gif";
}
function click_console_tab2()
{
	clear_console();
	ShowContent("console_text_2");
	document.getElementById('console_tab2').src = "images/console/tabs/2b.gif";
}
function click_console_tab3()
{
	clear_console();
	ShowContent("console_text_3");
	document.getElementById('console_tab3').src = "images/console/tabs/3b.gif";
}
function click_console_tab4()
{
	clear_console();
	ShowContent("console_text_4");
	document.getElementById('console_tab4').src = "images/console/tabs/4b.gif";
}
function console_zoek_jabbo()
{
	console_gezocht = document.getElementById('console_zoeknaam').value;
	document.getElementById('console_zoeknaam').value = "";
	if (console_gezocht != "")
	{
		console_zoek();
	}
}
function behandel_console_zoek(gegevens)
{
	console_voegtoe = "nee";
	document.getElementById('console_zoek_vv').className = 'knop_trans';
	if (gegevens == "error")
	{
		document.getElementById('console_gevonden_naam').innerHTML = "Jabbo niet gevonden";
		HideContent("console_vergroot");
		ShowContent("console_gevonden_naam");
		HideContent("console_gevonden_missie");
		HideContent("console_gevonden_last_online");
		HideContent("console_gevonden_online_status");
	}
	else
	{
		eval(gegevens);
		ShowContent("console_vergroot");
		ShowContent("console_gevonden_naam");
		ShowContent("console_gevonden_missie");
		ShowContent("console_gevonden_last_online");
		ShowContent("console_gevonden_online_status");
		document.getElementById('console_gevonden_naam').innerHTML = console_gezocht;
		document.getElementById('console_gevonden_missie').innerHTML = console_zoek_1;
		document.getElementById('console_gevonden_last_online').innerHTML = console_zoek_2;
		document.getElementById('console_gevonden_online_status').innerHTML = console_zoek_3;
		if (console_gezocht != jouwnaam && console_zoek_5 == "ja")
		{
			if (console_zoek_4 == "jabbo")
			{
				console_voegtoe = "ja";
				document.getElementById('console_zoek_vv').className = 'knop_solid';
			}
			else
			{
				if (sessie_functie != "jabbo")
				{
					console_voegtoe = "ja";
					document.getElementById('console_zoek_vv').className = 'knop_solid';
				}
			}
		}
	}
}
function console_zoek_vv_jabbo()
{
	console_voegtoe = "nee";
	document.getElementById('console_zoek_vv').className = 'knop_trans';
	console_send_vv();
}
function kamer(naam, omschrijving, type, safe, van, id, favo, pass)
{
	clearbuttons();
	if (type == "openbaar")
	{
		document.getElementById('tabtitel_src').src = "images/navi/openbaar/"+id+".gif";
	}
	else
	{
		if (parseInt(safe) == 1)
		{
			document.getElementById('tabtitel_src').src = "images/navi/icons/4.gif";
		}
		if (parseInt(safe) == 2)
		{
			document.getElementById('tabtitel_src').src = "images/navi/icons/5.gif";
		}
		if (parseInt(safe) == 3)
		{
			document.getElementById('tabtitel_src').src = "images/navi/icons/6.gif";
		}
	}
	document.getElementById('kamerschrijf_1').innerHTML = naam;
	if (sessie_functie != "jabbo")
	{
		document.getElementById('kamerschrijf_1').innerHTML += " (ID: "+id+")";
	}
	if (type == "openbaar")
	{
		document.getElementById('kamerschrijf_2').innerHTML = "";
	}
	else
	{
		document.getElementById('kamerschrijf_2').innerHTML = "Eigenaar: "+van;
	}
	document.getElementById('kamerschrijf_3').innerHTML = omschrijving;
	if (van == jouwnaam)
	{
		if (type != "openbaar")
		{
			document.getElementById('navi_button_ga').innerHTML = '<a onclick="gaklik(\''+naam+'\', \''+omschrijving+'\', \''+type+'\', '+safe+', \''+van+'\', '+id+', \''+favo+'\', \''+pass+'\')"><img id="ga" src="images/knoppen/ga.gif" border="0" onmousedown="button_down(\'ga\')" onmouseup="button_up(\'ga\')" style="cursor: default;" align="middle"></a>';
			document.getElementById('navi_button_wijzig').innerHTML = '<a onclick="change_room(\''+naam+'\', \''+omschrijving+'\', \''+type+'\', '+safe+', \''+van+'\', '+id+', \''+favo+'\', \''+pass+'\')"><img id="wijzig" src="images/knoppen/wijzig.gif" border="0" onmousedown="button_down(\'wijzig\')" onmouseup="button_up(\'wijzig\')" style="cursor: default;" align="middle"></a>';
		}
		else
		{
			document.getElementById('navi_button_ga').innerHTML = '<a onclick="gaklik(\''+naam+'\', \''+omschrijving+'\', \''+type+'\', '+safe+', \''+van+'\', '+id+', \''+favo+'\', \''+pass+'\')"><img id="ga" src="images/knoppen/ga.gif" border="0" onmousedown="button_down(\'ga\')" onmouseup="button_up(\'ga\')" style="cursor: default;" align="middle"></a>';
			if (favo == "nee")
			{
				document.getElementById('navi_button_add_fav').innerHTML = '<a onclick="add_favo('+id+')"><img id="add_fav" src="images/knoppen/add_fav.gif" border="0" onmousedown="button_down(\'add_fav\')" onmouseup="button_up(\'add_fav\')" style="cursor: default;" align="middle"></a>';
			}
			else
			{
				document.getElementById('navi_button_del_fav').innerHTML = '<a onclick="del_favo('+id+')"><img id="del_fav" src="images/knoppen/del_fav.gif" border="0" onmousedown="button_down(\'del_fav\')" onmouseup="button_up(\'del_fav\')" style="cursor: default;" align="middle"></a>';
			}
		}
	}
	else
	{
		document.getElementById('navi_button_ga').innerHTML = '<a onclick="gaklik(\''+naam+'\', \''+omschrijving+'\', \''+type+'\', '+safe+', \''+van+'\', '+id+', \''+favo+'\', \''+pass+'\')"><img id="ga" src="images/knoppen/ga.gif" border="0" onmousedown="button_down(\'ga\')" onmouseup="button_up(\'ga\')" style="cursor: default;" align="middle"></a>';
		if (favo == "nee")
		{
			document.getElementById('navi_button_add_fav').innerHTML = '<a onclick="add_favo('+id+')"><img id="add_fav" src="images/knoppen/add_fav.gif" border="0" onmousedown="button_down(\'add_fav\')" onmouseup="button_up(\'add_fav\')" style="cursor: default;" align="middle"></a>';
		}
		else
		{
			document.getElementById('navi_button_del_fav').innerHTML = '<a onclick="del_favo('+id+')"><img id="del_fav" src="images/knoppen/del_fav.gif" border="0" onmousedown="button_down(\'del_fav\')" onmouseup="button_up(\'del_fav\')" style="cursor: default;" align="middle"></a>';
		}
	}
}
function change_room(naam, omschrijving, type, safe, van, id, favo, pass)
{
	del_progres = 0;
	change_current_pass = pass;
	document.getElementById("change_id").value = id;
	document.getElementById("change_name").value = naam;
	document.getElementById("change_desc").value = omschrijving;
	if (safe == 1)
	{
		document.getElementById("change_safety_1").checked = true;
		document.getElementById('change_pass_div').style.visibility = 'hidden';
	}
	if (safe == 2)
	{
		document.getElementById("change_safety_2").checked = true;
		document.getElementById('change_pass_div').style.visibility = 'hidden';
	}
	if (safe == 3)
	{
		document.getElementById("change_safety_3").checked = true;
		document.getElementById('change_pass_div').style.visibility = 'visible';
		document.getElementById('change_pass_div').innerHTML = '<b>Wachtwoord:</b><br><input type="password" size="15" maxlength="15" id="change_pass1" name="change_pass1" class="clientfont" value="'+change_current_pass+'"><br><br><b>Wachtwoord opnieuw:</b><br><input type="password" size="15" maxlength="15" id="change_pass2" name="change_pass2" class="clientfont" value="'+change_current_pass+'">';
	}
	document.getElementById("wijziglayer").style.visibility = 'visible';
	document.getElementById("navi_change_button_cancel").style.visibility = 'visible';
	document.getElementById("navi_change_button_del_room").style.visibility = 'visible';
	document.getElementById("navi_change_button_ok").style.visibility = 'visible';
	document.getElementById("navi_change_text_div").style.visibility = 'visible';
}
function change_safe_pass()
{
	change_check1 = document.getElementById("change_safety_1").checked;
	change_check2 = document.getElementById("change_safety_2").checked;
	change_check3 = document.getElementById("change_safety_3").checked;
	if (change_check1)
	{
		document.getElementById('change_pass_div').innerHTML = '';
		document.getElementById('change_pass_div').style.visibility = 'hidden';
	}
	if (change_check2)
	{
		document.getElementById('change_pass_div').innerHTML = '';
		document.getElementById('change_pass_div').style.visibility = 'hidden';
	}
	if (change_check3)
	{
		document.getElementById('change_pass_div').innerHTML = '<b>Wachtwoord:</b><br><input type="password" size="15" maxlength="15" id="change_pass1" name="change_pass1" class="clientfont" value="'+change_current_pass+'"><br><br><b>Wachtwoord opnieuw:</b><br><input type="password" size="15" maxlength="15" id="change_pass2" name="change_pass2" class="clientfont" value="'+change_current_pass+'">';
		document.getElementById('change_pass_div').style.visibility = 'visible';
	}
}
function save_change_room() 
{
	change_check1 = document.getElementById("change_safety_1").checked;
	change_check2 = document.getElementById("change_safety_2").checked;
	change_check3 = document.getElementById("change_safety_3").checked;
	if (change_check1)
	{
		new_safe = 1;
	}
	if (change_check2)
	{
		new_safe = 2;
	}
	if (change_check3)
	{
		new_safe = 3;
	}
	if (new_safe == 3)
	{
		change_pass_check();
	}
	else
	{
		change_send();
	}
}
function change_pass_check()
{
	pass1 = document.getElementById("change_pass1").value;
	pass2 = document.getElementById("change_pass2").value;
	if ((pass1 != "") && (pass2 != ""))
	{
		if ((pass1.length > 3) && (pass2.length > 3))
		{
			if (pass1 == pass2)
			{
				if (pass1.length <= 15)
				{
					change_send();
				}
				else
				{
					start_alert("Kamerwachtwoord mag maar 15 tekens lang zijn");
				}
			}
			else
			{
				start_alert("Controleer je wachtwoord");
			}
		}
		else
		{
			start_alert("Kamerwachtwoord is te kort");
		}
	}
	else
	{
		if (document.getElementById("change_pass_div").style.visibility == 'visible')
		{
			start_alert("Niet alles is ingevuld");
		}
		else
		{
			document.getElementById("change_pass1").value = "";
			document.getElementById("change_pass2").value = "";
			document.getElementById("change_pass_div").style.visibility = 'visible';
		}
	}
}
function change_send(new_id)
{
	if (verbinding == "ja")
	{
		if (ajax_vrij == "ja")
		{
			new_id = document.getElementById("change_id").value;
			new_name = document.getElementById("change_name").value;
			new_desc = document.getElementById("change_desc").value;
			change_check1 = document.getElementById("change_safety_1").checked;
			change_check2 = document.getElementById("change_safety_2").checked;
			change_check3 = document.getElementById("change_safety_3").checked;
			new_pass = "";
			if (change_check1)
			{
				new_safe = 1;
			}
			if (change_check2)
			{
				new_safe = 2;
			}
			if (change_check3)
			{
				new_safe = 3;
			}
			if (new_safe == 3)
			{
				new_pass = document.getElementById("change_pass1").value;
			}
			ajax_vrij = "nee";
			xmlhttp.open("GET", "changeroom.php?id="+new_id+"&eigenaar="+jouwnaam+"&naam="+new_name+"&schrijf="+new_desc+"&safe="+new_safe+"&pass="+new_pass+"&random="+Math.round(9000*Math.random()),true);
		    xmlhttp.onreadystatechange=function()
		    {
			    if (xmlhttp.readyState==4)
		        {
			        if(xmlhttp.status == 200)
		 			{
						document.getElementById('list_eigen').innerHTML = xmlhttp.responseText;
			        	start_alert("Het verwerken van de veranderingen kan even duren.<br>Momentje geduld dus! De veranderingen zijn verwerkt,<br>maar het duurt een paar minuten voor anderen de wijzigingen kunnen zien.");
			        	click_small_tab2();
		 			}
		 			else if(xmlhttp.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij = "ja";
		        }
		    }
		    xmlhttp.send(null);
	    }
	    else
    	{
	    	setTimeout("change_send('"+new_id+"');", 1000);
    	}
    }
}
function del_change_room()
{
	if (del_progres == 0)
	{
		straks_del_progres = 1;
		document.getElementById("navi_del_text").innerHTML = "<b>KAMER VERWIJDEREN<br>Als je de spullen in de kamer wilt<br>houden, zet ze dan in je grote hand<br>voor je verder gaat!</b><br><br><a onclick='stop_del_change_room()'><img id='del1_cancel' src='images/knoppen/del1_cancel.gif' border='0' onmousedown='button_down(\"del1_cancel\")' onmouseup='button_up(\"del1_cancel\")' style='cursor: default;' align='midde'></a>&nbsp;&nbsp;&nbsp;<a onclick='del_change_room()'><img id='del1_del' src='images/knoppen/del1_del.gif' border='0' onmousedown='button_down(\"del1_del\")' onmouseup='button_up(\"del1_del\")' style='cursor: default;' align='midde'></a>";
		document.getElementById("navi_blanc_layer").style.visibility = 'visible';
		document.getElementById("navi_del_text_div").style.visibility = 'visible';
	}
	if (del_progres == 1)
	{
		straks_del_progres = 2;
		document.getElementById("navi_del_text").innerHTML = "<b>Weet je zeker dat je DEZE kamer<br>wilt verwijderen? Alle meubels die er<br>nog in staan ben je dan ook kwijt.<br>Dit kan niet worden teruggedraaid!</b><br><br><a onclick='stop_del_change_room()'><img id='del2_cancel' src='images/knoppen/del2_cancel.gif' border='0' onmousedown='button_down(\"del2_cancel\")' onmouseup='button_up(\"del2_cancel\")' style='cursor: default;' align='midde'></a>&nbsp;&nbsp;&nbsp;<a onclick='del_change_room()'><img id='del2_del' src='images/knoppen/del2_del.gif' border='0' onmousedown='button_down(\"del2_del\")' onmouseup='button_up(\"del2_del\")' style='cursor: default;' align='midde'></a>";
	}
	if (del_progres == 2)
	{
		if (verbinding == "ja")
		{
			if (ajax_vrij == "ja")
			{
		 		ajax_vrij = "nee";
				dell_id = document.getElementById("change_id").value;
				xmlhttp.open("GET", "dellroom.php?id="+dell_id+"&eigenaar="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    			xmlhttp.onreadystatechange=function()
	    		{
	    			if (xmlhttp.readyState==4)
        			{
	        			
	        			if(xmlhttp.status == 200)
		 				{
					 		document.getElementById('list_eigen').innerHTML = xmlhttp.responseText;
							straks_del_progres = 0;
							document.getElementById("navi_del_text").innerHTML = "<b>Kamer verwijderd!</b><br><br><a onclick='click_small_tab2()'><img id='del_ok' src='images/knoppen/del_ok.gif' border='0' onmousedown='button_down(\"del_ok\")' onmouseup='button_up(\"del_ok\")' style='cursor: default;' align='midde'></a>";
		 				}
		 				else if(xmlhttp.status == 404)
		 				{
			  				verbinding = "nee";
		 				}
		 				else
		 				{
			  				verbinding = "nee";
		 				}
		 				ajax_vrij = "ja";
        			}
    			}
    			xmlhttp.send(null);
			}
			else
    		{
		    	setTimeout("del_change_room();", 1000);
    		}
		}
	}
	del_progres = straks_del_progres;
}
function stop_del_change_room()
{
	del_progres = 0;
	document.getElementById("navi_del_text").innerHTML = "";
	document.getElementById("navi_blanc_layer").style.visibility = 'hidden';
	document.getElementById("navi_del_text_div").style.visibility = 'hidden';
}
function stop_change_room()
{
	document.getElementById("wijziglayer").style.visibility = 'hidden';
	document.getElementById("navi_change_button_cancel").style.visibility = 'hidden';
	document.getElementById("navi_change_button_del_room").style.visibility = 'hidden';
	document.getElementById("navi_change_button_ok").style.visibility = 'hidden';
	document.getElementById("navi_change_text_div").style.visibility = 'hidden';
	document.getElementById('change_pass_div').style.visibility = 'hidden';
	document.getElementById("navi_blanc_layer").style.visibility = 'hidden';
	document.getElementById("navi_del_text_div").style.visibility = 'hidden';
	change_current_pass = '';
}
function clearbuttons()
{
	document.getElementById('navi_button_ga').innerHTML = '';
	document.getElementById('navi_button_add_fav').innerHTML = '';
	document.getElementById('navi_button_del_fav').innerHTML = '';
	document.getElementById('navi_button_wijzig').innerHTML = '';
}
function clear()
{
	document.getElementById('big_tab1').src = "images/navi/tabs/1a.gif";
	document.getElementById('big_tab2').src = "images/navi/tabs/2a.gif";
	document.getElementById('tabtitel_src').src = "images/blank.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "";
	document.getElementById('kamerschrijf_2').innerHTML = "";
	document.getElementById('kamerschrijf_3').innerHTML = "";
	document.getElementById("list_openbaar").style.visibility = 'hidden';
	document.getElementById("list_anderen").style.visibility = 'hidden';
	document.getElementById("list_zoek").style.visibility = 'hidden';
	document.getElementById("list_eigen").style.visibility = 'hidden';
	document.getElementById("list_favoriet").style.visibility = 'hidden';
	document.getElementById("tabtitel_1").style.visibility = 'hidden';
	document.getElementById("tabtitel_2").style.visibility = 'hidden';
	document.getElementById("tabtitel_3").style.visibility = 'hidden';
	document.getElementById("tabtitel_4").style.visibility = 'hidden';
	document.getElementById("tabtitel_5").style.visibility = 'hidden';
	document.getElementById('small_tab1').src = "images/navi/small_tabs/1a.gif";
	document.getElementById('small_tab2').src = "images/navi/small_tabs/2a.gif";
	document.getElementById('small_tab3').src = "images/navi/small_tabs/3a.gif";
	document.getElementById("small_tab1_div").style.visibility = 'hidden';
	document.getElementById("small_tab2_div").style.visibility = 'hidden';
	document.getElementById("small_tab3_div").style.visibility = 'hidden';
	document.getElementById("zoeklayer").style.visibility = 'hidden';
	document.getElementById("zoekvak").style.visibility = 'hidden';
	document.getElementById("zoekknop").style.visibility = 'hidden';
	document.getElementById("eigenlayer").style.visibility = 'hidden';
	document.getElementById("maakknop").style.visibility = 'hidden';
	document.getElementById("maakmachine").style.visibility = 'hidden';
	document.getElementById("wijziglayer").style.visibility = 'hidden';
	document.getElementById("navi_change_button_cancel").style.visibility = 'hidden';
	document.getElementById("navi_change_button_del_room").style.visibility = 'hidden';
	document.getElementById("navi_change_button_ok").style.visibility = 'hidden';
	document.getElementById("navi_change_text_div").style.visibility = 'hidden';
	document.getElementById('change_pass_div').style.visibility = 'hidden';
	document.getElementById("navi_blanc_layer").style.visibility = 'hidden';
	document.getElementById("navi_del_text_div").style.visibility = 'hidden';
}
function click_big_tab1()
{
	clearbuttons();
	clear();
	document.getElementById('big_tab1').src = "images/navi/tabs/1b.gif";
	document.getElementById('tabtitel_src').src = "images/navi/icons/8.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "Openbare ruimten";
	document.getElementById('kamerschrijf_3').innerHTML = "Dit zijn de openbare ruimten van de hotel. Waar wacht je nog op? Ga erheen en ontmoet er anderen!";
	document.getElementById("list_openbaar").style.visibility = 'visible';
	document.getElementById("tabtitel_1").style.visibility = 'visible';
}
function click_big_tab2()
{
	clearbuttons();
	clear();
	document.getElementById('big_tab2').src = "images/navi/tabs/2b.gif";
	document.getElementById('tabtitel_src').src = "images/navi/icons/7.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "Gastenkamers";
	document.getElementById('kamerschrijf_3').innerHTML = "Dit zijn de kamers van de anderen. Ga eens bij een van hen op bezoek. En eeh, heb je zelf al een kamer?";
	document.getElementById("list_anderen").style.visibility = 'visible';
	document.getElementById("tabtitel_2").style.visibility = 'visible';
	document.getElementById("small_tab1_div").style.visibility = 'visible';
	document.getElementById("small_tab2_div").style.visibility = 'visible';
	document.getElementById("small_tab3_div").style.visibility = 'visible';
}
function click_small_tab1()
{
	clearbuttons();
	clear();
	document.getElementById('tabtitel_src').src = "images/navi/icons/3.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "Gastenkamers";
	document.getElementById('kamerschrijf_3').innerHTML = "Zoek je iets? Hier kun je de kamers van anderen opzoeken. Typ de naam van de kamer of van de eigenaar.";
	document.getElementById("tabtitel_3").style.visibility = 'visible';
	document.getElementById('small_tab1').src = "images/navi/small_tabs/1b.gif";
	document.getElementById("small_tab1_div").style.visibility = 'visible';
	document.getElementById("small_tab2_div").style.visibility = 'visible';
	document.getElementById("small_tab3_div").style.visibility = 'visible';
	document.getElementById("list_zoek").style.visibility = 'visible';
	document.getElementById("zoeklayer").style.visibility = 'visible';
	document.getElementById("zoekvak").style.visibility = 'visible';
	document.getElementById("zoekknop").style.visibility = 'visible';
	document.getElementById('gezocht').focus();
}
function click_small_tab2()
{
	clearbuttons();
	clear();
	document.getElementById('tabtitel_src').src = "images/navi/icons/1.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "Gastenkamers";
	document.getElementById('kamerschrijf_3').innerHTML = "Voor het geval je het nog niet wist: dit zijn jouw kamers! Hier kun je ze veranderen of, als je wilt, nieuwe maken.";
	document.getElementById("tabtitel_4").style.visibility = 'visible';
	document.getElementById("small_tab1_div").style.visibility = 'visible';
	document.getElementById("small_tab2_div").style.visibility = 'visible';
	document.getElementById("small_tab3_div").style.visibility = 'visible';
	document.getElementById('small_tab2').src = "images/navi/small_tabs/2b.gif";
	document.getElementById("list_eigen").style.visibility = 'visible';
	document.getElementById("eigenlayer").style.visibility = 'visible';
	document.getElementById("maakknop").style.visibility = 'visible';
	document.getElementById("maakmachine").style.visibility = 'visible';
}
function click_small_tab3()
{
	clearbuttons();
	clear();
	document.getElementById('tabtitel_src').src = "images/navi/icons/2.gif";
	document.getElementById('kamerschrijf_1').innerHTML = "Gastenkamers";
	document.getElementById('kamerschrijf_3').innerHTML = "Dit zijn je favoriete kamers. Mooie selectie heb je hier!";
	document.getElementById("tabtitel_5").style.visibility = 'visible';
	document.getElementById("small_tab1_div").style.visibility = 'visible';
	document.getElementById("small_tab2_div").style.visibility = 'visible';
	document.getElementById("small_tab3_div").style.visibility = 'visible';
	document.getElementById('small_tab3').src = "images/navi/small_tabs/3b.gif";
	document.getElementById("list_favoriet").style.visibility = 'visible';
}
function add_favo(kamerid)
{
	if (verbinding == "ja")
	{
		if (ajax_vrij == "ja")
		{
		 	ajax_vrij = "nee";
			xmlhttp.open("GET", "add_favo.php?kamerid="+kamerid+"&jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp.onreadystatechange=function()
    		{
	    		if (xmlhttp.readyState==4)
		       	{
			       	if(xmlhttp.status == 200)
		 			{
			 			document.getElementById('list_favoriet').innerHTML = xmlhttp.responseText;
		 			}
		 			else if(xmlhttp.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij = "ja";
		       	}
    		}
    		xmlhttp.send(null);
		}
		else
    	{
	    	setTimeout("add_favo("+kamerid+");", 1000);
    	}
	}
}
function del_favo(kamerid)
{
	if (verbinding == "ja")
	{
		if (ajax_vrij == "ja")
		{
		 	ajax_vrij = "nee";
			xmlhttp.open("GET", "del_favo.php?kamerid="+kamerid+"&jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp.onreadystatechange=function()
    		{
	    		if (xmlhttp.readyState==4)
        		{
	        		if(xmlhttp.status == 200)
		 			{
			 			document.getElementById('list_favoriet').innerHTML = xmlhttp.responseText;
		 			}
		 			else if(xmlhttp.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij = "ja";
        		}
    		}
    		xmlhttp.send(null);
		}
		else
    	{
	    	setTimeout("del_favo("+kamerid+");", 1000);
    	}
	}
}
function update_openbaar()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "update_openbaar.php?jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('list_openbaar').innerHTML = xmlhttp3.responseText;
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("update_openbaar();", 1000);
    	}
	}
}
function update_anderen()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "update_anderen.php?jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('list_anderen').innerHTML = xmlhttp3.responseText;
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("update_anderen();", 1000);
    	}
	}
}
function update_eigen()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "update_eigen.php?jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('list_eigen').innerHTML = xmlhttp3.responseText;
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("update_eigen();", 1000);
    	}
	}
}
function update_favo()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			xmlhttp3.open("GET", "update_favo.php?jouwnaam="+jouwnaam+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
	        		if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('list_favoriet').innerHTML = xmlhttp3.responseText;
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
		else
    	{
	    	setTimeout("update_favo();", 1000);
    	}
	}
}
function update_zoek()
{
	if (verbinding == "ja")
	{
		if (ajax_vrij3 == "ja")
		{
		 	ajax_vrij3 = "nee";
			zoekwoord = document.getElementById('gezocht').value;
    		xmlhttp3.open("GET", "update_zoek.php?jouwnaam="+jouwnaam+"&zoek="+zoekwoord+"&random="+Math.round(9000*Math.random()),true);
    		xmlhttp3.onreadystatechange=function()
    		{
	    		if (xmlhttp3.readyState==4)
        		{
        			if(xmlhttp3.status == 200)
		 			{
			 			document.getElementById('list_zoek').innerHTML = xmlhttp3.responseText;
		 			}
		 			else if(xmlhttp3.status == 404)
		 			{
		  				verbinding = "nee";
		 			}
		 			else
		 			{
		  				verbinding = "nee";
		 			}
		 			ajax_vrij3 = "ja";
        		}
    		}
    		xmlhttp3.send(null);
		}
	}
	else
    {
	   	setTimeout("update_zoek();", 1000);
    }
}
function update_money(geld_nu)
{
	jouwgeld = parseInt(geld_nu);
	sessie_geld = jouwgeld;
	if (jouwgeld == 1)
	{
		cr_text = "Credit";
	}
	else
	{
		cr_text = "Credits";
	}
	purse_new_text = "<b>Je hebt&nbsp;&nbsp;&nbsp;&nbsp;<font size='4'>"+jouwgeld+"</font>&nbsp;&nbsp;&nbsp;&nbsp;"+cr_text+"</b>";
	purse_new_credits = "";
	if (jouwgeld > 200)
	{
		purse_new_credits = purse_new_credits+"<img src='images/portemonnee/credits2.gif'>";
	}
	else
	{
		if (jouwgeld > 100)
		{
			purse_new_credits = purse_new_credits+"<img src='images/portemonnee/credits1.gif'>";
		}
		else
		{
			if (jouwgeld <= 100)
			{
				torens = Math.floor(jouwgeld/10)+1;
				cr_left = 13;
				for (i1 = 0; i1 < torens; i1++)
				{
					cr_top = 70;
					if (torens == 1)
					{
						aantal = jouwgeld;
					}
					else
					{
						if (i1 == (torens-1))
						{
							aantal = jouwgeld-((torens-1)*10);
						}
						else
						{
							aantal = 10;
						}
					}
					for (i2 = 0; i2 < aantal; i2++)
					{
						purse_new_credits = purse_new_credits+"<img src='images/portemonnee/credit.gif' style='position:absolute; left:"+cr_left+"; top:"+cr_top+"; width: 21px; height: 15px;'>";
						cr_top = cr_top-7;
					}
					cr_left = cr_left+24;
				}
			}
		}
	}
	document.getElementById('purse_money').innerHTML = purse_new_text;
	document.getElementById('purse_credits').innerHTML = purse_new_credits;
	document.getElementById('money_toolbar').innerHTML = jouwgeld+" "+cr_text;
}
function cat_koop()
{
	koop_ok = "nee";
	if (jouwgeld >= koop_price)
	{
		koop_ok = "ja";
	}
	if (jouwnaam == "thomas")
	{
		koop_ok = "ja";
	}
	if (koop_ok == "ja")
	{
		if (koop_price == 1)
		{
			credits_show1 = "Credit";
		}
		else
		{
			credits_show1 = "Credits";
		}
		if (jouwgeld == 1)
		{
			credits_show2 = "Credit";
		}
		else
		{
			credits_show2 = "Credits";
		}
		koop_modus='zelf';
		document.getElementById("koop_aantal").disabled = false;
		document.getElementById("kado_voorwie").value = '';
		document.getElementById("kado_text").value = '';
		document.getElementById("koop_aantal_div").style.visibility = 'visible';
		document.getElementById("koop_aantal").value = '1';
		document.getElementById("afbrekenknop").style.visibility = 'visible';
		document.getElementById("buy_okknop").style.visibility = 'visible';
		document.getElementById("koop2_layer").style.visibility = 'hidden';
		document.getElementById("koop2_prijs").style.visibility = 'hidden';
		document.getElementById("koop2_jouwgeld").style.visibility = 'hidden';
		document.getElementById("koop2_kado").style.visibility = 'hidden';
		document.getElementById("kado_voorwie_layer").style.visibility = 'hidden';
		document.getElementById("kado_text_layer").style.visibility = 'hidden';
		document.getElementById("koop1_prijs").style.visibility = 'visible';
		document.getElementById("koop1_jouwgeld").style.visibility = 'visible';
		document.getElementById("koop1_kado").style.visibility = 'visible';
		document.getElementById('kopen').style.zIndex = get_top()*1; change_top(document.getElementById('kopen').style.zIndex);
		ShowContent('kopen');
		document.getElementById("koop1_prijs").innerHTML = "<b>"+koop_name+" kost "+koop_price+" "+credits_show1+"</b>";
		document.getElementById("koop1_jouwgeld").innerHTML = "Je hebt nog "+jouwgeld+" "+credits_show2+" in je Portemonnee.";
		document.getElementById("koop1_kado").innerHTML = "<a onclick='kado_koop();'><img src='images/catalogus/kruisje1.gif' align='bottom'> Koop als kado";
		document.getElementById("koop2_prijs").innerHTML = "<b>"+koop_name+" kost "+koop_price+" "+credits_show1+"</b>";
		document.getElementById("koop2_jouwgeld").innerHTML = "Je hebt nog "+jouwgeld+" "+credits_show2+" in je Portemonnee.";
		document.getElementById("koop2_kado").innerHTML = "<a onclick='zelf_koop();'><img src='images/catalogus/kruisje2.gif' align='bottom'>";
	}
	else
	{
		start_alert("<b>'"+koop_name+"' kost "+koop_price+" Credits</b><br><br>Je hebt niet genoeg Credits in je Portemonnee.");
	}
}
function check_koop_aantal()
{
	if (koop_modus == 'kado')
	{
		document.getElementById("koop_aantal").value = '1';
	}
}
function ok_koop()
{
	koop_ok = "nee";
	if (jouwgeld >= (koop_price*document.getElementById("koop_aantal").value))
	{
		koop_ok = "ja";
	}
	if (jouwnaam == "thomas")
	{
		koop_ok = "ja";
	}
	if (koop_ok == "ja")
	{
		if (verbinding == "ja")
		{
			if (ajax_vrij == "ja")
			{
			 	ajax_vrij = "nee";
				xmlhttp.open("GET", "koop_item.php?jouwnaam="+jouwnaam+"&pass="+sessie_wachtwoord+"&aantal="+document.getElementById("koop_aantal").value+"&cat="+koop_cat+"&catnr="+koop_catnr+"&koop_modus="+koop_modus+"&kado_voorwie="+document.getElementById("kado_voorwie").value+"&kado_text="+document.getElementById("kado_text").value+"&in_kamer="+in_kamer+"&kamer_id="+ga_kamer_id+"&arrayteller="+thismeubi_teller+"&random="+Math.round(9000*Math.random()),true);
	    		xmlhttp.onreadystatechange=function()
    			{
       				if (xmlhttp.readyState==4)
       				{
	       				if(xmlhttp.status == 200)
			 			{
				 			eval(xmlhttp.responseText.split("<ajax>")[0]);
				 			if(in_kamer == "ja")
				 			{
					 			document.getElementById("kamer_meubels").innerHTML += xmlhttp.responseText.split("<ajax>")[1];
					 			room_set_hand("open");
				 			}
	       					stop_koop();
	       					start_alert("Jeuh! Je aankoop wordt bezorgd!");
		 				}
		 				else if(xmlhttp.status == 404)
		 				{
			  				verbinding = "nee";
		 				}
		 				else
		 				{
			  				verbinding = "nee";
		 				}
		 				ajax_vrij = "ja";
       				}
    			}
    			xmlhttp.send(null);
			}
			else
    		{
		    	setTimeout("ok_koop();", 1000);
    		}
		}
	}
	else
	{
		start_alert("<b>'"+koop_name+"' kost "+koop_price+" Credits</b><br><br>Je hebt niet genoeg Credits in je Portemonnee om er zoveel te kopen.");
	}
}
function kado_koop()
{
	koop_modus = 'kado';
	document.getElementById("koop_aantal").value = '1';
	document.getElementById("koop_aantal").disabled = true;
	document.getElementById("koop2_layer").style.visibility = 'visible';
	document.getElementById("koop2_prijs").style.visibility = 'visible';
	document.getElementById("koop2_jouwgeld").style.visibility = 'visible';
	document.getElementById("koop2_kado").style.visibility = 'visible';
	document.getElementById("kado_voorwie_layer").style.visibility = 'visible';
	document.getElementById("kado_text_layer").style.visibility = 'visible';
	document.getElementById("koop1_prijs").style.visibility = 'hidden';
	document.getElementById("koop1_jouwgeld").style.visibility = 'hidden';
	document.getElementById("koop1_kado").style.visibility = 'hidden';
}
function zelf_koop()
{
	koop_modus = 'zelf';
	document.getElementById("koop_aantal").disabled = false;
	document.getElementById("koop2_layer").style.visibility = 'hidden';
	document.getElementById("koop2_prijs").style.visibility = 'hidden';
	document.getElementById("koop2_jouwgeld").style.visibility = 'hidden';
	document.getElementById("koop2_kado").style.visibility = 'hidden';
	document.getElementById("kado_voorwie_layer").style.visibility = 'hidden';
	document.getElementById("kado_text_layer").style.visibility = 'hidden';
	document.getElementById("koop1_prijs").style.visibility = 'visible';
	document.getElementById("koop1_jouwgeld").style.visibility = 'visible';
	document.getElementById("koop1_kado").style.visibility = 'visible';
}
function stop_koop()
{
	document.getElementById("koop_aantal_div").style.visibility = 'hidden';
	document.getElementById("afbrekenknop").style.visibility = 'hidden';
	document.getElementById("buy_okknop").style.visibility = 'hidden';
	document.getElementById("koop2_layer").style.visibility = 'hidden';
	document.getElementById("koop2_prijs").style.visibility = 'hidden';
	document.getElementById("koop2_jouwgeld").style.visibility = 'hidden';
	document.getElementById("koop2_kado").style.visibility = 'hidden';
	document.getElementById("kado_voorwie_layer").style.visibility = 'hidden';
	document.getElementById("kado_text_layer").style.visibility = 'hidden';
	document.getElementById("koop1_prijs").style.visibility = 'hidden';
	document.getElementById("koop1_jouwgeld").style.visibility = 'hidden';
	document.getElementById("koop1_kado").style.visibility = 'hidden';
	HideContent('kopen');
}