﻿
function OnTimeOut(arg) {
    alert("[Webservice Error] Message: TimeOut");
}

function OnError(arg) {
    alert("[Webservice Error] Message: " + arg._message);
}




function IgnoreExceptionType(exceptionSummaryId) {
    UIHandler.AjaxHandler.IgnoreExceptionType(exceptionSummaryId, exceptionIgnored, OnError, OnTimeOut);
}

function exceptionIgnored() //Called on completion of AJAX async
{ }




function SetUIAreaPreference(areaId, status) {
    UIHandler.AjaxHandler.SetUIAreaPreference(areaId, status, UIAreaPreferenceRecorded, OnError, OnTimeOut);
}

function UIAreaPreferenceRecorded() //Called on completion of AJAX async
{ }




function SendUserDistributedInvite(email) {
    UIHandler.AjaxHandler.SendUserDistributedInvite(email, UserDistributedInviteSent, OnError, OnTimeOut);
}

function UserDistributedInviteSent(remaining) //Called on completion of AJAX async
{
    $(".count").html(remaining);
    
    if (remaining < 1) {
        $(".count").html("0");
        $(".InviteButton").attr('disabled', true);
        $("#basicModal").hide();
        $.modal.close();
        alert("You have no invites remaining. Please check back often as we will be distributing the invites regularly.");
    }
}