<!--

var lease_price = new Array(
	"500",
	"950",
	"1000",
	"1250",
	"1500",
	"1750",
	"2000",
	"2250",
	"2500",
	"2750",
	"3000",
	"4000",
	"5000",
	"6000",
	"7000",
	"8000",
	"9000",
	"10000"
);

var normal_price = new Array(
	"75000",
	"100000",
	"125000",
	"150000",
	"175000",
	"200000",
	"225000",
	"250000",
	"275000",
	"300000",
	"325000",
	"350000",
	"375000",
	"400000",
	"425000",
	"450000",
	"475000",
	"500000",
	"600000",
	"700000",
	"800000",
	"900000",
	"1000000",
	"1250000",
	"1500000",
	"1750000",
	"2000000",
	"2250000",
	"2500000",
	"2750000",
	"3000000",
	"3250000",
	"3500000",
	"3750000",
	"4000000",
	"4500000",
	"5000000",
	"5500000",
	"6000000",
	"6500000",
	"7000000",
	"7500000",
	"8000000",
	"8500000",
	"9000000",
	"9500000",
	"10000000"
);

	function addCommas(nStr)
	{
		nStr += '';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + ',' + '$2');
		}
		return x1 + x2;
	}

	function update_price(idx, min, max) {
		if(idx == "rental") {
			var arr = lease_price;
		} else {
			var arr = normal_price;
		}
		document.getElementById("minimum_price").options.length=1;
		document.getElementById("maximum_price").options.length=1;
		document.getElementById("maximum_price").value="";
		document.getElementById("minimum_price").value="";
		for(var i=0, len=arr.length; i<len; i++) {
				var num = arr[i];
				num_comma = addCommas(num);
				document.getElementById("minimum_price").options[i+1]=new Option("$"+num_comma, num);
				if(num == min) {
    				document.getElementById("minimum_price").selectedIndex = i+1;
				}
			    document.getElementById("maximum_price").options[i+1]=new Option("$"+num_comma, num);
				if(num == max) {
    				document.getElementById("maximum_price").selectedIndex = i+1;
				}
		}
	}

	function map_price()
	{
		var val = document.getElementById("search_type").value;
		update_price(val);
	}

	function quick_price()
	{
		var val = document.getElementById("idx").value;
		update_price(val);
	}
	
	function sform_price()
	{
		var val = $('#sf_proptypes input:checked').val();
		update_price(val);
	}
//-->