 

function chg_language(codLingua){

	 var url_ajax_interface = 'php/02_client_ajax_interface.php';
	 var i, voce;
	 
     $.ajax({
       url: url_ajax_interface +'?operazione=READ_LINGUE_MENU&cod_lingua=' + codLingua ,
       cache: false,
       success: function(html){     
	            				
				var oJSON_array = eval("(" + html + ")");
				
				for (var i = 0; i<oJSON_array.length; i++){
					 id = '#' + oJSON_array[i]['id_menu'];
					 voce =oJSON_array[i]['voce'];
					 $(id).html(voce);
					 $(id).attr('class',codLingua.toLowerCase());
	            }
				/*$("#id_menu").val(oJSON_array['id_menu']);
				$("#id_sezione").val(oJSON_array['id_sezione']);
				$("#id_contenuto").val(oJSON_array['id_contenuto']);
				//$("#id_lingua").val(oJSON_array['id_lingua']);
				$("#titolo").val(oJSON_array['titolo']);
				$("#ordine").val(oJSON_array['ordine']);
				
				if (oJSON_array['attivo'] == '1'){
					$("#attivo").attr("checked", "checked");
				}
				else{
					$("#attivo").removeAttr("checked");
				}
				$("#data_ins").val(oJSON_array['data_ins']);	
				$("#data_um").val(oJSON_array['data_um']);*/
				
       }
     });
 
}

function set_language_item(id){

     $("#fullresponse").html("");
	 
     if (id == ''){
		 alert('ID non valido!');
		 return;
	 }

	 
	 if ($("#ita_" + id).val() ==''){
		 alert('Attenzione, valore "italiano" non puņ essere vuoto!');
		 return;
	 }
	 
     var oJSON = {};
	 var url_ajax_interface = '02_client_ajax_interface.php';
	 var i, voce;
	 
	 var ita_id = 'ita_' + id;
	 var eng_id = 'eng_' + id;
	  
	 oJSON['id'] = id;
	 oJSON['voice'] = $("#" + ita_id).val();
	 oJSON['voice_eng'] = $("#" + eng_id).val();

	 var dataString = JSON.stringify(oJSON);

	 $.post(url_ajax_interface, {CONTENT_DATA: dataString, operazione: 'SET_LANGUAGE_ITEM'}, showResult, "text"); 
 
}


function showResult(res){
     $("#fullresponse").html("DB response: " +res);
}


