		function cambiaindagine() {
			var tipolauanno = leggiRadio(document.scheda.corstipo_anno);

			document.scheda.ateneo.selectedIndex=0;
			document.scheda.facolta.selectedIndex=0;
			document.scheda.gruppo.selectedIndex=0;
			if (document.scheda.postcorso) document.scheda.postcorso.selectedIndex=0;
			if (document.scheda.classe) document.scheda.classe.selectedIndex=0;
			if (document.scheda.corso) document.scheda.corso.selectedIndex=0;
			
			resubmit(false);
		}
		
		function resubmit(start) 
		{
			var url = "";
			var config = "occupazione";
			if (document.scheda.CONFIG.value!="") config=document.scheda.CONFIG.value;
				
			if (start) {
				url += "LANG=";
				url += "&CONFIG=";			
			}	else {	
				if(config == "occupazione") {				
					tipolauanno = leggiRadio(document.scheda.corstipo_anno);

					tipolauanno2 = tipolauanno;
					arrTipoLauAnno = tipolauanno.split("/");

					annolau2 = arrTipoLauAnno[1];
					corstipo2 = arrTipoLauAnno[0];
				} else {
					annolau2="";
					corstipo2 = leggiCampo(document.scheda.corstipo);
				}
				
				url += "anno=" + document.scheda.anno.value;
				url += "&corstipo=" + corstipo2;
				url += "&ateneo=" + leggiCombo(document.scheda.ateneo);
				url += "&facolta=" + leggiCombo(document.scheda.facolta);
				url += "&gruppo=" + leggiCombo(document.scheda.gruppo);
				if (document.scheda.pa) url += "&pa=" + (document.scheda.pa.value);
				
				if (document.scheda.classe) url += "&classe=" + leggiCombo(document.scheda.classe);
				if (document.scheda.corso) url += "&corso=" + leggiCombo(document.scheda.corso);
				if (document.scheda.postcorso) url += "&postcorso=" + leggiCombo(document.scheda.postcorso);
				if (annolau2 != "") url += "&annolau=" + annolau2;

				if (document.scheda.areageografica) url += "&areageografica=" + leggiCombo(document.scheda.areageografica);
				if (document.scheda.regione) url += "&regione=" + leggiCombo(document.scheda.regione);
	
				url += "&disaggregazione=" + leggiCampo(document.scheda.disaggregazione);
				url += "&LANG=" + document.scheda.LANG.value;
				url += "&CONFIG=" + document.scheda.CONFIG.value;
			}
			
			$("#tendine").fadeTo("slow",0.33);
			$("#tendine").load("solotendine.php?"+url);
			$("#tendine").fadeTo("fast",1.0);
			

			
		}

		function leggiCombo(campo) 
		{
			return campo.options[campo.selectedIndex].value;
		}

		function leggiRadio(campo) {
		
			for (i=0;i<campo.length;i++)
				if (campo[i].checked) return campo[i].value;
		
			return "";
		}
		
		function leggiCampo(campo) {
			var tipo;
			if (!campo.type) tipo = campo[0].type;
			else tipo = campo.type;
			
			switch(tipo) {
				case "radio": return leggiRadio(campo);
				case "select": return leggiCombo(campo);
				default: return campo.value;
			}
		}

		
		function scriviRadio(campo,valore) {
			for (i=0;i<campo.length;i++) {
				campo[i].checked=false;
				if (campo[i].value == valore) {campo[i].checked=true;}
			}
		}
		
		function visualizza() 
		{
			var anno=(leggiCombo(document.scheda.anno));
			var config = document.scheda.CONFIG.value;
			
			var tipolauanno = "";
			var arrTipoLauAnno = "";
			var annolau = "";
			var corstipo = "";
			
			if(config == "occupazione") {
			
				tipolauanno = leggiRadio(document.scheda.corstipo_anno);
				arrTipoLauAnno = tipolauanno.split("/");
				
				annolau = arrTipoLauAnno[1];
				corstipo = arrTipoLauAnno[0];
			} else {
				corstipo = leggiCampo(document.scheda.corstipo);
			}
			
			var url = "framescheda.php?";

			url += "anno=" + document.scheda.anno.value;
			url += "&corstipo=" + corstipo;
			url += "&ateneo=" + leggiCombo(document.scheda.ateneo);
			url += "&facolta=" + leggiCombo(document.scheda.facolta);
			url += "&gruppo=" + leggiCombo(document.scheda.gruppo);
			if (document.scheda.pa) url += "&pa=" + document.scheda.pa.value;

			if (document.scheda.classe) url += "&classe=" + leggiCombo(document.scheda.classe);
			if (document.scheda.corso) url += "&corso=" + leggiCombo(document.scheda.corso);
			if (document.scheda.postcorso) url += "&postcorso=" + leggiCombo(document.scheda.postcorso);
			
			if(config == "occupazione") {
				if (document.scheda.corstipo_anno) url += "&annolau=" + annolau;
				
				if(anno > 2008) {
					if (document.scheda.areageografica) url += "&areageografica=" + leggiCombo(document.scheda.areageografica);
					if (document.scheda.regione) url += "&regione=" + leggiCombo(document.scheda.regione);
				}
			 }

			if (document.scheda.disaggregazione) url += "&disaggregazione=" + leggiCampo(document.scheda.disaggregazione);
			url += "&LANG=" + document.scheda.LANG.value;
			url += "&CONFIG=" + document.scheda.CONFIG.value;

			top.document.location.href=(url);
		}



		function visualizzasintesi() 
		{
			var url = "sintesi.php?";

			url += "anno=" + document.scheda.anno.value;
			url += "&corstipo=" + leggiCombo(document.scheda.corstipo);
			url += "&ateneo=" + leggiCombo(document.scheda.ateneo);
			url += "&facolta=" + leggiCombo(document.scheda.facolta);
			url += "&gruppo=" + leggiCombo(document.scheda.gruppo);

			if (document.scheda.classe) url += "&classe=" + leggiCombo(document.scheda.classe);
			if (document.scheda.corso) url += "&corso=" + leggiCombo(document.scheda.corso);
			if (document.scheda.postcorso) url += "&postcorso=" + leggiCombo(document.scheda.postcorso);
			if (document.scheda.annolau) url += "&annolau=" + leggiCombo(document.scheda.annolau);

			url += "&disaggregazione=" + leggiCombo(document.scheda.disaggregazione);
			url += "&LANG=" + document.scheda.LANG.value;
			url += "&CONFIG=" + document.scheda.CONFIG.value;

			$("#sintesiprofilo").load(url+"&CONFIG=profilo");
			$("#sintesioccupazione").load(url+"&CONFIG=occupazione");
		}
		

		function cambiaAnno(annomin) {
			var anno=(leggiCombo(document.scheda.anno));
			var config = document.scheda.CONFIG.value;

			if (anno < annomin) {
				var sanno = anno.substr(2);
				top.location.href="/universita/"+document.scheda.CONFIG.value+"/documentazione.shtml";
			} else {
				if (config=='profilo')
					scriviRadio(document.scheda.corstipo,"tutti");
				else
					scriviRadio(document.scheda.corstipo_anno,"TUTTI/1");
				document.scheda.ateneo.selectedIndex=0;
				document.scheda.facolta.selectedIndex=0;
				document.scheda.gruppo.selectedIndex=0;

				if (document.scheda.postcorso) document.scheda.postcorso.selectedIndex=0;
				if (document.scheda.classe) document.scheda.classe.selectedIndex=0;
				if (document.scheda.corso) document.scheda.corso.selectedIndex=0;

				
				resubmit(false);
				//document.location.href="tendine.php?anno="+anno+"&LANG="+document.scheda.LANG.value+"&CONFIG=<?= $config ?>";
			}
		}


