var indiceprezzi = new Array();
var prezzilire = new Array();
var prezzieuro = new Array();

var indiceaffitti = new Array();
var affittilire = new Array();
var affittieuro = new Array();

var zone1 = new Array();
var zone2 = new Array();
var zone3 = new Array();
var zone4 = new Array();
var zone5 = new Array();
var zone7 = new Array();
var zone8 = new Array();
var arrcomuni = new Array();

var cbzona = new Array();
var cbcomuni = new Array();
var cbtipologia = new Array();
var cbimmobile = new Array();
var cbtipoins = new Array();
var cbdatains = new Array();
var cbprezzo = new Array();
var cbmq = new Array();
var cbCat = new Array();

cbzona[0] = "combozona";

cbcomuni[0] = "combocomuni";

cbtipologia[0] = "combotipologia";

cbimmobile[0] = "comboimmobile";

cbtipoins[0] = "combotipoins";

cbdatains[0] = "rbdata[0]";
cbdatains[1] = "rbdata[1]";
cbdatains[2] = "ngiorni";

//cbprezzo[0] = "rbprezzo[0]";
//cbprezzo[1] = "rbprezzo[1]";
//cbprezzo[2] = "comboprezzo";
cbprezzo[0] = "comboprezzo";
// cbprezzo[3] = "cbvaluta";

cbmq[0] = "combomq"

cbCat[0] = "comboCat"


