
function fileConfirm(commentID)
{
    var test = confirm('Are you sure?');
    if(test == true)
    {
        window.location='./../../../file/remove/'+commentID+'/';
    }
    return false;
}

function doReplyTo(comment_id,nickname)
{
    //set inner html text of reply to id
    var elm = $('replyTo');
    elm.innerHTML='Replying to '+nickname+' ';

    //create cancel hyperlink     
    var a = document.createElement('a');
    a.setAttribute('href','');
    a.onclick=doReplyToCancel;;
    a.innerHTML="Cancel";
    elm.appendChild(a);

    a=document.createElement('br');
    elm.appendChild(a);
    
    //update comment_id in form
    $('replyToCommentId').value = comment_id;
    
    //jump to form
    window.location = '#replyForm';
    
    return false;
}

function doReplyToCancel()
{
    //set html to ''
    $('replyTo').innerHTML = '';

    //update comment_id in form
    $('replyToCommentId').value='';
    
    return false;
}

function limitText()
{
	var limitField = document.getElement('.tinymce');
	limitText_common(limitField.value.length);
}

function limitText_common(length)
{
	var limitNum = $('limitnum').value;
	$('limitCount').value = limitNum - length;
}

function discuss_load()
{
    $$('.tinymce').addEvent('keyup',limitText);
}

function tinymce_event(e)
{
	if(e.type == 'keyup'){
		var charcount = tinyMCE.activeEditor.getDoc().body.innerHTML.length;
		limitText_common(charcount);
	}


}
window.addEvent('domready',discuss_load);
