String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }

String.prototype.strip_tags = function() {
    tags = this;
    stripped = tags.replace(/[\<\>]/gi, "");
    return stripped;
}

// Цитировать комментарий
function quote_comment(commentID) {
    new Ajax.Request('/ajaxcomment.html', {
        method: 'get',
        parameters: {id: commentID},
        onSuccess: function(transport){
            //alert(transport.responseText);
            $('xpcomment').value = commentID;
            $('xmcomment').value = $('xmcomment').value + '[quote]'+transport.responseText+'[/quote]\n';
            commentAddFormOpen(true);
        },
        onFailure: function(){ alert('Error.') }
    });

    /*$('xpcomment').value = commentID;
    commentAddFormOpen(true);*/
    return false;
}

// редактировать комментарий
function edit_comment(containerID, commentID, linkObj) {

    new Ajax.Request('/ajaxcomment.html', {
        method: 'get',
        parameters: {id: commentID},
        onSuccess: function(transport){
            //alert(transport.responseText);
            linkObj.style.display = 'none';
            data = transport.responseText;

            myform = $('ecblock').innerHTML;
            myform = myform.replace("[commentID]", commentID);
            myform = myform.replace("[data]", data);

            $(containerID).innerHTML = myform;
        },
        onFailure: function(){ alert('Error.') }
    });

    return false;
}

