/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function adiciona(tipo) {

        var alugel = new Array("18.000,00","15,000,00","13.000,00","10.000,00","9.500,00","9.000,00","8.500,00","8.000,00","7.500,00","7.000,00","6.500,00",".6000,00","5.500,00","5.000,00","4.500,00","4.000,00","3.500,00","3.000,00","2.500,00","2.000,00","1.500,00","1.250,00","1.000,00","900,00","800,00","700,00","600,00","500,00","400,00","300,00","200,00","100,00","1,00");
        var venda = new Array("900.000,00","700.000,00","600.000,00","500.000,00","450.000,00","400.000,00","370.000,00","330.000,00","300.000,00","270.000,00","240.000,00","200.000,00","160.000,00","130.000,00","100.000,00","80.000,00","60.000,00","40.000,00","25.000,00","10.000,00","5.000,00","0,00");

        var valor_de = document.getElementById('valor_de');
        var valor_ate = document.getElementById('valor_ate');
        var elementos;

        if(tipo == "aluguel"){
             elementos = alugel;
        }
        else{
             elementos = venda;
        }


        for(var elemento in elementos){
            var maisd = document.createElement('option');
            maisd.text=elementos[elemento];
            maisd.value=parseInt(elementos[elemento]);
            maisd.selected=false;

            var maisa = document.createElement('option');
            maisa.text=elementos[elemento];
            maisa.value=elementos[elemento];
            maisa.selected=false;

            var maismil = document.createElement('option');
            maismil.text='mais de 1 milhão';
            maismil.value=1000000000;
            maismil.selected=true;

            var mais18 = document.createElement('option');
            mais18.text='mais de 18 mil';
            mais18.value=10000000000;
            mais18.selected=true;

            var antigo_de = valor_de.options[0];
            var antigo_ate = valor_ate.options[0];

            try {
                valor_de.add(maisd, antigo_de);
            }
            catch(ex) {
                valor_de.add(maisd, valor_de.selectedIndex);
            }

            try {
                valor_ate.add(maisa, antigo_ate);
            }
            catch(ex) {
                valor_ate.add(maisa, valor_ate.selectedIndex);
            }
        }

         if(tipo == "aluguel"){
              try {
                valor_ate.add(mais18, 40);
            }
            catch(ex) {
                valor_ate.add(mais18, valor_ate.selectedIndex);
            }
        }
        else{
             try {
                valor_ate.add(maismil, 30);
            }
            catch(ex) {
                valor_ate.add(maismil, valor_ate.selectedIndex);
            }
        }
    }

    function remove() {
        var retirad = document.getElementById('valor_de');
        var i;
        var retiraa = document.getElementById('valor_ate');
        var z;
        for (i = retirad.length - 1; i>=0; i--) {
            retirad.remove(i);
        }
        for (z = retiraa.length - 1; z>=0; z--) {
            retiraa.remove(z);
        }
    }

  
