var rentalMinPrices = [
{value:0, text: '0pw'},
{value:100, text: '$100pw'},
{value:200, text: '$200pw'},
{value:300, text: '$300pw'},
{value:400, text: '$400pw'},
{value:500, text: '$500pw'},
{value:750, text: '$750pw'},
{value:1000, text: '$1000pw'}
];

var rentalMaxPrices = [
{value:100, text: '$100pw'},
{value:200, text: '$200pw'},
{value:300, text: '$300pw'},
{value:400, text: '$400pw'},
{value:500, text: '$500pw'},
{value:750, text: '$750pw'},
{value:'', text: '$1000pw+'}
];

var saleMinPrices = [
{value:0, text: '$0'},
{value:100000, text: '$100k'},
{value:200000, text: '$200k'},
{value:300000, text: '$300k'},
{value:400000, text: '$400k'},
{value:500000, text: '$500k'},
{value:600000, text: '$600k'},
{value:700000, text: '$700k'},
{value:800000, text: '$800k'},
{value:900000, text: '$900k'},
{value:1000000, text: '$1M'}
];

var saleMaxPrices = [
{value:0, text: '$0'},
{value:100000, text: '$100k'},
{value:200000, text: '$200k'},
{value:300000, text: '$300k'},
{value:400000, text: '$400k'},
{value:500000, text: '$500k'},
{value:600000, text: '$600k'},
{value:700000, text: '$700k'},
{value:800000, text: '$800k'},
{value:900000, text: '$900k'},
{value:'', text: '$1M+'}
];

var rentalCategories = [
{value:'Residential', text: 'Residential'},
{value:'Holiday', text: 'Holiday'},
{value:'Commercial', text: 'Commercial'}
];

var saleCategories = [
{value:'Residential', text: 'Residential'},
{value:'Business', text: 'Business'},
{value:'Rural', text: 'Rural'},
{value:'Commercial', text: 'Commercial'}
];

function changeSelectOptions(opts) {
  field = opts.field;
  selected = opts.selected;
  prefix = opts.prefix;
  options = opts.options;
  
  var optionsHTML = '';
  if (prefix != null) {
    optionsHTML += buildSelectOption({text:prefix.text, value:prefix.value, selected:selected});
  }
  for (var i = 0; i < options.length; i++) {
    optionsHTML += buildSelectOption({text:options[i].text, value:options[i].value, selected:selected});
  }
  $(field).html(optionsHTML);  
}

function buildSelectOption(opts) {
  value = opts.value;
  text = opts.text;
  selected = opts.selected;
  return '<option value="' + value + ((selected != null && selected != '' && selected == value) ? '" selected="selected"' : '"') + '>' + text + '</option>';
}

function selectCheckBoxes(currentCheckbox, cl) {
	if(currentCheckbox.checked) {
		$(cl).each(function(){
			this.checked = true;
		});
	} else {
		$(cl).each(function(){
			this.checked = false;
		});
	}
}

function switchEmployee(employee_id) {
	var current_photo = $('#photo-' + employee_id);
	var current_profile = $('#profile-' + employee_id);
	$('#employee-photos .photo').removeClass('current');
	current_photo.addClass('current');
	$('#employee-profiles .profile').hide();
	current_profile.show();
}

