$(document).ready(function() {

});

function submit_comment()
{
	if($("#comment_body").val().replace(/^\s+|\s+$/g,"").length<1)
	{
		//$("#comment_form_msg").html("<img src='/images/common/n_ng.gif'	/> your	review should be at least 30 characters	long.");
		return false;
	} else
	{
		if($("#member_logged_in").val()=="yes")
		{
			save_comment();
		} else
		{
			show_login_dialog("save_comment");
		}
	}
	return false;
}

function save_comment()
{
	$("#comment_form_msg").html("");
	$.ajax({
		type: "POST",
		url: "/common/comment/ajax/",
		data: {
			comment_body: $("#comment_body").val(),
			parent_id: $("#comment_parent_id").val(),
			parent_type: $("#comment_parent_type").val(),
			bucket_id: $("#comment_bucket_id").val(),
			request_type: "save_comment"
		},
		beforeSend: function(){
			$("#comment_form_msg").html('<img src="/images/common/loading.gif" /> Loading');
		},
		success: function(xml){
			$("#comment_body").val("");
			$("#comment_list").html(xml);
		}
	});
}
