﻿
function _popupDeclaration(_moduleid) {
   
    jQuery('div[id$="ctr' +_moduleid + '_ViewEmailSignupForm_dvProgress"]').dialog({
        modal: true,
        width: 42,
        autoOpen: false

    });

    jQuery('div[id$="ctr' +_moduleid + '_ViewEmailSignupForm_dvSuccessMsg"]').dialog({
        modal: true,
        //show: 'blind',
        // height:525,
        width: 500,
        autoOpen: false

    });
    jQuery('#imgMsgclose' + _moduleid).click(function () {
        jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvSuccessMsg"]').dialog('close');
        return false;
    });

}

function _CallAjax(obj,_moduleid, _refferalUrl, _AdminEmailid) {
    
    var strInputEmailId = document.getElementById(obj.id.replace("BtnSubmit", "txtSignup")).value;
    var strModuleid = _moduleid;
    var strRefferalURL = _refferalUrl;
    var strAdminEmailId = _AdminEmailid;
   // var strSuccessmsg = _successMsg;
   // var strerrormsg = _errorMsg;
    jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvProgress"]').hide();
    jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvSuccessMsg"]').hide();

    jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_PnlDisplay"]').hide();
      
    jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvProgress"]').show(); //dialog('open');
    jQuery.ajax({
        type: "POST",
        url: "/DesktopModules/DNNCentric-EmailSignupForm/Signup.aspx/GetName",
        data: "{ InputEmailId:'"+strInputEmailId+"', moduleid:'"+strModuleid+"', refferaluel: '"+strRefferalURL+"', adminemailid: '"+strAdminEmailId+"' }",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        fail: onFail,
        success: function (data) {
            // Replace the div's content with the page method's return.
            jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvProgress"]').hide(); //dialog('close');
            document.getElementById('lblSuccessMsg' + _moduleid).innerHTML = data.d;

            jQuery('div[id$="ctr' + _moduleid + '_ViewEmailSignupForm_dvSuccessMsg"]').show(); //dialog('open');

        }

    });
}
function onFail(response) {
    alert("response");

}