indiceprezzi[0]="1";prezzieuro[0]="Non specificato €";indiceprezzi[1]="2";prezzieuro[1]="Fino a 51000 €";indiceprezzi[2]="3";prezzieuro[2]="Fino a 77500 €";indiceprezzi[3]="4";prezzieuro[3]="Fino a 102000 €";indiceprezzi[4]="5";prezzieuro[4]="Fino a 130000 €";indiceprezzi[5]="6";prezzieuro[5]="Fino a 155000 €";indiceprezzi[6]="7";prezzieuro[6]="Fino a 180000 €";indiceprezzi[7]="8";prezzieuro[7]="Fino a 206000 €";indiceprezzi[8]="9";prezzieuro[8]="Fino a 232000 €";indiceprezzi[9]="10";prezzieuro[9]="Fino a 258000 €";indiceprezzi[10]="11";prezzieuro[10]="Fino a 284000 €";indiceprezzi[11]="12";prezzieuro[11]="Fino a 310000 €";indiceprezzi[12]="13";prezzieuro[12]="Fino a 336000 €";indiceprezzi[13]="14";prezzieuro[13]="Fino a 362000 €";indiceprezzi[14]="15";prezzieuro[14]="Oltre 362000 €";
indiceaffitti[0]="1";affittieuro[0]="Non specificato €";indiceaffitti[1]="2";affittieuro[1]="Fino a 207 €";indiceaffitti[2]="3";affittieuro[2]="Fino a 310 €";indiceaffitti[3]="4";affittieuro[3]="Fino a 413 €";indiceaffitti[4]="5";affittieuro[4]="Fino a 516 €";indiceaffitti[5]="6";affittieuro[5]="Fino a 620 €";indiceaffitti[6]="7";affittieuro[6]="Fino a 723 €";indiceaffitti[7]="8";affittieuro[7]="Fino a 826 €";indiceaffitti[8]="9";affittieuro[8]="Fino a 930 €";indiceaffitti[9]="10";affittieuro[9]="Fino a 1033 €";indiceaffitti[10]="11";affittieuro[10]="Fino a 1136 €";indiceaffitti[11]="12";affittieuro[11]="Fino a 1291 €";indiceaffitti[12]="13";affittieuro[12]="Fino a 1550 €";indiceaffitti[13]="14";affittieuro[13]="Fino a 2066 €";indiceaffitti[14]="15";affittieuro[14]="Oltre 2067 €";
eval('zone3[zone3.length] = 1');eval("arrcomuni[1] = \"AGUGLIARO\"");eval('zone3[zone3.length] = 2');eval("arrcomuni[2] = \"ALBETTONE\"");eval('zone5[zone5.length] = 4');eval("arrcomuni[4] = \"ALTAVILLA VICENTINA\"");eval('zone3[zone3.length] = 6');eval("arrcomuni[6] = \"ARCUGNANO\"");eval('zone5[zone5.length] = 8');eval("arrcomuni[8] = \"ARZIGNANO\"");eval('zone2[zone2.length] = 9');eval("arrcomuni[9] = \"ASIAGO\"");eval('zone3[zone3.length] = 11');eval("arrcomuni[11] = \"BARBARANO VICENTINO\"");eval('zone2[zone2.length] = 12');eval("arrcomuni[12] = \"BASSANO DEL GRAPPA\"");eval('zone4[zone4.length] = 13');eval("arrcomuni[13] = \"BOLZANO VICENTINO\"");eval('zone2[zone2.length] = 14');eval("arrcomuni[14] = \"BREGANZE\"");eval('zone5[zone5.length] = 15');eval("arrcomuni[15] = \"BRENDOLA\"");eval('zone2[zone2.length] = 16');eval("arrcomuni[16] = \"BRESSANVIDO\"");eval('zone5[zone5.length] = 17');eval("arrcomuni[17] = \"BROGLIANO\"");eval('zone2[zone2.length] = 18');eval("arrcomuni[18] = \"CALDOGNO\"");eval('zone2[zone2.length] = 19');eval("arrcomuni[19] = \"CALTRANO\"");eval('zone4[zone4.length] = 21');eval("arrcomuni[21] = \"CAMISANO VICENTINO\"");eval('zone3[zone3.length] = 22');eval("arrcomuni[22] = \"CAMPIGLIA DEI BERICI\"");eval('zone2[zone2.length] = 24');eval("arrcomuni[24] = \"CARRE'\"");eval('zone2[zone2.length] = 25');eval("arrcomuni[25] = \"CARTIGLIANO\"");eval('zone2[zone2.length] = 27');eval("arrcomuni[27] = \"CASSOLA\"");eval('zone3[zone3.length] = 28');eval("arrcomuni[28] = \"CASTEGNERO\"");eval('zone5[zone5.length] = 29');eval("arrcomuni[29] = \"CASTELGOMBERTO\"");eval('zone5[zone5.length] = 30');eval("arrcomuni[30] = \"CHIAMPO\"");eval('zone2[zone2.length] = 31');eval("arrcomuni[31] = \"CHIUPPANO\"");eval('zone2[zone2.length] = 36');eval("arrcomuni[36] = \"COSTABISSARA\"");eval('zone5[zone5.length] = 37');eval("arrcomuni[37] = \"CREAZZO\"");eval('zone2[zone2.length] = 40');eval("arrcomuni[40] = \"DUEVILLE\"");eval('zone2[zone2.length] = 41');eval("arrcomuni[41] = \"ENEGO\"");eval('zone2[zone2.length] = 42');eval("arrcomuni[42] = \"FARA VICENTINO\"");eval('zone2[zone2.length] = 43');eval("arrcomuni[43] = \"TONEZZA DEL CIMONE\"");eval('zone2[zone2.length] = 46');eval("arrcomuni[46] = \"GALLIO\"");eval('zone5[zone5.length] = 47');eval("arrcomuni[47] = \"GAMBELLARA\"");eval('zone3[zone3.length] = 49');eval("arrcomuni[49] = \"GRANCONA\"");eval('zone3[zone3.length] = 50');eval("arrcomuni[50] = \"GRISIGNANO DI ZOCCO\"");eval('zone4[zone4.length] = 51');eval("arrcomuni[51] = \"GRUMOLO DELLE ABBADESSE\"");eval('zone2[zone2.length] = 52');eval("arrcomuni[52] = \"ISOLA VICENTINA\"");eval('zone3[zone3.length] = 55');eval("arrcomuni[55] = \"LONGARE\"");eval('zone5[zone5.length] = 56');eval("arrcomuni[56] = \"LONIGO\"");eval('zone2[zone2.length] = 57');eval("arrcomuni[57] = \"LUGO DI VICENZA\"");eval('zone2[zone2.length] = 58');eval("arrcomuni[58] = \"LUSIANA\"");eval('zone5[zone5.length] = 60');eval("arrcomuni[60] = \"MALO\"");eval('zone2[zone2.length] = 61');eval("arrcomuni[61] = \"MARANO VICENTINO\"");eval('zone2[zone2.length] = 62');eval("arrcomuni[62] = \"MAROSTICA\"");eval('zone2[zone2.length] = 63');eval("arrcomuni[63] = \"MASON VICENTINO\"");eval('zone2[zone2.length] = 64');eval("arrcomuni[64] = \"MOLVENA\"");eval('zone5[zone5.length] = 65');eval("arrcomuni[65] = \"MONTEBELLO VICENTINO\"");eval('zone5[zone5.length] = 66');eval("arrcomuni[66] = \"MONTECCHIO MAGGIORE\"");eval('zone2[zone2.length] = 67');eval("arrcomuni[67] = \"MONTECCHIO PRECALCINO\"");eval('zone2[zone2.length] = 68');eval("arrcomuni[68] = \"MONTE DI MALO\"");eval('zone3[zone3.length] = 69');eval("arrcomuni[69] = \"MONTEGALDA\"");eval('zone3[zone3.length] = 70');eval("arrcomuni[70] = \"MONTEGALDELLA\"");eval('zone2[zone2.length] = 72');eval("arrcomuni[72] = \"MONTICELLO CONTE OTTO\"");eval('zone5[zone5.length] = 73');eval("arrcomuni[73] = \"MONTORSO VICENTINO\"");eval('zone3[zone3.length] = 74');eval("arrcomuni[74] = \"MOSSANO\"");eval('zone2[zone2.length] = 76');eval("arrcomuni[76] = \"MUSSOLENTE\"");eval('zone3[zone3.length] = 77');eval("arrcomuni[77] = \"NANTO\"");eval('zone2[zone2.length] = 80');eval("arrcomuni[80] = \"NOVE\"");eval('zone3[zone3.length] = 81');eval("arrcomuni[81] = \"NOVENTA VICENTINA\"");eval('zone5[zone5.length] = 82');eval("arrcomuni[82] = \"ORGIANO\"");eval('zone2[zone2.length] = 85');eval("arrcomuni[85] = \"PIOVENE-ROCCHETTE\"");eval('zone2[zone2.length] = 86');eval("arrcomuni[86] = \"POIANA MAGGIORE\"");eval('zone2[zone2.length] = 88');eval("arrcomuni[88] = \"POVE DEL GRAPPA\"");eval('zone2[zone2.length] = 89');eval("arrcomuni[89] = \"POZZOLEONE\"");eval('zone4[zone4.length] = 90');eval("arrcomuni[90] = \"QUINTO VICENTINO\"");eval('zone2[zone2.length] = 91');eval("arrcomuni[91] = \"RECOARO TERME\"");eval('zone2[zone2.length] = 92');eval("arrcomuni[92] = \"ROMANO D'EZZELINO\"");eval('zone2[zone2.length] = 93');eval("arrcomuni[93] = \"ROSA'\"");eval('zone2[zone2.length] = 94');eval("arrcomuni[94] = \"ROSSANO VENETO\"");eval('zone2[zone2.length] = 96');eval("arrcomuni[96] = \"SANDRIGO\"");eval('zone5[zone5.length] = 97');eval("arrcomuni[97] = \"SAN GERMANO DEI BERICI\"");eval('zone2[zone2.length] = 98');eval("arrcomuni[98] = \"SAN NAZARIO\"");eval('zone2[zone2.length] = 99');eval("arrcomuni[99] = \"SAN PIETRO MUSSOLINO\"");eval('zone5[zone5.length] = 100');eval("arrcomuni[100] = \"SANTORSO\"");eval('zone2[zone2.length] = 102');eval("arrcomuni[102] = \"SARCEDO\"");eval('zone5[zone5.length] = 103');eval("arrcomuni[103] = \"SAREGO\"");eval('zone2[zone2.length] = 104');eval("arrcomuni[104] = \"SCHIAVON\"");eval('zone2[zone2.length] = 105');eval("arrcomuni[105] = \"SCHIO\"");eval('zone3[zone3.length] = 107');eval("arrcomuni[107] = \"SOSSANO\"");eval('zone5[zone5.length] = 108');eval("arrcomuni[108] = \"SOVIZZO\"");eval('zone2[zone2.length] = 110');eval("arrcomuni[110] = \"THIENE\"");eval('zone4[zone4.length] = 112');eval("arrcomuni[112] = \"TORRI DI QUARTESOLO\"");eval('zone2[zone2.length] = 113');eval("arrcomuni[113] = \"TRESCHE-CONCA\"");eval('zone2[zone2.length] = 115');eval("arrcomuni[115] = \"TRISSINO\"");eval('zone2[zone2.length] = 116');eval("arrcomuni[116] = \"VALDAGNO\"");eval('zone2[zone2.length] = 117');eval("arrcomuni[117] = \"VALDASTICO\"");eval('zone2[zone2.length] = 118');eval("arrcomuni[118] = \"VALLI DEL PASUBIO\"");eval('zone2[zone2.length] = 122');eval("arrcomuni[122] = \"VELO D'ASTICO\"");eval('zone1[zone1.length] = 123');eval("arrcomuni[123] = \"VICENZA\"");eval('zone3[zone3.length] = 124');eval("arrcomuni[124] = \"VILLAGA\"");eval('zone2[zone2.length] = 125');eval("arrcomuni[125] = \"VILLAVERLA\"");eval('zone2[zone2.length] = 126');eval("arrcomuni[126] = \"ZANE'\"");eval('zone5[zone5.length] = 127');eval("arrcomuni[127] = \"ZERMEGHEDO\"");eval('zone2[zone2.length] = 129');eval("arrcomuni[129] = \"ZUGLIANO\"");eval('zone7[zone7.length] = 130');eval("arrcomuni[130] = \"Non previsto\"");eval('zone8[zone8.length] = 131');eval("arrcomuni[131] = \"Non previsto\"");eval('zone1[zone1.length] = 132');eval("arrcomuni[132] = \"Vicenza San lazzaro\"");eval('zone1[zone1.length] = 133');eval("arrcomuni[133] = \"Vicenza San Felice\"");eval('zone1[zone1.length] = 134');eval("arrcomuni[134] = \"Vicenza San Pio X\"");eval('zone1[zone1.length] = 135');eval("arrcomuni[135] = \"Vicenza Zona Piscine\"");eval('zone1[zone1.length] = 136');eval("arrcomuni[136] = \"Vicenza Villaggio del Sole\"");eval('zone1[zone1.length] = 137');eval("arrcomuni[137] = \"Vicenza Ferrovieri\"");eval('zone1[zone1.length] = 138');eval("arrcomuni[138] = \"Vicenza Centro Storico\"");eval('zone1[zone1.length] = 139');eval("arrcomuni[139] = \"Vicenza Stanga\"");


