﻿/*************************************************************/
/*	ajax_comment.js		>		comment_form.tpl				*/
/*	- Comment system										*/
/*													*/
/*************************************************************/

//Add a comment
function post_comment(id_event,type)
{
	var check = wu_check_login;
	var name = document.getElementById('com_name').value;
	var text = document.getElementById('com_text').value;
	if ((name == '') || (check.exec(name) == null)){
		document.getElementById('info_com').innerHTML = wu_name;
		return;
	}
	if (text == ''){
		document.getElementById('info_com').innerHTML = wu_text_comment;
		return;
	}
	ajax_send('form_com','../db/comment_db.php','action=add&id_event='+id_event+'&name='+escape(name)+'&text='+escape(text)+'&type='+type);
}

//Show last 5 comments
function show5(id,type)
{
	document.getElementById('all_com').innerHTML = "";
	ajax_send('last5_com','../db/comment_db.php','action=print_last5&id_event='+id+'&type='+type);
}

//Show all comments
function showAll(id,type)
{
	document.getElementById('last5_com').innerHTML = "";
	ajax_send('all_com','../db/comment_db.php','action=print_all&id_event='+id+'&type='+type);
}

//Hide comments
function hideComments()
{
	document.getElementById('last5_com').innerHTML = "";
	document.getElementById('all_com').innerHTML = "";
}

