﻿var clsSubscribeToMailingListPopOver = new function() {
    this.callMethod = function(e, emailAddress, userName) {
        if (typeof (Page_ClientValidate) == 'function') Page_ClientValidate('SubcribeToMailingListPopOver');

        if (!Page_IsValid) {
            $find('SubcribeToMailingListModalPopupExtenderBehavior').show();
        }
        else {
            showProgressUpdatePanel();
            var proxy = new Services.Communication();
            proxy.SubcribeToMailingList(emailAddress, userName, this.onSuccess, this.onFail, null);
        }
    }

    this.onSuccess = function(result) {
        hideProgressUpdatePanel();
        alert(result);
    }

    this.onFail = function(result) {
        hideProgressUpdatePanel();
        alert('An error occurred: ' + result);
    }
}