function prova(){
 	var nino;
	nino = $('#sel_tipologia').text();
	alert(nino);
}
function altre_zone(){
    $('#zone_div').attr("class", "zone_vis");
}
function altre_zone_close(){
    $('#zone_div').attr("class", "zone_altro");
}

function carica_dati(ogg,tt){
    var ajax_carica;
	var val_data;
	var valore = ogg.value;
	var nome = ogg.name;
    //ajax_carica = $('#txt_carica').html();
	switch(nome){
        case "ca":
            if(valore !=0 && valore != -1){
                val_data ="t=3&c=tip&v=" + ogg.value;
            }else{
                $("#sel_tipologia").html('');
                return true;
            }
			
        break;
		case "r":
			if(valore != 0 && valore != -1){
				val_data = "t=3&c=pro&tt=" + tt + "&v=" + ogg.value;
			}else{
                $("#sel_provincia").html('');
                $("#sel_comune").html('');
				return true;
			}
		break;
		case "p":
			if(valore != 0 && valore != -1){
				val_data = "t=3&c=com&tt=" + tt + "&v=" + valore + "&o=";
				if($('#sel_regione').val() == null){
					val_data += "-1";
				}else{
					val_data += $('#sel_regione').val();
				}
			}else{
                $("#sel_comune").html('');
				return true;
			}
		break;
	}
	valore = ogg.value;
    //$('#txt_carica').html('<img src="./image/ajax.gif" />Sto caricando i dati...');
    $.ajax({
		type: "GET",
		url: "ajax.php",
		data: val_data,
		cache: false,
		success: function(msg){
		 	//$('#txt_carica').html(ajax_carica);
            switch(nome){
                case "ca":
                    $('#sel_tipologia').html(msg);
                break;
				case "r":
					$('#sel_provincia').html(msg);
					$('#sel_comune').html('');
					
				break;
				case "p":
					$('#sel_comune').html(msg);
					
				break;
			}
			return true;
		},
		error: function(a,b,c){
            //$('#txt_carica').html(ajax_carica);
			alert("Si e' verificato un errore nel caricamento dei dati");
		}
	});
	return true;
}