function sprezzi (selez, tipoinselez) {

	// alert("selez = " + selez + "; tipoinserz = " + tipoinselez);
	
	if (selez == 0) {

		/*if (document.ricerca.rbprezzo[0].checked) {

			selez = document.ricerca.rbprezzo[0].value;
		} else {
			selez = document.ricerca.rbprezzo[1].value;

		}*/

		// alert("selez if = 0  " + selez);

	}
	for (i=document.ricerca.comboprezzo.length; i>=0; --i) {

		document.ricerca.comboprezzo.options[i] = null;
	}

	
	
	    if ((tipoinselez == 1) || (tipoinselez == 3)) {	
		for (i=0;i < indiceprezzi.length; ++i) {
			nopt = new Option();
			nopt.value = indiceprezzi[i];
			nopt.text = prezzieuro[i];
			document.ricerca.comboprezzo.options[i] = nopt;
		}
	     } else {

		for (i=0;i < indiceaffitti.length; ++i) {

			nopt = new Option();
			nopt.value = indiceaffitti[i];
			nopt.text = affittieuro[i];
			document.ricerca.comboprezzo.options[i] = nopt;
		}
	     }
		
	
}
/* function sprezzi (selez) {

	
	if (selez == "euro") {
		
		for (i=0;i < document.ricerca.comboprezzo.length; ++i) {
			
			document.ricerca.comboprezzo.options[i].text = prezzieuro[i];
		}
		
	}

	if (selez == "lire") {
		
		for (i=0;i < document.ricerca.comboprezzo.length; ++i) {
			
			document.ricerca.comboprezzo.options[i].text = prezzilire[i];
		}
		
	}
} */


