function VideoAddComment(ObjectId, Body, IsModerate, docl, nocom, commcom) {
    var status = "";
    if (IsModerate == 'true')
        status = "P";
    else
        status = "A";

    if (Body == docl)
        alert(nocom);
    else {
        var CommunityId = document.getElementById('CommunityId').value;
        var url = '/Global/Services/Comments.asmx/AddInVideo';
        new Ajax.Request(url, { method: 'post', parameters: { ObjectId: ObjectId, Body: Body, Status: status },
            onSuccess: function (transport) {
                var rsp = transport.responseText.evalJSON().rsp;
                if (rsp.stat != 'fail')
                    alert(rsp.err.msg);
            } 
        });

        document.getElementById('commentario_Begin').style.display = 'none';
        document.getElementById('commentario_End').style.display = 'block';
        if (IsModerate == 'True')
            document.getElementById('comentario_pendiente').style.display = 'block';
        
        document.getElementById('Body').innerHTML = document.getElementById('line').value;


        if (document.getElementById('checkFaceShare')) {
            if (document.getElementById('checkFaceShare').checked) {

                var videoType = document.getElementById('videoType').value;
                var uri = document.getElementById('videoUri').value;
                var flvPath = 'http://www.youtube.com/v/' + uri;
                var thumbUri = document.getElementById('ThumbUri').value;

                var attachment;


                if (videoType == 'Y') {
                    attachment = [{ 'type': 'flash', 'swfsrc': flvPath, 'imgsrc': thumbUri, 'width': '120', 'height': '90', 'expanded_width': '400', 'expanded_height': '360'}];
                }
                else {
                    attachment = [{ 'type': 'image', 'src': thumbUri, 'href': window.location.href}];
                }
                var title = document.getElementById('CommunityTitle').value;
                callPublish('', { 'name': commcom + title, 'href': window.location.href, 'description': Body, 'media': attachment }, actionLinks);
            }
        }
    }
}

function DeleteComment(ObjectId,ObjectTypeId,Id)
{
    var url = '/Global/Services/Comments.asmx/CommentDel';												
					new Ajax.Request(url, {method: 'post', parameters: { ObjectId: ObjectId, ObjectTypeId: ObjectTypeId, Id: Id },												
									 onSuccess: function(transport) {     
                					 var rsp = transport.responseText.evalJSON().rsp;
								if(rsp.stat != 'fail')
									alert(rsp.err.msg);

																			
                        } });
                 
}




function VideoApproval(Id,ObjectId)
{

    var url = '/Comment/Comment.ashx?VideoApproval&Format=json';												
					new Ajax.Request(url, {method: 'post', parameters: { Id: Id, ObjectId: ObjectId},
									 onSuccess: function(transport) {     
                					 var rsp = transport.responseText.evalJSON().rsp;
								if(rsp.stat != 'fail')
									alert(rsp.err.msg);

																			
                        } });
                 
}

function VideoDesapproval(Id,ObjectId)
{

    var url = '/Comment/Comment.ashx?VideoDesapproval&Format=json';												
					new Ajax.Request(url, {method: 'post', parameters: { Id: Id, ObjectId: ObjectId},												
									 onSuccess: function(transport) {     
                					 var rsp = transport.responseText.evalJSON().rsp;
								if(rsp.stat != 'fail')
									alert(rsp.err.msg);

																			
                        } });
                 
}


function VideoBloqUser(Id,ObjectId)
{

    var url = '/Comment/Comment.ashx?VideoBloqUser&Format=json';												
					new Ajax.Request(url, {method: 'post', parameters: { Id: Id, ObjectId: ObjectId},												
									 onSuccess: function(transport) {     
                					 var rsp = transport.responseText.evalJSON().rsp;
								if(rsp.stat != 'fail')
									alert(rsp.err.msg);

																			
                        } });
                 
}


function refresh(ClickHereToComment) {
        if (document.getElementById('line').value == ClickHereToComment)
        document.getElementById('line').value = '';
    }

function checkEmpty(ClickHereToComment)
{
    var element = document.getElementById('line').value;
    if(element == '')
    {
        document.getElementById('line').value = ClickHereToComment;
    }
}   

function cambio(e, pre, post)
{
    var element = document.getElementById('line').value
    n = element.length;
    t = 164;
    if (n > t)
    {
        document.getElementById('line').value = document.getElementById('line').value.substring(0, t);
        document.getElementById('cont').innerHTML = post + ' ' + num + ' ' + pre; 
    }
    else
    {
        num = t - n;
        document.getElementById('cont').innerHTML = post + ' ' + num + ' ' + pre;
    }
}



function DeleteVideoComment(ObjectId, Id, mens,username) {

    if (confirm(mens)) {
        var url = '/Global/Services/Comments.asmx/DelInVideo';
        new Ajax.Request(url, { method: 'post', parameters: { ObjectId: ObjectId, Id: Id,UserName:username },
            onSuccess: function (transport) {
                var rsp = transport.responseText.evalJSON().rsp;
                if (rsp.stat != 'fail')
                    alert(rsp.err.msg);
            } 
        });
        document.getElementById('comment_' + Id).style.display = 'none';
        document.getElementById('Line_' + Id).style.display = 'none';
    }
}

