function reviseSearch(param,value){
	var url = location.href;
	var newurl;
	if(url == 'http://btr.unix.custompathidx.com/')
		url = 'http://btr.unix.custompathidx.com/index.php?listing_type_id=11&listing_status_id=1,2&max_per_page=10&subdivision_name=Bent%20Tree&office_id=TMTP01';
	var re2 = new RegExp("([?|&])" + 'page_number' + "=.*?(&|$)","i");
	if (url.match(re2)){
		url = url.replace(re2,'$1' + 'page_number' + "=" + 1 + '$2');
	}
	else
		url = url + '&' + 'page_number' + "=" + 1;
	
	
    var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
    if (url.match(re)){
		
		location.href = url.replace(re,'$1' + param + "=" + value + '$2');
	}
    else
        location.href = url + '&' + param + "=" + value;
} 

function checkMinPrice(minprice, maxprice, o_minprice) {
	if(minprice > maxprice) {
		alert('Min Price cannot be greater than Max Price.');
		minprice.value=o_minprice;
	} else {
		reviseSearch('min_price',minprice);
	}
	return;
}

function checkMaxPrice(minprice, maxprice, o_maxprice) {
	if(minprice > maxprice) {
		alert('Max Price cannot be less than Min Price.');
		maxprice.value=o_maxprice;
	} else {
		reviseSearch('max_price',maxprice);
	}
	return;
}

