var outputDivId     = 'comment_posted';
var outputProgress  = 'progress';
var url_comment_cgi = 'http://●●●/mt/mt-comments.cgi';

function ajax_comment_post(divId, divProgress)
{
    outputDivId    = divId;
    outputProgress = divProgress;

    document.getElementById(outputDivId).style.display    = 'none';
    document.getElementById(outputProgress).style.display = '';

    var pars   = Form.serialize('comments_form')+'&post=post';
    var myAjax = new Ajax.Updater(outputDivId, url_comment_cgi, { 
                                                    method: 'post', 
                                                    parameters: pars,
                                                    onComplete: ajax_comment_complete
                                                    }); 
    return false;
}

function ajax_comment_preview(divId, divProgress)
{
    outputDivId    = divId;
    outputProgress = divProgress;

    document.getElementById(outputDivId).style.display    = 'none';
    document.getElementById(outputProgress).style.display = '';

    var pars   = Form.serialize('comments_form')+'&preview=preview';
    var myAjax = new Ajax.Updater(outputDivId, url_comment_cgi, {
                                                    method: 'post',
                                                    parameters: pars,
                                                    onComplete: ajax_comment_complete
                                                    }); 
    return false;
}

function ajax_comment_complete()
{
    new Effect.Appear(outputDivId, { duration:3.0, queue:'end' } );
    document.getElementById(outputProgress).style.display = 'none';
    /* - 2007.05.19 -
     * 上記エフェクト(Effect.Appear)を使用する場合、セクションを表示してしまうと、
     * チラッと一瞬見えてしまうので、意図的にコメントにしています。
     *
    document.getElementById(outputDivId).style.display = '';
     */
}

function ajax_comment_url(cgi)
{
    url_comment_cgi = cgi;
}
