function comment(event) {
   http.open('get','include/comment.php?id=' + event + '&comment=' + document.getElementById("new_comment").value);
   http.onreadystatechange = handleComment;
   http.send(null);
}

function delete_comment(event,comment) {
   http.open('get','include/comment.php?id=' + event +'&delete=' + comment);
   http.onreadystatechange = handleComment;
   http.send(null);
}

function handleComment() {
   if(http.readyState == 4){

      // Text returned FROM the PHP script
      var response = http.responseText;
      if(response) {
	//	 response = response.replace(/<.*?>/g, '');
	//	 response = response.replace(/\+/g, '<br>');
         // UPDATE ajax content
		 var re = new Array();
		 re	= response.split("|");

		 if(re[0]!='') document.getElementById("comments_error").innerHTML = "Error! " + re[0];
		 if(re.length>1) document.getElementById("comments").innerHTML = re[1];
      }
   }
}

function enter(e,id){
	var charCode = (e.which) ? e.which : window.event.keyCode; 
	if (!e.ctrlKey && !e.shiftKey && !e.altKey && charCode == 13){ 
		comment(id);
	}		
}