﻿//-----------------------------------------------------------------------------+
// jQuery call AJAX Page Method                                                |
//-----------------------------------------------------------------------------+
function NotifyMethod(paramArray) {
    var pagePath = window.location.pathname;
    //-------------------------------------------------------------------------+
    // Create list of parameters in the form:                                  |
    // {"paramName1":"paramValue1","paramName2":"paramValue2"}                 |
    //-------------------------------------------------------------------------+
    var paramList = '';
    if (paramArray.length > 0) {
        for (var i = 0; i < paramArray.length; i += 2) {
            if (paramList.length > 0) paramList += ',';
            paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
        }
    }
    //alert(paramList);
    paramList = '{' + paramList + '}';
    //Call the page method
    $.ajax({
        type: "POST",
        url: "/views/Notifications.aspx/GetLastPublic",
        //url: "/services/Web/Notifications.asmx/GetLastPublic",
        contentType: "application/json; charset=utf-8",
        data: paramList,
        dataType: "json",
        success: function show(result) {
            if (result.d != null) {
                //alert(result.d);
                //var stack_btnleft = { 'dir1': 'down', 'dir2': 'right', 'push': 'top' };
                $.pnotify({
                    pnotify_title: '',
                    pnotify_text: result.d,
                    pnotify_addclass: 'custom',
                    //pnotify_addclass: 'stack-bottomleft',
                    pnotify_notice_icon: '',
                    pnotify_opacity: .8,
                    pnotify_nonblock: true,
                    pnotify_nonblock_opacity: .4,
                    pnotify_sticker_hover: false,
                    pnotify_closer_hover: false,
                    pnotify_stack: {"dir1": "top", "dir2": "right", "push": "top"}
                });
            }

        },
        error: ""
    });
}


