function postComment(rss_id,author_id){
    //alert(MusQuery("#comment_body").val());

    MusQuery.post("rss_comments_ajax.php", {
        type: 'add',
        rssId: rss_id,
        authorId: author_id,
        comment: MusQuery("#comment_body").val()
    },
    function(data){
        document.getElementById('comment_body').value = '';
        MusQuery("#showcomments").prepend(data);
    });
}

function deleteRssComment(comment_id,author_id){
    var answer = confirm("Are you sure you want to delete this comment?")
    if(answer){
        MusQuery.post("rss_comments_ajax.php", {
            type: 'CommentDelete',
            commentId: comment_id,
            authorId: author_id
        },
        function(data){
            if(data > 0){
                MusQuery('#comment_'+data).remove();
            } else {
                alert('Error occured while deleting comment!')
            }
        });
    }
}

function deleteRssFeed(feed_id){
    var answer = confirm("Are you sure you want to delete this feed?")
    if(answer){
        MusQuery.post("rss_comments_ajax.php", {
            type: 'FeedDelete',
            feedId: feed_id
        },
        function(data){
            if(data > 0){
                MusQuery('#rss_feed_block_'+data).remove();
            } else {
                alert('Error occured while deleting feed!')
            }
        });
    }
}

function deleteConsanfronMaterial(id){
    var answer = confirm("Are you sure you want to delete this entry?")
    if(answer){
        MusQuery.post("consanfron_ajax.php", {
            type: 'ConsanfronMaterialDelete',
            Id: id
        },
        function(data){
            if(data > 0){
                MusQuery('#rss_feed_block_'+data).remove();
            } else {
                alert('Error occured while deletin. Please try again!')
            }
        });
    }
}

function clearText(){
   if(document.getElementById('comment_body').value == 'Write Something...'){
       document.getElementById('comment_body').value = '';
   }
}






function postNewsComment(article_id){
    MusQuery.post("common_ajax.php", {
        task: 'news_comments',
        ArticleID: article_id,
        comment: MusQuery("#comment_body").val()
    },
    function(data){
        document.getElementById('comment_body').value = '';
        document.getElementById('comment_body').innerHTML = '';
        document.getElementById('postcomment').innerHTML = data;
    });
}

function deleteNewsComment(article_id,comment_id){
    var answer = confirm("Are you sure you want to delete this comment?")
    if(answer)
    {
        MusQuery.post("common_ajax.php", {
            task: 'CommentDelete',
            ArticleID: article_id,
            commentId: comment_id
        },
        function(data){
            document.getElementById('comment_body').innerHTML = '';
            document.getElementById('postcomment').innerHTML = data;
        });
    }
}

function deleteTodo(todo_id){
    var answer = confirm("Are you sure you want to delete this ?")
    if(answer)
    {
        MusQuery.post("common_ajax.php", {
            task: 'TodoDelete',
            todo_id: todo_id
        },
        function(data){
            document.getElementById('todo_list').innerHTML = data;
        });
    }
}


function postArticleComment(article_id){
    MusQuery.post("common_ajax.php", {
        task: 'article_comments',
        article_id: article_id,
        comment: MusQuery("#comment_body").val()
    },
    function(data){
        document.getElementById('comment_body').value = '';
        document.getElementById('comment_body').innerHTML = '';
        document.getElementById('postcomment').innerHTML = data;
    });
}

function deleteArticleComment(article_id,comment_id){
    var answer = confirm("Are you sure you want to delete this comment?")
    if(answer)
    {
        MusQuery.post("common_ajax.php", {
            task: 'ArticleCommentDelete',
            article_id: article_id,
            commentId: comment_id
        },
        function(data){
            document.getElementById('comment_body').innerHTML = '';
            document.getElementById('postcomment').innerHTML = data;
        });
    }
}

var article_id;
// Delete
function deleteArticle(articleid)
{
    // Display
    article_id = articleid;
    TB_show('Delete Article Entry?', '#TB_inline?height=100&width=300&inlineId=confirmarticledelete', '', '../images/trans.gif');
}

function deleteArticleConfirm()
{ 
    // Ajax    
    MusQuery.post("common_ajax.php", {
        task: 'deletearticle',
        article_id: article_id
    },
    function(data){
        window.location.reload( false );
    });
    
    // Reset
    article_id = 0;
}
