function addComment(form, image_id, member_id)
{
    if ('' == form.comment.value) {
        alert(error_msgs.comment_text);
        form.comment.focus();
        return false;
    }

    if ('' == form.name.value) {
        alert(error_msgs.specify_name);
        form.name.focus();
        return false;
    }

    if ('' == form.email.value || false == isValidEmail(form.email.value)) {
        alert(error_msgs.email_mand);
        form.email.focus();
        return false;
    }
	
	var comment_id = '';
	
	if (!form.down('#parent'))
	{
		comment_id = null;
		if(typeof(_gaq) !== "undefined")
		{
			_gaq.push(['_trackEvent', 'Add Comment', 'Image Comment']);
		}
	}
	else
	{
		comment_id = form.down('#parent').readAttribute('value');
		if(typeof(_gaq) !== "undefined")
		{
			_gaq.push(['_trackEvent', 'Add Comment', 'Image Reply']);
		}
	}

   	xajax_addComment(image_id,
					 form.name.value,
					 form.email.value,
					 form.comment.value,
					 comment_id,
					 member_id);
	
	if(!member_id)
	{
		form.name.value = form.email.value = '';
	}
	
	form.comment.value = '';
	
	return false;
}


