// JavaScript Document


function showCommentForm(){
	
	$('#comment_fields').slideToggle('fast', function() {
   
  	});
	
}

function addComment(){
	
	var articleid = $('#pageid').val() ;
	var author = escape($('#author').val()) ;
	var comment = escape($('#comment').val()) ;
	var captcha = escape($('#captcha_code').val()) ;
	
	var url = fullURL + '/inc/inc_articlefunctions.php?action=addcomment';
	var postBody = "pageid=" + articleid ;
		postBody += "&author=" + author ;
		postBody += "&comment=" + comment ;
		postBody += "&captcha_code=" + captcha ;		
		
		$.ajax({
			  url: url,
			  type: 'POST',
			  data: postBody,
			  success: function(responseText){
				  
				  	$('#commentsholder').html(responseText) ;
					//$('#commentadded').show() ;
					$('#author').val('');
					$('#comment').val('') ;
					//setTimeout($('#commentadded').fadeOut('slow', function() {}),5000) ;
					$('#comment_fields').slideToggle('slow', function() {
  					});
			  }
			});
		
	
}

function deleteComment(commentid){
	
	url = fullURL + '/inc/inc_articlefunctions.php' ;
	var postBody = "action=deletecomment&commentid=" + commentid ;
	
	$.ajax({
			  url: url,
			  type: 'POST',
			  data: postBody,
			  success: function(responseText){	  
			  		$('#comment_' + commentid).fadeOut('slow', function() {}) ;
			  }
			});
	
}
