﻿function signalPicture(Id) {
    $.post('/Picture.aspx/Signal/',
                    { id: Id },
                    function (result) {
                        if (result = "success") {
                            $('.pictureView .signal').fadeOut();
                        }
                        else {
                            alert('error');
                        }
                    }
                    , 'text');
}

function connectModal() {
    $('#mask, .window').hide();
    showBox('.loginBox');
    return false;
}

function signalComment(Id) {
    $.post('/Picture.aspx/SignalCom/',
                    { id: Id },
                    function (result) {
                        if (result = "success") {
                            $("#" + Id).fadeOut();
                        }
                        else {
                            alert('error');
                        }
                    }
                    , 'text');
}

function markPicture(Id, IsLike) {
    $.post('/Picture.aspx/Mark/',
                    {
                        id: Id,
                        isLike: IsLike
                    },
                    function (result) {
                        if (result != "fail") {
                            $('.iLike').fadeOut();
                            $('.iDislike').fadeOut();
                            $('.marks').html(result + " votes");
                        }
                        else {
                            alert('error');
                        }
                    }
                    , 'text');
}

function AddComment(Id) {
    var CommentTxt = $('.commentArea').val();
    $.post('/Picture.aspx/AddComment/',
                    {
                        id: Id,
                        commentTxt: CommentTxt
                    },
                    function (result) {
                        if (result != "fail") {
                            var htmlComment = "<span class=\"comment\">";
                            htmlComment += CommentTxt;
                            htmlComment += "</span> <span class=\"commentAuthor\">";
                            htmlComment += result;
                            htmlComment += "</span>";
                            $(htmlComment).appendTo('.commentContainer');

                            $(function () {
                                $('.scrollcontent').jScrollPane({ showArrows: true, scrollbarWidth: 7 });
                            });
                        }
                        else {
                            alert('error');
                        }
                    }
                    , 'text');
                }

