/* ./js/comments.js */
function comSubmit(calling_page){
	var text = document.getElementsByName("com_content")[0].value;
	var profile_id = document.getElementsByName("com_profile_id")[0].getAttribute("value");
	var user_id = document.getElementsByName("com_user_id")[0].getAttribute("value");
	postString = "calling_page=" + calling_page + "&action=add&profile_id=" + profile_id + "&user_id=" + user_id + "&content=" + fixPlus(text);
	request("./interfaces/addComment.php", addCommentHandle, postString);
}
function comDelete(com_id, calling_page){
	var profile_id = document.getElementsByName("com_profile_id")[0].getAttribute("value");	
	var user_id = document.getElementsByName("com_user_id")[0].getAttribute("value");
	postString = "calling_page=" + calling_page + "&action=delete&com_id=" + com_id + "&profile_id=" + profile_id + "&user_id=" + user_id;
	request("./interfaces/addComment.php", addCommentHandle, postString);
}
function comValidate(){
	if(document.getElementsByName("com_content")[0].value.length){
		document.getElementById("com_submit_div").style.display = "inline";
	}else{
		document.getElementById("com_submit_div").style.display = "none";
	}
}
function addCommentHandle(){
	text = request.text;
	document.getElementById("profile_comments_div").innerHTML = text;
}
function showComForm(){
	div = document.getElementById("com_form_div");
	if(div.style.display == 'none'){
		div.style.display = '';
	}else{
		div.style.display = 'none';
	}
}
function comCancel(){
	document.getElementById("com_form_div").style.display = 'none';
}
