/* JavaScript Document
* Author	 	: D.CAMUS - NODEVO
* Created		: 18/08/2008
* Component		: nodevo_blog 
* Version		: 1.0
* Compatibility : Joomla 1.5
* Last updates 	:
*
*
*
**/

function showHide(id) {	
	displayed = document.getElementById(id).style.display;		
	document.getElementById(id).style.display = (displayed == "none") ? "":"none";
}

// sauvegarde d'un commentaire (ajax)
function saveComment(id) {
	comment = document.getElementById('txtCommentBillet' + id).value;	
	executerService('./components/com_nodevo_blog/nodevo_blog.ajax.php','action=saveComment&idBill=' + id +'&txtComment=' + comment,refreshComments);	
	closeDialogComment(id);
}

function refreshComments(str) {
	var tbRes = str.split("|");
	if (tbRes[0] == "ERR") alert("ERROR : \n"+tbRes[1]);
	else {
		
		showHide('txtCommentaire_Billet' + tbRes[1]);
		document.getElementById('txtCommentBillet' + tbRes[1]).value = "";
		document.getElementById('listcomments_bill' + tbRes[1]).innerHTML = tbRes[2];
	}
}

// DCA 21.04.2009
//affiche la fenetre modale de saisie de commentaire pour un billet

function initDialogComment(id) {
	$("#dialog"+id).dialog({
			bgiframe: true,
			height: 180,
			width: 500,
			modal: true,
			autoOpen: false,
			resizable: false
		});
}

function openDialogComment(id) {	
	$("#dialog"+id).dialog('open');
}


function closeDialogComment(id) {	
	$("#dialog"+id).dialog('close');	
}