function drawCommentList(wh, id, displayObj){
	$(displayObj).load("/music/comment.ajax.php?wh="+wh+"&id="+id);
}

$(function(){
	// post comment
	$("#postComment").ajaxForm({
		beforeSubmit : function(a,f,o) {
			o.dataType = 'json';
			o.clearForm = true;
			if(!$("#postComment #body").val()) {
				$("#postComment #body").focus();
				$.jGrowl("댓글 내용을 입력하세요.");
				return false;
			};
			$("#postComment #btnCommentSubmit").attr("disabled","disabled");
		},
		success: function(data) {
			var wh = $("#postComment input[name='wh']").val();
			var id = $("#postComment input[name='id']").val();
			$("#postComment #btnCommentSubmit").removeAttr("disabled");
			var msg = new Message(data);
			msg.print();
			if(msg.isSuccess) {
				drawCommentList(wh,id, $("#comment_list"));
				$(".ajax_comment_num").html(parseInt($(".ajax_comment_num").html())+1);
				$(".ajax_comment_num").parent().effect("highlight", { color: '#ff0000'}, 2000);
				$.jGrowl("댓글을 등록하였습니다.");
			}
			else {
				return false;
			}
		}
	});
});
