/**
* Fonctions JavaScript de la rubrique Forum
*
* MagicCorporation WebSystem v6.0
* Gestionnaire de Contenu pour site Internet
* 
* @package      MC6
* @subpackage   forum
* @author       Jean-Christophe Taisne <amonra@magiccorporation.com>
* @link         http://mc6.magiccorporation.com
* @copyright    2000-2009 MagicCorporation
* @version      6.0 $Id: function.js 1176 2009-11-09 16:04:01Z amonra $
*/

document.include('mc6/librairies/js/smooth-src-comments.js');

function quote_reply(post_id, membre, date) { 
    new Ajax.Request('mc.php', {
        method      : 'POST',
        parameters  : {
            rub         : "forum", 
            file        : "ajax",  
            op          : "post_text",
            post_id     : post_id
        },
        onSuccess   : function(transport) {
                var inst = FCKeditorAPI.GetInstance("post_text");
                inst.SetData('<blockquote><p><b>Le '+date+', '+membre+' avait écrit ...</b></p><p>'+encodeHTML(transport.responseText)+'</p></blockquote><br /><br />');
                openId('block_reply');
                var a = $('foo');
                clearInterval(Scroller.interval);
                Scroller.interval = setInterval('Scroller.scroll('+Scroller.gy(a)+')',10);
        },
        onFailure   : function() {
            alert("Erreur!");
        }
    });
}

function div_post_text() {
    if($('block_reply') && window.location.hash != '#foo')
        openClose('block_reply');    
}
//addListener(window, 'load', div_post_text);

// Fonction permettant de remplacer le OnLoad d'un addListener avant les chargements d'images, merci Julien Tartarin de lexode.com
function trytoload_div_post_text() {
   if(typeof div_post_text == "function" && document.getElementById('footer')) {
       div_post_text();
   } else {
       setTimeout("trytoload_div_post_text();", 100);
   }
}
trytoload_div_post_text();

function editor_post_text() {
    if($('post_text')) {
        var oFCKeditor_post_text = new FCKeditor('post_text');
        oFCKeditor_post_text.BasePath = 'mc6/src/fckeditor/'; 
        oFCKeditor_post_text.Width = '100%'; 
        oFCKeditor_post_text.Height = '200';
        //oFCKeditor_post_text.Config['CustomConfigurationsPath'] = 'editor/plugins/bbcode/_sample/sample.config.js';
        oFCKeditor_post_text.ToolbarSet = 'Forum';
        oFCKeditor_post_text.ReplaceTextarea();
    }
}
//addListener(window, 'load', editor_post_text);

// Fonction permettant de remplacer le OnLoad d'un addListener avant les chargements d'images, merci Julien Tartarin de lexode.com
function trytoload_editor_post_text() {
   if(typeof editor_post_text == "function" && document.getElementById('footer')) {
       editor_post_text();
   } else {
       setTimeout("trytoload_editor_post_text();", 100);
   }
}
trytoload_editor_post_text();

