function openPopUp_520x390(href, target)
{
	window.open(href, target, 'width=520, height=390, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
function openPopUp_485x390(href, target)
{
	window.open(href, target, 'width=485, height=390, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
function openGallery(idx)
{
	window.open("image_gallery_detail.php?id=" + idx, "", "toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=0, width=600, height=450, top=0");
	return false;
}
function openWallpaper(idx)
{
	window.open("wallpaper_detail.php?id=" + idx, "", " toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=1, width=800, height=600, top=0");
	return false;
}
function showEstateImage(href, target)
{
	window.open(href, target, 'width=600, height=400, resizable, scrollbars, alwaysRaised');
	return false;
}

function showEstate(idx)
{
	newWindow = window.open("estate_detail.php?id=" + idx, "estate_detail_window", "width=656, height=480, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0");
	if (window.focus) {newWindow.focus()}
		return false;
}
function trim(s) 
{
	while (s.substring(0,1) == ' ')
		s = s.substring(1,s.length);
	while (s.substring(s.length-1,s.length) == ' ')
		s = s.substring(0,s.length-1);
	return s;
}

function valButton(btn)
{
	var cnt = -1;
	for (var i=0; i < btn.length; i++)
	{
		if (btn[i].checked)
		{
			cnt = i;
			i = btn.length;
		}
	}
	if (cnt > -1)
		return btn[cnt].value;
	else
		return null;
}

function onlyNumber()
{
	if (event.keyCode < 48 || event.keyCode> 57) event.returnValue = false;
}

function autoTab(original,destination)
{
	if (original.getAttribute && original.value.length == original.getAttribute("maxlength"))
		destination.focus()
}