function chiudi_box(div){
	elem = document.getElementById(div);
	elem.style.display = 'none';
}
	
function show_box(div){
	elem = document.getElementById(div);
	elem.style.display = 'block';
}

function apri_commento_form(ag_id, articolo_id, commento_id) {
	
	http.open('get', 'ajax/apri_commento_form.php?articolo_id='+articolo_id+'&commento_id='+commento_id+'&ag_id='+ag_id);
	http.onreadystatechange = handleResponse1;
	http.send(null);
}

function apri_commento_segnala(articolo_id,commento_id) {
	
	http.open('get', '/ajax/apri_commento_segnala.php?articolo_id='+articolo_id+'&commento_id='+commento_id);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function chiudi_box(div){
	elem = document.getElementById(div);
	elem.style.display = 'none';
}

function apri_box(div){
	elem = document.getElementById(div);
	elem.style.display = 'block';
}
function chiudi_segnala(div){
	elem = document.getElementById(div);
	elem.style.display = 'none';
}

function apri_segnala(div){
	elem = document.getElementById(div);
	elem.style.display = 'block';
}

function mod_opz(opz,articolo_id){
	http.open('get', '/ajax/mod_opz.php?articolo_id='+articolo_id+'&opz_id='+opz+'&view=block');
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function proponi_argomento(articolo_id) {
	var tag;
	var id_input = document.getElementById('input_tag');
	tag = id_input.value;
	if (tag) {
		http.open('get', '/ajax/proponi_argomento.php?articolo_id='+articolo_id+'&tag='+tag);
		http.onreadystatechange = handleResponse;
		http.send(null);
	}
}
	
function vota_articolo(articolo_id,template) {
	var voto, valore;
	for(var i=1;i<6;i++){
		var id_input = document.getElementById('inputVoto_'+i);
		if(id_input.checked){
			valore = id_input.value;
		}
	}
	voto = document.getElementById('inputVoto_'+valore).value;
	http.open('get', '/ajax/vota_articolo.php?articolo_id='+articolo_id+'&voto='+voto+'&template='+template);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function modera_commento(commento_id, stato){
	http.open('get', '/ajax/modera_commento.php?commento_id='+commento_id+'&stato='+stato);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function approva_articolo(articolo_id, modera, giornale_id){
	http.open('get', '/ajax/approva_articolo.php?articolo_id='+articolo_id+'&modera='+modera+'&giornale_id='+giornale_id);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function apri_commento_edit(ag_id, articolo_id, commento_id) {
	
	http.open('get', '/ajax/apri_commento_edit.php?articolo_id='+articolo_id+'&commento_id='+commento_id+'&ag_id='+ag_id);
	http.onreadystatechange = handleResponse1;
	http.send(null);
}

function chiudi_edita(div){
	elem = document.getElementById(div);
	elem.style.display = 'none';
}

function apri_edita(div){
	elem = document.getElementById(div);
	elem.style.display = 'block';
}

//text-editor nei commenti
 /*$(function(){ 
	$.fck.config = {path: 'components/fckeditor/', height:300, width: 500 };
	$('textarea.fck').fck({path: 'components/fckeditor/', toolbar:'Default'}); }
	
	);
*/
function evidenzia_commento(commento_id, stato){
	http.open('get', '/ajax/evidenzia_commento.php?commento_id='+commento_id+'&stato='+stato);
	http.onreadystatechange = handleResponse;
	http.send(null);
}
function dettaglioLetture(ag_id) {
	http.open('get', '/ajax/dettaglio_letture.php?ag_id='+ag_id);
	http.onreadystatechange = handleResponseAlert;
	http.send(null);
}
