
// ------------------------------------------------------------------------------------------ toggle blog comment view

$(".comments-toggle").live('click', function() {
	if ( $("#comments" + this.id).is(":visible") ) {
		$("#" + this.id).removeClass("hide");
		$("#comments" + this.id).hide();
		//$(".comments").hide();
	}
	else {
		//$(".comments").hide();
		$("#" + this.id).addClass("hide");
		$("#comments" + this.id).show();
	}
	
	return false;
});


// ------------------------------------------------------------------------------------------ post blog comment form

$(".comment").submit(function() {
															
	var feedback = "#cinfo" + this.id + "";		
	$(feedback).show();
	$(this.id).hide();
	$(feedback).html("adding Comment...");
	// subscribe form contents
	$.post("../../handlers/add-comment.php", {
			cache 		: false,
			name			: $("#" + this.id + ' input[name=name]').val(),	
			email			: $("#" + this.id + ' input[name=email]').val(),	
			comment 	: $("#" + this.id + ' textarea[name=comment]').val(),	
			id				: $("#" + this.id + ' input[name=blog]').val(),
			subscribe	: $("#" + this.id + ' input[name=subscribe]').val()
		},
		function(data) {
			$(feedback).html(data);
		}
		
	);
	return false;
});
