function check2string( value )
{
    if ( value )
    {
        return 'yes';
    }
    else
    {
        return 'no';
    }
}

function xml_ajax_quickreply( form, effects )
{
    //-----------------------------------------
    // INIT objects for POST communication
    //-----------------------------------------
        
    var url        = ipb_var_base_url;

    //----------------------------------
    // Var holding all postdata escaped
    //----------------------------------

    var post    = 'act=' + encodeURIComponent( form.act.value ) + '&CODE=' + encodeURIComponent( form.CODE.value ) + '&Post=' + encodeURIComponent( form.Post.value ) + '&auth_key=' + encodeURIComponent( form.auth_key.value ) + '&f=' + encodeURIComponent( form.f.value ) + '&t=' + encodeURIComponent( form.t.value ) + '&st=' + encodeURIComponent( form.st.value ) + '&fast_reply_used=' + encodeURIComponent( form.fast_reply_used.value ) + '&enabletrack=' + encodeURIComponent( check2string( form.enabletrack.checked ) ) + '&enableemo=' + encodeURIComponent( check2string( form.enableemo.checked ) ) + '&enablesig=' + encodeURIComponent( check2string( form.enablesig.checked ) );

    /*--------------------------------------------*/
    // Main function to do on request
    // Must be defined first!!
    /*--------------------------------------------*/
    
    do_request_function = function()
    {
        //----------------------------------
        // Ignore unless we're ready to go
        //----------------------------------
        
        if ( ! xmlobj.readystate_ready_and_ok() )
        {
            xmlobj.show_loading();
            return;
        }

        //----------------------------------
        // Got response
        //----------------------------------

        xmlobj.hide_loading();

        //----------------------------------
        // Error returned? Show + scroll
        //----------------------------------

        if ( ! xmlobj.xmlhandler.responseText.match( 'postdetails' ) )
        {
            document.body.innerHTML = xmlobj.xmlhandler.responseText;
            scroll(0, 0);
            return false;
        }
        
        //----------------------------------
        // INIT
        //----------------------------------

        var anchors            = new Array;
        var reply            = document.createElement( 'div' );
        var documentDIVs    = document.getElementsByTagName( 'div' );

        //----------------------------------
        // Get all other ajaxified replies
        //----------------------------------

        for ( var id = 0; id < documentDIVs.length; id++ )
        {
            if ( documentDIVs[id].getAttribute( 'name' ) == 'ajax-anchor' )
            {
                anchors.push( documentDIVs[id].getAttribute( 'id' ) );
            }
        }

        //----------------------------------
        // Reverse to get last one first
        //----------------------------------

        anchors.reverse();

        //----------------------------------
        // INIT vars for display
        //----------------------------------

        var parent                = document.getElementById( anchors[0] );
        var newAnchor            = anchors.length;
        reply.style.display        = "none";
        reply.innerHTML         = xmlobj.xmlhandler.responseText;

        //----------------------------------
        // Set name and anchor
        //----------------------------------

        reply.setAttribute( 'id', 'ajax-anchor-'+newAnchor );
        reply.setAttribute( 'name', 'ajax-anchor' );

        parent.parentNode.insertBefore( reply, parent.nextSibling );

        //----------------------------------
        // Effectify? =D
        //----------------------------------

        if ( effects )
        {
            Effect.Shrink(        'qr_open',                     { duration: 1.0 } );
            Effect.BlindDown(    'ajax-anchor-'+newAnchor,     { duration: 2.0 } );
        }
        else
        {
            //-----------------------------------
            // This forum is owned by a douchebag
            //-----------------------------------

            var replyBox    = document.getElementById( 'qr_open' );
            var newPost        = document.getElementById( 'ajax-anchor-'+newAnchor );

            //----------------------------------
            // Anyway, respect their decision...
            //----------------------------------

            replyBox.style.display    = "none";
            newPost.style.display    = "inline";
        }
    };
    
    //----------------------------------
    // LOAD XML
    //----------------------------------
    
    xmlobj = new ajax_request();
    xmlobj.onreadystatechange( do_request_function );

    //----------------------------------
    // Communicate (POST)
    //----------------------------------
    
    xmlobj.process( url, 'POST', post );
};