/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Carl Leiby | http://leibys-place.com/ */
var otherStuff = {
   "Aluguel" : [ "indiferente_0","até_300,00", "até_500,00", "até_700,00", "até_800,00", "até_1.000,00", "até_1.300,00", "até_1.500,00","até_2.000,00","até_3.000,00","até_4.000,00","até_5.000,00","até_6.000,00","até_8.000,00","até_10.000,00"],
   "Venda" : [ "indiferente_0","até_70.000,00", "até_100.000,00", "até_150.000,00", "até_200.000,00", "até_250.000,00", "até_300.000,00", "até_350.000,00", "até_500.000,00", "até_700.000,00"]
};

function selectAll(listName, selected) {
  var listBox = document.getElementById(listName);
  for(i=0; i<listBox.length; i++) {
    listBox.options[i].selected=selected;
  }
  if( listBox.onchange ) {
    listBox.onchange();
  }
}

function lstStuff_OnChange() {
  var listBox = document.getElementById("lstStuff");
  var subListBox = document.getElementById("lstOtherStuff");
  subListBox.options.length=0;
  for(i=0; i<listBox.length; i++) {
    if( listBox.options[i].selected ) {
      var key = listBox.options[i].text;
      if(otherStuff[key]) {
        for(j=0; j<otherStuff[key].length; j++) {
        subListBox.options.add(new Option(otherStuff[key][j],otherStuff[key][j]));
        }
      }
    }
  }
}

function lstStuff2_OnChange() {
  var listBox = document.getElementById("lstStuff2");
  var subListBox = document.getElementById("lstOtherStuff2");
  subListBox.options.length=0;
  for(i=0; i<listBox.length; i++) {
    if( listBox.options[i].selected ) {
      var key = listBox.options[i].text;
      if(otherStuff[key]) {
        for(j=0; j<otherStuff[key].length; j++) {
        subListBox.options.add(new Option(otherStuff[key][j],otherStuff[key][j]));
        }
      }
    }
  }
}
