﻿$(document).ready(function () {
    GetScrollText();
    GetAlertEvents();
});


function GetScrollText() {
    varType = "POST";
    varUrl = "Service.svc/GetScrollText";
    varSuccessFunction = "GetScrollTextComplete";
    varProcessData = true;
    varAsyc = false;
    hideModalWhenDone = true;
    callService();
}

function GetScrollTextComplete(result) {
    ShowNotification(result.notification);
    $('#scrollText').html(result.GetScrollTextResult);
}

function GetAlertEvents() {

    if ($.cookie("eventTypeId") == null) {
        $.cookie("eventTypeId", 0)
    }

    if ($.cookie("eventHistoryId") == null) {
        $.cookie("eventHistoryId", 1)
    }

    var defaultLookup = true;

    if ($.cookie("defaultLookup") != null) {
        defaultLookup = $.cookie("defaultLookup");
    }


    DisplayLoadingAnimation();
    varType = "POST";
    varUrl = "Service.svc/GetAlertEvents";
    varSuccessFunction = "GetAlertEventsComplete";
    varData = { "eventTypeID": $.cookie("eventTypeId"), "eventHistoryID": $.cookie("eventHistoryId"), "pressBoxUser": false, "getDefaultEvents": defaultLookup };
    varProcessData = true;
    varAsyc = true;
    hideModalWhenDone = true;
    callService();
}

function GetAlertEventsComplete(result) {
    HideLoadingAnimation();
    ShowNotification(result.notification);
    $('#eventIcons').html(result.eventIconsHtml);
    var eventListHtml = result.eventListHtml;
    if (eventListHtml == '') {
        eventListHtml = "<b>The event filters that you selected did not return any results.  Please adjust your selections.</b>";
    }
    $('#eventList').html(eventListHtml);
}