function test_value (oggetto) {

	if (oggetto.checked) {
        
		nopzioni = eval(oggetto.name + '.length');
		for (i = 0; i < nopzioni; ++i) {
			opzione = eval(oggetto.name + '[' + i + ']');
			//alert(opzione);
			eval('document.ricerca.' + opzione + '.disabled = false');
		}
		// alert("n opzioni = " + nopzioni);
		// alert("selezionato");
	} else {
		nopzioni = eval(oggetto.name + '.length');
		for (i = 0; i < nopzioni; ++i) {
			opzione = eval(oggetto.name + '[' + i + ']');
			eval('document.ricerca.' + opzione + '.disabled = true');
		}

	//	alert("deselezzionato");
	}
        if (oggetto.name=="cbprezzo") {
                  document.ricerca.cbtipoins.checked=true;
                  document.ricerca.combotipoins.disabled=false;
                }
}
function test_value2 (oggetto2) {
        alert(oggetto2.checked);
	if (oggetto2.checked) {
                nopzioni = eval(oggetto2.name + '.length');
		for (i = 0; i < nopzioni; ++i) {
			opzione = eval(oggetto2.name + '[' + i + ']');
			//alert(opzione);
			eval('document.ricerca.' + opzione + '.disabled = false');
		}
		// alert("n opzioni = " + nopzioni);
		 alert("selezionato");
	} else {
		nopzioni = eval(oggetto2.name + '.length');
		for (i = 0; i < nopzioni; ++i) {
			opzione = eval(oggetto2.name + '[' + i + ']');
			eval('document.ricerca.' + opzione + '.disabled = true');
		}

	//	alert("deselezzionato");
	}
}

function aggiorna_comuni (indicezona) {

	//alert("indice = " + indicezona);
	var maxidcom = document.ricerca.combocomuni.length;
	//alert("max id com = " +maxidcom);
	for (ic = maxidcom - 1; ic >=0; --ic) {


		document.ricerca.combocomuni.options[ic] = null;
	}

	//alert("dopo = " + document.ricerca.combocomuni.length);
	var maxzone = eval("zone"+indicezona+".length");
	//alert("comuni per zona "+indicezona+" = "+maxzone);
	for (ic = 0; ic < maxzone; ++ic) {

		var newopt = new Option();
		//alert("iterazione = " +ic);
		var newidx = eval("zone"+indicezona+"["+ic+"]");
		newopt.value = newidx;
		newopt.text = eval("arrcomuni["+newidx+"]");
		
		document.ricerca.combocomuni.options[ic] = newopt;

	}

}
