﻿var userid = 0;
var returnString = "";
var ProfessionalsMethods = {
    RemoveImages: function() {
        $('.filePathImg').attr('src', '');
        $('.filePath').val('');
        $('.uploadControl').css({ "display": "block" });
        $('.visibleControl').css({ "display": "none" });
    },
    ShowInfoAdd: function() {
        $('#tbOtherInfoTitle').val('');
        $('#tbOtherInfoDetails').val('');
        $('#pnlAddOtherInfo').fadeIn('fast');
    },
    CancelAddOtherInfo: function() {
        $('#tbOtherInfoTitle').val('');
        $('#tbOtherInfoDetails').val('');
        $('#pnlAddOtherInfo').fadeOut('fast');
    },
    SaveAddOtherInfo: function() {
        userid = $('#userid input[type=hidden]:first').val();
        $.ajax({
            type: "GET",
            url: "/Services/ProfessionalsMethods.asmx/AddNewCategory?UserId=" + userid + "&Title=" + $('#tbOtherInfoTitle').val() + "&Text=" + $('#tbOtherInfoDetails').val() + "",
            cache: false,
            success: function(data) {
                returnString = $(data).text();
                $('#otheruserinfo').append(returnString);
                $('#pnlAddOtherInfo').fadeOut('fast');
            }
        });
    },
    SaveOtherInfo: function(id) {
        var title = $('#otherinfo' + id + ' .otherinfotitle').val();
        var text = $('#otherinfo' + id + ' .otherinfotext').val();
        $.ajax({
            type: "GET",
            url: "/Services/ProfessionalsMethods.asmx/SaveNewCategory?OtherInfoId=" + id + "&Title=" + title + "&Text=" + text + "",
            cache: false,
            success: function() {

            }
        });
    },
    DeleteOtherInfo: function(id) {
        $.ajax({
            type: "GET",
            url: "/Services/ProfessionalsMethods.asmx/DeleteOtherInfo?OtherInfoId=" + id + "",
            cache: false,
            success: function(data) {
                $('#otherinfo' + id).fadeOut('fast').remove();
            }
        });
    }
}