document.observe("dom:loaded", function(){
	$$('.properties_type').each(function(el){
		el.observe("change",function(e){

		if (e.target.value == "buy")
		{
			$('quick_search').action = $('quick_search').getAttribute("buy");
		}
		else if (e.target.value == "rent")
		{
			$('quick_search').action = $('quick_search').getAttribute("rent");
		}
		})
	})
	/*$('price_from').observe("change", price_change);
	$('price_to').observe("change", price_change);*/

})

function price_change(e)
{
	if (!parseFloat(e.target.value))
	{
		e.target.value = "";
	}

}

function validate_quicksearch(e)
{
	var flag = true;
	if (!parseFloat($('price_from').value))
	{
		$('price_from').value = "";
		flag = false;
	}

	if (!parseFloat($('price_to').value))
	{
		$('price_to').value = "";
		flag = false;
	}
	if (!$$('.properties_type')[0].checked && !$$('.properties_type')[1].checked)
	{
		flag = false;
	}

	if ($('category').value == 0)
	{
		flag = false;
	}

	//--------------------------------

	if (flag)
	{
		$('quick_search_button').disabled = "";
	}
	else
	{
		$('quick_search_button').disabled = "disabled";
	}

}