var show=false;
var over=0;
function objDetect (obj) {
	if (document.all) {
		val = document.all(obj);
	}
	else if (document.getElementById) {
		val = document.getElementById(obj);
	}
	else if (document.layers) {
		val = document.layers(obj);
	}
	if (val) return val;
	else return false;
}

function do_display(city, level) {
	show=true;
	var url='/apartments.php?city='+city;
	var left=parseInt(parseInt(screen.width)/2 - 251);
	var top=133+24*(level+1);
	var div=objDetect('menu');
	var html='<table width="60" border="0" cellpadding="5" cellspacing="1">'+
	'<tr bgcolor="#5DaEF0">'+
		'<td class="menu" onmouseover="show=true; over=1;" onmouseout="show=false; do_hide(); over=0;" onclick="location.href=\''+url+'&rooms=1\'">'+
		'<a href="'+url+'&rooms=1" class="menu">1-room</a>'+
		'</td>'+
	'</tr>'+
	'<tr bgcolor="#5DaEF0">'+
		'<td class="menu" onmouseover="show=true; over=1;" onmouseout="show=false; do_hide(); over=0;" onclick="location.href=\''+url+'&rooms=2\'">'+
		'<a href="'+url+'&rooms=2" class="menu">2-room</a>'+
		'</td>'+
	'</tr>'+
	'<tr bgcolor="#5DaEF0">'+
		'<td class="menu" onmouseover="show=true; over=1;" onmouseout="show=false; do_hide(); over=0;" onclick="location.href=\''+url+'&rooms=3\'">'+
		'<a href="'+url+'&rooms=3" class="menu">3-room</a>'+
		'</td>'+
	'</tr>'+
	'</table>';
	div.innerHTML=html;
	div.style.width='auto';
	div.style.height='auto';
	div.style.visibility='visible';
	div.style.left=left;
	div.style.top=top;
	show=false;
}

function do_hide() {
	if(!show) setTimeout('hide_div()',100);
}

function hide_div() {
	if(over==0) {
		var div=objDetect('menu');
		div.innerHTML='';
		div.style.visibility='hidden';
		div.style.width='0px';
		div.style.height='0px';	
	}
}

function enlarge(id, width, height) {
	height=parseInt(height)+50;
	var left=parseInt((parseInt(screen.width)-width)/2);
	var top=parseInt((parseInt(screen.height)-height)/2);
	var win=window.open('/apartments/photo.php?id='+id,'_blank','width='+width+',height='+height+',left='+left+',top='+top);
	win.focus();
}
