

// Pulldown menų dinamici

var scegli = new Array("-------");
var internet_motori_lavoro = new Array("--scegli motore lavoro","infojobs","jobrapido","trovalavoro/corriere","monster","altri motori");
var internet = new Array("--scegli canale internet","ricerca in google","navigazione siti internet");
var altro = new Array("--specifica altro","stampa","passaparola","Consulenti per Viaggiare","fiere");
var articolo_Sole_24ore = new Array("-------");

function swapOptions(the_array_name)
{
        var numbers_select = window.document.f_mail.dadove2;
        var the_array = eval(the_array_name);
        setOptionText(window.document.f_mail.dadove2,the_array);


	  document.getElementById("dadove2").style.background="#ffffff";
	  document.f_mail.dadove2.disabled=false;

		if ((the_array_name == "scegli")|(the_array_name == "articolo_Sole_24ore")) {
		  document.getElementById("dadove2").style.background="#a0a0a0";
	        document.f_mail.dadove2.disabled=true;
		}
        document.f_mail.dadove3.value="-------";
        document.f_mail.dadove3.disabled=true;
	  document.getElementById("dadove3").style.background="#a0a0a0";
	  document.getElementById("dadove3").style.color="#006BB1";
}














function setOptionText(the_select, the_array){
var elemCorrente = "";
the_select.length=the_array.length;
        for (c=0; c < the_array.length; c++){
//
// Problema: se in tendina2 si seleziona il 2° elemento (per esempio "infojobs" se in tendina 1 č stato scelto il ramo "motori_lavoro") e poi si cambia
// scelta in tendina1 (per es si sceglie il ramo "altro"), succede che in tendina2 vengono visualizzate le scelte di "altro" ma rimane selezionato
// il secondo elemento del ramo "altro" (nel nostro esempio: "stampa"). Io invece voglio che quando cambio valore in tendina1, nella tendina2 venga
// visualizzato sempre il primo elemento del ramo scelto. 
// -----------------------------------------------------------------------------------------------------------
// Per cui se c=0 (quindi se siamo sulla prima scelta) sfrutto la sintassi:
//         elemCorrente = new Option(optionText, optionValue, defaultSelected, selected)
//                         dove: optiontext=testo visualizzato nella pagina - optionvalue=testo inviato al server dopo il submit
//         document.nomeform.nomedelselect[indice] = elemCorrente
//                         dove: elemCorrente č un array che ho definito la riga sopra
// -----------------------------------------------------------------------------------------------------------
// Se invece c > 0 allora posso sfruttare la sintassi pių semplice:
//         document.nomeform.nomedelselect.options[indice].text = elemcorrente
//                         dove: elemCorrente č una semplice stringa
//
			if (c == 0){
			elemCorrente = new Option(the_array[c], the_array[c], true, true);
			the_select[c] = elemCorrente;
			}else{
			elemCorrente = the_array[c];
			the_select.options[c].text = elemCorrente;
			}
        }
}












function decision_dadove3(secondfield){

	var casistiche = 0;

	if (secondfield == "altri motori"){
        document.f_mail.dadove3.value="scrivi il nome del motore lavoro";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}

	if (secondfield == "ricerca in google"){
        document.f_mail.dadove3.value="scrivi le parole chiave usate";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}

	if (secondfield == "navigazione siti internet"){
        document.f_mail.dadove3.value="scrivi il sito di provenienza";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}

	if (secondfield == "stampa"){
        document.f_mail.dadove3.value="scrivi nome rivista/giornale";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}

	if (secondfield == "Consulenti per Viaggiare"){
        document.f_mail.dadove3.value="scrivi nome del Consulente";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}

	if (secondfield == "fiere"){
        document.f_mail.dadove3.value="scrivi nome della fiera";
        document.f_mail.dadove3.disabled=false;
	  document.getElementById("dadove3").style.background="#ffffff";
	  document.getElementById("dadove3").style.color="#ff4040";
	  casistiche = 1;
	}


	if (casistiche == 0){
        document.f_mail.dadove3.value="-------";
        document.f_mail.dadove3.disabled=true;
	  document.getElementById("dadove3").style.background="#a0a0a0";
	  document.getElementById("dadove3").style.color="#006BB1";
	}
}



function canc_dadove3(){
document.f_mail.dadove3.value="";
document.getElementById("dadove3").style.color="#006BB1";
}























