function OnSearch()
		{
			var txtMax = get("txtPriceMax");
			var txtMin = get("txtPriceMin");
			alert(txtMin);
			alert(txtMax);
			if (!isEmpty(txtMax))
			{
				if (!isInt(txtMax.value))
				{
					alert('Please enter numeric max value.')
					return false;
				}
			}
			if (!isEmpty(txtMin))
			{
				if (!isInt(txtMin.value))
				{
					alert('Please enter numeric value.')
					return false;
				}
			}
			return true;
		}
function search()
{
	var drpBuy = get("drpBuy");
	var drpPropertyType = get("drpPropertyType");
	var txtMax = get("txtMax");
	var txtMin = get("txtMin");
	var drpBedrooms = get("drpBedrooms");
	
	var url = "SearchResults.aspx?Type=" + drpPropertyType.value + "&BuyRent=" + drpBuy.value + "&Bedrooms=" + drpBedrooms.value;
	url += ((! isEmpty(txtMax)) && (isInt(txtMax.value)))?"&Pmax=" + txtMax.value:"";
	url += ((! isEmpty(txtMin)) && (isInt(txtMin.value)))?"&Pmin=" + txtMin.value:"";
	
	window.location = url;
}

function isInt(value)
{
		value = parseInt(value);		
		if(value)
		{
			if(value < 2147483648  && value > -2147483649)
			return true;
		}
		return false;
}
function isEmpty(control) {
	if(!control) return true;
	var strTmp = control.value;
	do {
		strTmp = strTmp.replace('\r\n', '');
	} while (strTmp.indexOf('\r\n') > -1);
	do {
		strTmp = strTmp.replace('  ', ' ');
	} while (strTmp.indexOf('  ') >= 0);
	
	if(strTmp.replace(' ','')  == '') {
		return true;
	}
	return false;
}
function get(name)
{
	return document.getElementById(name);
}