var FOR_SALE = 0;

var PRICE_PER_WEEK = 0;
var PRICE_PER_MONTH = 1;

function PropertySearchForm(){
    this.bedrooms = 0;
    this.minPrice = 0;
    this.maxPrice = 0;
    
    this.regions = Array();
}
var propertyForm = new PropertySearchForm();
function preparePropertyForm(serviceType){
    propertyForm.bedrooms = $('bedrooms').value;
    if (serviceType == FOR_SALE){
	    propertyForm.minPrice = $('minPrice').value;
	    propertyForm.maxPrice = $('maxPrice').value;
    } else {
    	setLettingsPrices();
    }

    if ($('SelectRegions')){
        propertyForm.regions = Array();
        $$('input').each(function(item){
           if (item.name=='regions' && item.checked){
               propertyForm.regions[propertyForm.regions.length]=item.value;
           }
        });
    } else {
        propertyForm.regions = null;
    }
}
function setLettingsPrices(){
	if ($('pricePer').value==PRICE_PER_WEEK){
	    propertyForm.minPrice = $('minPrice').value;
	    propertyForm.maxPrice = $('maxPrice').value;	
	}else {
	    propertyForm.minPrice = getWeekPrice($('minMonthPrice').value);
	    propertyForm.maxPrice = getWeekPrice($('maxMonthPrice').value);	
	}	
}
